[antlr-interest] Removing warning for optional token not working - need help

Scott McLoughlin scott at adrenaline.com
Fri Apr 11 16:55:44 PDT 2008


I have the following function definition form. The docstring is 
optional, and clearly
would conflict with expr.  So based on the book and online examples, I added
the ((LITSTR)=>LITSTR)?  construct.

stmtDef
    | 'def' ID OPAREN formals CPAREN (COLON type)? ((LITSTR)=> LITSTR)? expr
    ;



The warning DID go away, but now if I give an input like

def foo(x) : Int "Test" { 1 + x; }

I get an error message in antlrWorks - FailedPredicateException(stmdDef, 
{synpred1}?)

I got the same problem with ((ELSE)=> ELSE expr)?  Warnings go away, but 
fails on input.

I'm trying to get a completely warning free grammar. Is this a pipe 
dream of a newbie? :-)

I'm using antlrWorks 1.1.7.


Much thanks for any help.

Scott


More information about the antlr-interest mailing list