groovy
  1. groovy
  2. GROOVY-2318

Lexer fails on forward slash used in division

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major 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 :
      0

      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.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Martin Adamek
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: