Hi Gabriel,

It would help if you could post your entire grammar and the exact error
message here.

Also, don't you mean

LPAREN: '(";
RPAREN: ')';

Don't worry we have all been there.

Thanks, Eric




On Fri, Sep 9, 2011 at 5:34 PM, Gabriel Miro <[email protected]> wrote:

> Hello all!
> I'm new to ANTLR and I'm trying to build a simple grammar that can
> recognize
> strings like ('val'). I'm using ANTLRWORKS and it generates a rule for
> string values with single quotes and I mapped the parenthesis to lexer
> tokens:
>
> RPAREN:'(';
> LPAREN:')';
> ...
> STRING
>    :  '\'' ( ESC_SEQ | ~('\\'|'\'') )* '\''
>    ;
>
>
> Now, if I try to write the following:
>
> rule : RPAREN STRING
>
> and evaluate the input ('blah', I get an error in the interpreter. I have
> no
> idea why, but I'm thinking the STRING rule is evaluating EOF and returning
> an error.
>
> Any ideas on how to make this work?
>
> Regards,
> Gabriel MirĂ³
> ANTLR Newbie
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>

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.

Reply via email to