[antlr-interest] Newbie: NoViableAltException
Buck, Robert
rbuck at verisign.com
Tue Jul 24 16:02:10 PDT 2007
I have no clue what you just said below. So let me start from the
beginning...
All I want to do is define a simple recursive grammar for a set-tuple
syntax that has input streams like:
(tuple@{(attr1=value1),(attr2=value2)}={(nestedtuple1=value3),(nestedtup
le2=value4)})
tuple
: L_PAREN tuple_declaration EQUALS ( tuple_value | set )
R_PAREN
;
set
: L_CURLY tuple ( COMMA tuple )*
;
tuple_declaration
: tuple_key ( AT_SIGN set )?
;
tuple_key
: IDENT
;
tuple_value
: ( PCHAR )*
;
Goal: I need to be able to extract the tuple key-names and the values.
If the value is complex (starts and ends with curly-braces), I need to
handle those differently by constructing references to child nodes in a
tree-structure of sorts. Sets are always on the right hand side.
So is this part correct, or not?
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Diehl,
> Matthew J
> Sent: Tuesday, July 24, 2007 5:09 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Newbie: NoViableAltException
>
> You're mixing your lexer and parser rules. IDENT is eating
> up all of the UNRESERVED whenever there's more than one,
> PCHAR if there's only one. Then you're saying that 'bar',
> which is more than one UNRESERVED, so it is the token IDENT,
> needs to be a bunch of PCHARs, but the PCHARs have already
> been turned in to the token IDENT.
[snip...]
More information about the antlr-interest
mailing list