Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > ANTLR v3 greedy...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2263 of 2528
Post > Topic >>

ANTLR v3 greedy=false

by Amal <akhailtash@[EMAIL PROTECTED] > Dec 5, 2007 at 02:43 PM

I need to extract the multi-line comments from a C/C++ source file.
Most grammars deal with throwing out the ML_COMMENT like below:

ML_COMMENT
  : '/*' (options {greedy=false;} : .)* '/*' {skip();}
  ;

How do I keep the comment lines?  I need something like this:

comment : '/*' COMMENT_TEXT '*/' ;

I am confused as how to define COMMENT_TEXT in ANTLR v3.

COMMENT_TEXT : ?????? ;

Any hints and pointers are appreciated.
-- Amal
 




 1 Posts in Topic:
ANTLR v3 greedy=false
Amal <akhailtash@[EMAI  2007-12-05 14:43:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 12:42:23 CDT 2008.