I am in the slightly painful situation of wanting to apply a tree grammar
(type and other constraints checking) after a parser grammar even in the
case that there were parse errors.
At the moment I just have the tree grammar exit at the moment that it
encounters a malformed part of the tree; as I've seen stated on here before,
there's no other sensible thing to do.
Sometimes I'm fortunate to have simple parse errors that still result in a
correct tree (e.g. standalone unexpected tokens just get removed in
recovery). For the larger parse errors I'll get an AST containing
CommonErrorNodes which obviously trip up the tree grammar.
What I'm looking for is some common pattern or part of the ANTLR API that
will allow the parser to snip subtrees at a specific granularity that
contain error nodes as I create them. For example:
procedure:
command* -> ^(PROC command*)
needs to ignore any tree coming out of the 'command' rule that contains
error nodes.
Thanks,
Richard
--
\o/
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 [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.