[antlr-interest] Fixed length tokens again

Stefan Wohlgemuth stefan.wohlgemuth at aloba.ch
Wed Jul 4 23:47:34 PDT 2007


Is there a way to define tokens which have a fixed length?
Say I would like to define a lexer rule N3 which defines a token of
three and another N4 of four numeric characters.

Something like this:

test: N3 N4;

N3:  Digit Digit Digit;         //  This in combination with N4 does not
work
N4:  Digit Digit Digit Digit; //

fragment
Digit: '0'..'9'


Thanks


-- 
aloba ag
Lyssachstrasse 15
CH-3400 Burgdorf



More information about the antlr-interest mailing list