[antlr-interest] Rule ignored in CSS grammar
Michnay Balázs
michnay at gmail.com
Mon Jan 18 06:17:51 PST 2010
Hi Guys,
The attached grammar is supposed to parse CSS files. I used this as an
initial version:
http://www.antlr.org/grammar/1214945003224/csst3.g
First I tried to add a functionality to prevent "_" chars for property
names, so I created a new lexer rule "CSSPROPERTYNAME" to ensure this. The
"declaration" rule has been updated accordingly. The funny thing is that now
the "selector" rule fails to recognize tag selectors like:
.class_selector img {
property: value;
...
}
Since my update should only affect property names and not selectors, I
really do not understand what the problem is. I tried to define lexer rules
as both fragments and literal values, no luck.
I used ANTLRWorks to debug this and have noticed that in the "selector" rule
"selectorOperation" is ignored:
selector
: elem selectorOperation* attrib* pseudo? -> elem selectorOperation*
attrib* pseudo*
;
Any ideas?
Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: css.g
Type: application/octet-stream
Size: 2973 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100118/51689444/attachment.obj
More information about the antlr-interest
mailing list