[antlr-interest] Re: One weird, one (hopefully) simple problem .. . from a newbie

cintyram <cintyram at yahoo.com> cintyram at yahoo.com
Tue Jan 28 10:14:22 PST 2003


hi,
 i could not understand the problem to my satisfactin .. but from
whatever i understood , i was dealing with a similar problem ..
in my case , # is the SLcomment char, and can appear inside a string
constant in the statement part too!!

so first i loopout all the # s inside strings if any in teh statement
part,
then i look for the first # after the end of valid statement ;
and copy the rest into another temp buffer ;

it has many interesting cases , like there can be string constants in
the comment with comments within them :) ;

from  the rist mail in this thread ,
 since there seem to be too many overlaps , it is ideal to build
auxillary structures which encode the context appropriately ;
then it will be easier to handle these situations ;
like multiple uses for REM , ;  , ! etc ..

to isolate the comment part of the statement, non context dependent
method like i used might not be suitable; 
instead it is better to have a context [ data structure] and keep
updating it as the parse progresses ;
from that it should be easy to identify the statement part,
the rest of the line can be ignored as comment;


also , some improvements are possible, ie first do it the faster
,"direct" way but if it is ambiguous, revert to the context based method ;

Looks like a lot of work, i wouldnt have done it as a first time exercise;

cheers
ram


--- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> Good question.  If so then it makes the whole problem much harder.  
> 
> Monty
> 
> -----Original Message-----
> From: John D. Mitchell [mailto:johnm-antlr at n...]
> Sent: Tuesday, January 28, 2003 9:23 AM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] One weird, one (hopefully) simple problem
> .. . from a newbie
> 
> 
> >>>>> "mzukowski" == mzukowski  <mzukowski at y...> writes:
> [...]
> > If you see a ';' then stop looking for a comment discard the comment
> 
> Um, er, can't comments contain ";"?
> 
> Take care,
> 	John
> 
>  
> 
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list