[antlr-interest] Trouble with spaces

Kevin J. Cummings cummings at kjchome.homeip.net
Mon Apr 4 10:23:52 PDT 2011


On 04/04/2011 11:18 AM, Jason Doege wrote:
> Hi All,
> 
> I am (we are) having a bit of trouble with spaces in a grammar.
> 
> What should be parseable is:
> 
> Alias b = in[4] {}
> 
> But what the generated parser seems to require to parse correctly is:
> 
> Alias b = in[4] { }
> 
> Here is the production that is supposed to parse it:
> 
> alias_def                : 'Alias' alias_name '=' concat_hier_data_signal (
>                              ';' |
>                              ('{' ('RefEnum' enum_name ';')* '}' )
>                            ) ;
> 
> Do you have any idea why a space is required between the '{'  '}' ?

Not without seeing *all* of your token rules....
(You *do* have rules for your tokens, right?  Either Lexer productions
or in a @tokens block?)

> To the best of my knowledge, I have no token that specifies '{}' in the
> grammar.

Please show us.

> Any suggestions would be welcome.
> 
> We are using the latest and greatest ANTLR.
> 
> --Jason Doege
> jdoege at gmail.com

-- 
Kevin J. Cummings
kjchome at verizon.net
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the antlr-interest mailing list