[antlr-interest] A rule indirecting a token
Benjamin Niemann
pink at odahoda.de
Mon Sep 3 11:44:56 PDT 2007
Hello,
Joachim Rosskopf wrote:
> I´m very new to development with antlr and dsl development in general.
>
> Currently I´m trying to implement a kind of expression language for a
> data
> converstion tool. But I´m facing a problem I really don´t understand.
>
> Take the following snippet of my grammar:
>
> decimalDigit
> : DIGIT;
>
> DIGIT : ('0'..'9');
>
> I´m using ANTLRWorks to interpret the grammar. So "DIGIT" works quite
> well. But if i try "decimalDigit" I get an MismatchedTokenException
> (13 != 14). What´s wrong, and what the heck does 13 != 14 mean?
There must be another lexer rule that also matches a digit. 13 is the token
type of the recognized token and 14 the type of DIGIT. Look at the
generated <T>.tokens file to find out which rule has type 13.
If you still have trouble finding the cause, post the complete grammar (or
better a minimal but complete version demonstrating the behaviour).
HTH
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
More information about the antlr-interest
mailing list