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