[antlr-interest] Help with this grammar?
Charlie Hubbard
charlie.hubbard at gmail.com
Sun Jul 3 09:12:01 PDT 2005
My charVocabulary is set to:
charVocabulary = '\0'..'\377';
I figured that would cover it, but it's not recognizing the '>'.
Thanks
Charlie
On 7/2/05, Nigel Sheridan-Smith <nbsherid at secsme.org.au> wrote:
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Charlie Hubbard
> > Sent: Sunday, 3 July 2005 9:20 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] Help with this grammar?
> >
> > I'm having trouble with the following piece of a grammar:
> >
> > ruleOptions
> > : LPAREN
> > ( keyword:IDENT (COLON keywordParam)? SEMICOLON )* RPAREN
> > ;
> >
> > keywordParam returns [ String param = "" ] { StringBuffer buf = new
> > StringBuffer(); }
> > : (letter:~SEMICOLON { buf.append( letter ); } )* { param =
> > buf.toString(); }
> > ;
> >
> > This portion recognizes one or more keyword parameter combinations.
> > Each keyword is optionally followed by a section of parameters.
> > Really it is only a single parameter, but that parameter could contain
> > more than one option. The keyword-parameter sequence is ended by a
> > semi-colon. So here is an example:
> >
> > ( message: "Hi, there this is a paramter of message keyword";
> > classtype: blah; rev: 6;)
> >
> > The following parser works, but it is failing on some characters I
> > didn't expect. I'm currently getting the following error:
> >
> > exception: filename:17:93: unexpected char: '>'
> >
>
>
> What is your "charVocabulary" setting? If you do not define a character to
> watch in the lexer, it is treated as an invalid character, and will not even
> be recognised by ~SEMICOLON.
>
> Nigel
>
> --
> Nigel Sheridan-Smith
> PhD research student
>
> Faculty of Engineering
> University of Technology, Sydney
> Phone: 02 9514 7946
> Fax: 02 9514 2435
>
>
>
More information about the antlr-interest
mailing list