> From: Gabriel Petrovay > Subject: [antlr-interest] How can I insert an action when a su-brule failsas well as when this is not present? > > Hi, > > I would like to perform a custom action when a subrule fails (=does not match). > > For example: > r : sr1 { /* action when sr1 is matched */ } (sr2)? > > I would like an action to be executed when the subrule 2 does not match.
I think you can do this: R : sr1 { /* found sr1 */ } ( sr2 { /* found sr2 */ } | { /* no sr2 */ } ); Although I'm pretty new at Antlr myself, so no guarantees that's the best way. Dave List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/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 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 -~----------~----~----~----~------~----~------~--~---