[antlr-interest] Possible problem with lists after upgrade to 3.1

Grzegorz Cieslewski cieslewski at hcs.ufl.edu
Tue Aug 12 19:15:22 PDT 2008


I guess a temporary workaround could be creating an intermediate rule like:

expr
	: (listA+=exprInter)+ -> ^(EXPR $listA+)
	;
	
exprInter
	: (number | id)
	;
It seems to work like that.

Also how do I add it manually to the list ?

Greg

On Tue, Aug 12, 2008 at 9:17 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
>
> On Aug 12, 2008, at 6:10 PM, Grzegorz Cieslewski wrote:
>
>> Hi,
>>
>> In 3.1b2 (as included in antlrworks 1.2b5) the following seem to work:
>>
>> Case1:
>> (listA+=number | listA+=id)+ -> ^(EXPR $listA+)
>>
>> On the other hand this syntax properly compiles but crashes on runtime
>> Case2:
>> (listA+=(number | id))+ -> ^(EXPR $listA+)
>> Exception in thread "main"
>> org.antlr.runtime.tree.RewriteEarlyExitException
>>        at G4Parser.expr(G4Parser.java:238)
>>        at __Test__.main(__Test__.java:14)
>
> Weird...i thought sets were always broken (still)...hmm...oh, syntax is ok
> but runtime not yet.
>
> so, for now, manually add to list :(
>
>>
>>
>> When compiled with 3.1 I get errors:
>> In Case1:
>> ANTLR Parser Generator  Version 3.1 (August 12, 2008)  1989-2008
>> G4Parser.java:88: incompatible types
>> found   : G4Parser.number_return
>> required: G4Parser.id_return
>>                    listA=number();
>
> Oh shit...i changed that to be more specific but now it's tied to what rule
> you call; for += you actually only care it's a rule. crap!  That is an
> issue.
>
> Ter
>



-- 
=====================================================
Grzegorz Cieslewski
Research Assistant
High-performance Computing & Simulation (HCS) Research Laboratory
University of Florida, Dept. of Electrical and Computer Engineering
330 Benton Hall, Gainesville, FL, 32611-6200
Phone: (352) 392-9041
Email: cieslewski at hcs.ufl.edu
Web: www.hcs.ufl.edu
=====================================================


More information about the antlr-interest mailing list