Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1-rc-2
-
Fix Version/s: None
-
Component/s: lexer
-
Labels:None
-
Environment:OS X Tiger 10.4.11
-
Testcase included:yes
-
Number of attachments :
Description
This simple test is failing (I have groovy-all on classpath):
import groovyjarjarantlr.*; import java.io.*; import org.codehaus.groovy.antlr.parser.GroovyLexer; public class Main { public static void main(String[] args) throws TokenStreamException { String exp = "println 4 / 2 + 3"; InputStream inputStream = new ByteArrayInputStream(exp.getBytes()); GroovyLexer lexer = new GroovyLexer(inputStream); while (true) { Token token = lexer.nextToken(); if (token.getType() == Token.EOF_TYPE) return; System.out.println("token = " + token); } } }
with error:
token = ["println",<84>,line=1,col=1] token = ["4",<194>,line=1,col=9] Exception in thread "main" line 1:18: unexpected char: 0xFFFF at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:687) at Main.main(Main.java:14) Java Result: 1
If I replace '/' character with '*' or something else it works fine.
This will become invalid I guess, as I found at http://groovy.codehaus.org/Migration+From+Classic+to+JSR+syntax that '\' was used in old syntax for division and now one should use intdiv() function? Is that correct? If so, why it is compilable if one uses '/' for int division?