I am surprised that the following grammar matches "xli" as a STATE rather
than as a ROMAN. It's like it's completely ignoring the syntactic predicate
on STATE. Anyone have any insight into what's going on?
I'm using:
ANTLRWorks 1.4
ANTLR 3.2 Sep 23, 2009 12:02:23
StringTemplate 3.2.1
Java 1.6.0_20 (Apple Inc.)
------------------------
grammar testg;
options { output=AST; }
cite : token+ EOF ;
token : ROMAN | STATE ;
fragment LETTER : 'a'..'z' ;
STATE: (('mi'|'dc') (EOF | ~LETTER)) => LETTER+
{System.err.println("Found state");};
// From Perl 6 Exegesis on pattern matching
//http://search.cpan.org/~lichtkind/Perl6-Doc-0.36/lib/Perl6/Doc/Design/E05.
pod
fragment ROMANPAT
: 'm'* ('d'?('c'('c'('c')?)?)?|'c'('d'|'m'))
('l'?('x'('x'('x')?)?)?|'x'('l'|'c'))
('v'?('i'('i'('i')?)?)?|'i'('v'|'x'))
;
ROMAN : (ROMANPAT (EOF | ~LETTER)) => ROMANPAT
{System.err.println("Found roman");};
------------------------
--
Ken Williams
Sr. Research Scientist
Thomson Reuters
Phone: 651-848-7712
[email protected]
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.