Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2318

Lexer fails on forward slash used in division

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1-rc-2
    • None
    • lexer
    • None
    • OS X Tiger 10.4.11

    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.

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            martin.adamek Martin Adamek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: