[antlr-interest] Lexer rules
Sam Barnett-Cormack
s.barnett-cormack at lancaster.ac.uk
Sat Aug 15 07:26:22 PDT 2009
Marwan Ajraoui wrote:
> Hi everybody;
>
> Having this lexer rules, parsing the input doesn't recognize 'integer'
> as a type, only recognize types vector of integer as a token like
> integer[] or integet[][][].
>
> CORCHE_CIERE:']';
>
> CORCHE_ABRE: '[';
>
> fragment ENTERO_T: 'integer';
>
> ENTERO_V: ENTERO_T(CORCHE_ABRE CORCHE_CIERE)*;
>
> Am i missing something; I did try without fragment, and the same result.
Off the top of my head, it should match any of 'integer', 'integer[]'
and 'interger[][][]' as ENTERO_V tokens.
I think there's some rethinking wants to be done between what is in the
lexer and what is in the parser. For example, isn't '[]' really an
operator, or modifier, and wants to be dealt with in the parser, not
bundled into the same token?
--
Sam Barnett-Cormack
More information about the antlr-interest
mailing list