hey guys,
I've got a really simple grammar that I'm trying to get working, but failing
miserably at the moment. Would really appreciate some pointers on this...
root : (keyword|ignore)*;
keyword : KEYWORD;
ignore : IGNORE;
KEYWORD : ABBRV|WORD;
fragment WORD : ALPHA+;
fragment ALPHA : 'a'..'z'|'A'..'Z';
fragment ABBRV : WORD?('.'WORD);
IGNORE : .{ Skip(); };
With the following test input:
"some ASP.NET and .NET stuff. that work."
I'm wanting a tree that is just a list of keyword nodes,
"some", "ASP.NET", "and", ".NET", "stuff", "that", "work"
At the moment I get
"some", "ASP.NET", "and", ".NET", "stuff. that",
(for some reason "." appears within the last keyword, and it misses "work"
If I change the ABBRV clause to
fragment ABBRV : ('.'WORD);
then that works fine, but I get keyword (asp) and keyword (.net) -
seperately - but I need them as a single token. Any help you can give would
be much appreciated.
Many thanks
James
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.