Hi antlr users,
I have a combined grammar and I would like to do fuzzy parsing. I know that the
filter option is designed for the lexer part, but is there any way to use this
option by keeping my combined grammar ?
In our old parser (antlr2), we used this option like this (in a combined
grammar) :
class HostParser extends Parser;
...
// returns the current goal language code
private String getCode() {
String result = targetlexer.target.toString();
targetlexer.clearTarget();
return result;
}
...
and parser rules
...
class HostLexer extends Lexer;
options {
...
filter=TARGET;
...
}
public StringBuilder target = new StringBuilder("");
// clear the buffer
public void clearTarget() { target.delete(0,target.length()); }
...
protected
TARGET : (.) { target.append($getText); } ;
It was very easy to do fuzzy parsing and to use what was parsed : when needed,
we only had to call getCode() function to get a HostBlock code and to put it in
a node of our tree. But with antlr3, I'm not sure to understand how to proceed.
I tried to give the option 'filter=true;' directly to my fragment TARGET rule,
but it does not seem to be a good idea (I obtain errors).
Would someone have any idea ?
Regards,
JC
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.