[antlr-interest] Re: Error: rule classDef trapped
Benhur
krupa_gadde at yahoo.com
Wed Oct 16 03:42:31 PDT 2002
I got solution for this error. The solution is - its obvious that I
can't make a token that is optional as an root node and so the tool
doesn't accept grammar like #( (START_LABEL label_name END_LABEL)? )
Rgds
Benhur
--- In antlr-interest at y..., "Benhur" <krupa_gadde at y...> wrote:
> Hi all,
>
> Whenever I compile grammar where MyParser which extends
TreeParser,
> I get the following error. Any pointers why is it so? I am also
> attaching the sub-rule at which this error is occuring.
>
> -------------------------------------------------------------------
--
> ANTLR Parser Generator Version 2.7.1 1989-2000 jGuru.com
> error: Token stream error reading grammar
> (s):antlr.TokenStreamRecognitionException: expecting ''', found '{'
> BenhurPLSQL.g: error: rule classDef trapped: BenhurPLSQL.g:229:
> unexpected token: (
> error: aborting grammar 'BenhurPLSqlParser' due to errors
> TokenStreamException: unexpected char: %
> -------------------------------------------------------------------
--
>
> Code --- I am getting error at the line #( (START_LABEL
label_name
> END_LABEL)?. I defined START_LABEL and END_LABEL as tokens and
also
> defined them in MyLexer
>
> plsql_block:
> #( (START_LABEL label_name END_LABEL)?
> (("declare")? (declare_spec)+)?
> ("begin")?
> seq_of_statements
> ("exception" exception_handler (exception_handler)*)?
> ("end" (label_name)? SEMI!)? )
> ;
>
> Thanks
> Benhur
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list