[antlr-interest] Advice with backtracking/ambiguity

Ken Williams ken.williams at thomsonreuters.com
Wed Jun 2 15:08:02 PDT 2010

On 6/2/10 5:03 PM, "Ken Williams" <ken.williams at thomsonreuters.com> wrote:

> The only thing missing now is the character-data from DATE.  Is there a way
> to change that 'token' rule to something like this?
> token   :    date -> {new CommonToken(DATE, $text)} | SLASH | DIGITS;

Of course, right after I wrote that, I came up with this:

token   :    date -> {new CommonTree(new CommonToken(DATE, $text))}
        | SLASH
        | DIGITS;

I think that'll work for me.

Ken Williams
Sr. Research Scientist
Thomson Reuters
Phone: 651-848-7712
ken.williams at thomsonreuters.com

More information about the antlr-interest mailing list