[antlr-interest] Possible problem with lists after upgrade to 3.1
Grzegorz Cieslewski
cieslewski at hcs.ufl.edu
Tue Aug 12 18:10:00 PDT 2008
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)
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();
^
Note: G4Parser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
In Case2:
It compiles but still crashes at runtime:
Exception in thread "main" org.antlr.runtime.tree.RewriteEarlyExitException
at G4Parser.expr(G4Parser.java:171)
at Main4.main(Main4.java:13)
I have been out of the loop for couple months.
Has the syntax changed?
Is what I am trying to do not allowed?
Is there a better way of doing such operation?
I am little desperate since upgrade to 3.1 fixed some of my problems
but created new ones :)
I appreciate any and all help!
Greg
P.S. I did little investigating on Case1 and it seems that the way
that the listA is declared changed
from:
RuleReturnScope listA = null;
to:
G4Parser.id_return listA = null;
Which seems to be causing the problem.
As to why Case2 does not work I am clueless
--
=====================================================
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