Welcome!

I am new to ANTLR and I'm trying to create lexer. I have a problem
with multiline comments which are constructed like this:
$/* text content $*/
but there is possibility to nest '$/*' and '$*' in comments like this:
$/* text comment content $/* text comment  content $* text  comment
content $*/

I have been looking for this kind of problem on internet but nothing
helps. I have been trying to write something like this:

MULTILINE_COMMENT
        :       '$/* ( options {greedy=false;} : ~('$*/') )* $*/
{$channel=HIDDEN;}
        ;

or

MULTILINE_COMMENT
        :       '$/* ( options {greedy=false;} : . )* $*/  {$channel=HIDDEN;}
        ;

which is similar to example from tutorial
// ANTLR 3
ML_COMMENT
    :   '/*' (options {greedy=false;} : .)* '*/' {channel=HIDDEN;}
    ;


But it behaves not as I wish beacouse '$' inside multiline comment
ruins everything. Could you help me?

P.S. I am sorry for my language, I'am writting for the first time in
English on discussion groups.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to