Folks --
I'd appreciate if someone could straighten me out on what is The Intended Way
on the following issue:
I'm working on a PHP grammar that produces an AST, testing it against various
source code.
When a parse succeeds, I get a nice AST returned from PhpParser.prog() via
prog_return.getTree(). However, if the parse fails, then what's returned via
prog_return.getTree() is a tree with just an error node (and this is readily
understood from the generated source in PhpParser.prog()).
So:
a) In case of error, is there an intended way of getting access to the actual
AST? I hacked an extra public field into PhpParser to get access to the AST
root_0 node, and it seems to be useful, but I would not have expected to need
to do that.
b) Is there some reason why I should not want to do that?
c) Why isn't prog() designed to just return the actual AST as usual and provide
error info by separate means?
d) I note that prior to normal exits, the PhpParser.prog() refines the
completed AST using rulePostProcessing, and setTokenBoundaries. For an AST
that's partially complete due to error exit, these still make sense to apply,
right?
Thanks,
-- Graham
-------------------
Grammar info:
The PHP grammar is similar to that listed at antlr.org (kuruvila) -- pretty
vanilla:
---------------
options {
backtrack = true;
memoize = true;
k=2;
output = AST;
ASTLabelType = CommonTree;
}
---------------
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
-~----------~----~----~----~------~----~------~--~---