Related articles |
---|
ANTLR v3 greedy=false akhailtash@gmail.com (Amal) (2007-12-05) |
From: | Amal <akhailtash@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Wed, 5 Dec 2007 14:43:29 -0800 (PST) |
Organization: | Compilers Central |
Keywords: | parse, question |
Posted-Date: | 08 Dec 2007 01:12:42 EST |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.