dcsimg
Question on parsing a comment line
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Patti_Koenig
Posted On:   Tuesday, December 16, 2003 12:09 PM

I am very new, just beginning with antlr. The language that I am writing a parser for has single line comments that start with "/*" following by text and ending with a new line or carriage return. I tried this code, but it crashes if there is a . or a , or a _ as part of the comment text. It doesn't seem to allow any punctuation at all. The comment text should be allowed to have that stuff. Please tell me what I am doing wrong. If you post a response please email it to me as well ... Thanks Patti Koenig Patti.Koenig@jpl.nasa.gov // Single-line comments SL_COMMENT    More>>


I am very new, just beginning with antlr. The language that
I am writing a parser for has single line comments
that start with "/*" following by text and ending with
a new line or carriage return.


I tried this code, but it crashes if there is a . or
a , or a _ as part of the comment text. It doesn't
seem to allow any punctuation at all. The comment text
should be allowed to have that stuff.


Please tell me what I am doing wrong. If you post a
response please email it to me as well ...


Thanks Patti Koenig


Patti.Koenig@jpl.nasa.gov



			
// Single-line comments
SL_COMMENT
: "/*"
(~('
'|'
'))* ('
'|'
'('
')?)
{$setType(Token.SKIP); newline();}
;

Here is an example comment it doesn't like

/* This, is a comment that my parser doesn't like.
   <<Less

Re: Question on parsing a comment line

Posted By:   Mick_Dundee  
Posted On:   Friday, January 2, 2004 11:28 AM

Hi Patti, you probably need to set the charVocabulary to include \003 to \0377 :)




Terence
About | Sitemap | Contact