Arcadio Rubio García schrieb: > Hi everyone, > > I've recently migrated to ANTLR from Yacc, and I don't find the way to > do context-sensitive scanning (lexing) with ANTLR. > > Can anyone point how to define an identifier token so that it's not > recognized when it's adjacent to an integer for instance, 1a is not > recognized as an integer + identifier? > > In Lex+Yacc, I used to do this with regular expressions, e.g.: > > identifier = /\b[a-zA-Z_][a-zA-Z0-9_]*\b/ > > Thanks in advance.
There is no way to so directly in ANTLR, unless you create a new lexer class which doesn't consume the entire input at once. The usual method to deal with this is to rewrite tokens in the parser for the second pass. Johannes > > List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
