Sam Barnett-Cormack wrote:
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?

  
ENTERO_T needs to be a non-fragment, ENTERO_V needs to be a parser rule, you need to cater for whitespace and so on...

CORCHE_CIERE : ']';

CORCHE_ABRE  : '[';

ENTERO_T     : 'integer';


entero_v     : ENTERO_T (CORCHE_ABRE CORCHE_CIERE)* EOF;


Jim





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to