first, sorry about my english, i still learning.
I writing Python module for my framework, which parsing CSS files. I try regex, ply (python lexer and parser), but i fou
You should use the !
and ^
AST hints. To make /*
not appear in your AST, put !
after it. To control which elements become roots of AST subtrees, append ^
. It might look something like this:
NESTED_ML_COMMENT
: COMMENT_START!
(options {greedy=false;} : (NESTED_ML_COMMENT^ | . ) )*
COMMENT_END!
;
Here's a question specifically about these operators, which now that you know exist, I hope will be useful: What does ^ and ! stand for in ANTLR grammar