[antlr-interest] Reading all text to end-of-line in a rule

Bill Lear rael at zopyra.com
Mon Nov 29 08:14:18 PST 2010


On Monday, November 29, 2010 at 08:08:16 (+0100) Martijn Reuvers writes:
>Hello Bill,
>
>As said before most likely your newline is causing problems. I'd
>recommend you to get rid of it first (completely including the \r \n
>constructs), to the point where your grammar does not give any error
>anymore. After that introduce it step by step.
>
>As a side note avoid using text constructs in parser rules (e.g.
>'cleanLogs', use real tokens for it). Sooner or later these will cause
>trouble, plus that with real tokens you can have better error
>reporting.

The basic issue seems to be that I want this basic form:

    <command> [-timeout <NN>] [-notify <email_address>]

examples of which are:

    cleanlogs -timeout 20 -notify email1 at biz.com
    cleanup -timeout 10 -notify "email1 at biz.com email2 at biz.com"
    deploy -notify me at me.com -list "compA compB compC"

etc., along with the less-structured shell command types:

    // with timeout
    shell -timeout 20 find /x/web -name '*.logs.bak' | xargs rm -f

    // without timeout
    shell find /x/web -name '@*' | xargs mv /tmp/

The fact that I want an unquoted email address to be parsed (i.e.,
foo at bar.com and not 'foo at bar.com') seems to be causing the problem.

I'm going to try to redo things a bit more cleanly, try to boil down
the problem further, and repost if I still have problems.

Thanks for the help.


Bill



More information about the antlr-interest mailing list