[antlr-interest] How to handle first non whitespace comment characters?
Jim Loverde
loverde at nvisia.com
Wed Jun 13 01:20:22 PDT 2007
Hello,
I was hoping someone could help me out, as I've been struggling with this for a bit. Basically, how do you handle something like a COBOL asterisk comment character, where it is only a valid line comment indicator if it is the first non whitespace character on a line (but if it's part of an expression such as 5 * 7 it shouldn't be treated as a line comment character).
For example:
* This is a line comment
IF 5 * 5 = 20 THEN
* this is also a line comment
NOTHING
END-IF.
Ideally I'd like to have the line comments channeled to the hidden channel similar to the "normal" line comment such as:
LINE_COMMENT
: '!' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
Also, while on the topic, does anyone have a COBOL grammar for ANTLR (or even a partial grammar) that they can share?
Thanks in advance for any help.
More information about the antlr-interest
mailing list