I'm curious why labels do not work with AST rewrites in a rule such as this:
myRule : 'KEYWORD' '=' (INTEGER | FLOATNUMBER | HEXNUMBER | identifier | QUOTED_STRING) per the Definitive Guide to ANTLR, it *seems* like this would work: myRule : 'KEYWORD' '=' keyvalue=(INTEGER | FLOATNUMBER | HEXNUMBER | identifier | QUOTED_STRING) -> ^(KEYWORD $keyvalue) and, the above is certainly more intuitive (no?) than what does work: myRule : 'KEYWORD' '=' (INTEGER | FLOATNUMBER | HEXNUMBER | identifier | QUOTED_STRING) -> ^(KEYWORD INTEGER* FLOATNUMBER* HEXNUMBER* identifier* QUOTED_STRING*) The keyvalue example throws a RewriteEmptyStreamException because the generated code adds a null node to a RewriteRuleTokenStream, which causes a .NextNode() call to bomb out because there's no tokens in the stream at the time that call is made. I'm rather puzzled why that's the case. Question: would the label format work if I follow some guidelines in subrules??? Regards, Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
