[antlr-interest] how can a rule recognize more than one literal?

OJAY78 at gmx.de OJAY78 at gmx.de
Thu Oct 18 07:35:48 PDT 2007


Hi,


I try to create a rule which recognizes dateformat strings like this :yyyy-mm-dd or yymmdd....

My rule for this:

dateFormatLiterals
	:( 'y' | 'M' | 'd' | 'h' | 'H' | 'm' | 's' | 'S' | '-' | '.' | '/' )*
	;

I am using the interpreter of ANTLRWorks for that but it does not work for more than one literal. When I type y then the interpreter will build the tree as expected but when I try yyyymmdd I will receive a MismatchTokenExecption.

Why is that so? I do not want to make for that case special tokens because I just need them in that form for this rule


Thanks for your help
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger


More information about the antlr-interest mailing list