Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-10
-
None
-
New Groovy using antlr-2.7.5 parser
Description
> groovysh
Lets get Groovy!
================
Version: 1.0-beta-10-SNAPSHOT JVM: 1.4.2_06-b03
Type 'exit' to terminate the shell
Type 'help' for command help
Type 'go' to execute the statements
groovy> z = 2 * 3
Discarding invalid text:
General error during parsing: expecting DOT, found '3'
groovysh script:1:9: expecting DOT, found '3'
at antlr.Parser.match(Parser.java:211)
at org.codehaus.groovy.antlr.GroovyRecognizer.pathElement(GroovyRecogniz
er.java:8705)
at org.codehaus.groovy.antlr.GroovyRecognizer.pathExpressionTail(GroovyR
ecognizer.java:8614)
at org.codehaus.groovy.antlr.GroovyRecognizer.pathExpression(GroovyRecog
nizer.java:7772)
at org.codehaus.groovy.antlr.GroovyRecognizer.postfixExpression(GroovyRe
cognizer.java:10204)
at org.codehaus.groovy.antlr.GroovyRecognizer.unaryExpressionNotPlusMinu
s(GroovyRecognizer.java:10145)
at org.codehaus.groovy.antlr.GroovyRecognizer.unaryExpression(GroovyReco
gnizer.java:9999)
at org.codehaus.groovy.antlr.GroovyRecognizer.multiplicativeExpression(G
roovyRecognizer.java:9840)
at org.codehaus.groovy.antlr.GroovyRecognizer.additiveExpression(GroovyR
ecognizer.java:9790)
at org.codehaus.groovy.antlr.GroovyRecognizer.shiftExpression(GroovyReco
gnizer.java:7517)
at org.codehaus.groovy.antlr.GroovyRecognizer.relationalExpression(Groov
yRecognizer.java:9550)
at org.codehaus.groovy.antlr.GroovyRecognizer.equalityExpression(GroovyR
ecognizer.java:9500)
at org.codehaus.groovy.antlr.GroovyRecognizer.andExpression(GroovyRecogn
izer.java:9470)
at org.codehaus.groovy.antlr.GroovyRecognizer.exclusiveOrExpression(Groo
vyRecognizer.java:9440)
at org.codehaus.groovy.antlr.GroovyRecognizer.inclusiveOrExpression(Groo
vyRecognizer.java:9410)
at org.codehaus.groovy.antlr.GroovyRecognizer.logicalAndExpression(Groov
yRecognizer.java:9380)
at org.codehaus.groovy.antlr.GroovyRecognizer.logicalOrExpression(Groovy
Recognizer.java:9350)
at org.codehaus.groovy.antlr.GroovyRecognizer.conditionalExpression(Groo
vyRecognizer.java:3838)
at org.codehaus.groovy.antlr.GroovyRecognizer.assignmentExpression(Groov
yRecognizer.java:6539)
at org.codehaus.groovy.antlr.GroovyRecognizer.assignmentTail(GroovyRecog
nizer.java:7981)
at org.codehaus.groovy.antlr.GroovyRecognizer.expressionStatement(Groovy
Recognizer.java:6942)
at org.codehaus.groovy.antlr.GroovyRecognizer.statement(GroovyRecognizer
.java:924)
at org.codehaus.groovy.antlr.GroovyRecognizer.compilationUnit(GroovyReco
gnizer.java:488)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugi
n.java:67)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:290)
at groovy.ui.InteractiveShell.parse(InteractiveShell.java:366)
at groovy.ui.InteractiveShell.read(InteractiveShell.java:288)
at groovy.ui.InteractiveShell.run(InteractiveShell.java:142)
at groovy.ui.InteractiveShell.main(InteractiveShell.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
Thanks to phk and blackdrag for spotting this, and providing patches.
If you find any more test cases around this area then please reopen this issue as neccessary.
Patch applied...
http://cvs.groovy.codehaus.org/viewrep/groovy/groovy/jsr/ideas/parsers/antlr/src/org/codehaus/groovy/antlr/groovy.g?r1=1.12&r2=1.13