Aladdin - Scala Bugtracking
[#1005] project: interpreter priority: low category: bug
submitter assigned to status date submitted
Nikolay Lex fixed 2007-03-15 10:18:22.0
subject [contrib #378] Several exceptions raised on unconventional inputs
code
scala> ' 
scala> `
what happened
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
        at scala.tools.nsc.util.CharArrayReader.next(CharArrayReader.scala:53)
        at scala.tools.nsc.ast.parser.Scanners$Scanner.getlitch(Scanners.scala:650)
        at scala.tools.nsc.ast.parser.Scanners$Scanner.fetchToken(Scanners.scala:339)
        at scala.tools.nsc.ast.parser.Scanners$Scanner.nextToken(Scanners.scala:167)
        at scala.tools.nsc.ast.parser.Scanners$Scanner.(Scanners.scala:991)
        at scala.tools.nsc.ast.parser.Parsers$Parser.(Parsers.scala:61)
        at scala.tools.nsc.Interpreter$$anonfun$5.simpleParse$0(Interpreter.scala:187)
        at scala.tools.nsc.Interpreter$$anonfun$5.apply(Interpreter.scala:192)
        at scala.tools.nsc.Interpreter$$anonfun$5.apply(Interpreter.scala:181)
        at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:62)
        at scala.tools.nsc.Interpreter.scala$tools$nsc$Interpreter$$parse(Interpreter.scala:181)
        at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:270)
        at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:211)
        at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:198)
        at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:111)
        at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:246)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:92)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

and

Exception in thread "main" java.lang.NullPointerException
        at scala.tools.nsc.ast.parser.Parsers$Parser.ident(Parsers.scala:385)
        at scala.tools.nsc.ast.parser.Parsers$Parser.path(Parsers.scala:421)
        at scala.tools.nsc.ast.parser.Parsers$Parser.simpleExpr(Parsers.scala:1033)
        at scala.tools.nsc.ast.parser.Parsers$Parser.prefixExpr(Parsers.scala:1008)
        at scala.tools.nsc.ast.parser.Parsers$Parser.postfixExpr(Parsers.scala:961)
        at scala.tools.nsc.ast.parser.Parsers$Parser.expr(Parsers.scala:908)
        at scala.tools.nsc.ast.parser.Parsers$Parser.templateStatSeq(Parsers.scala:2145)
        at The scanner and the parser seem to fail on some unconventional inputs such as the ' and the ` charact\
er. I guess the two issues are somewhat unrelated but it would be nice to do some additional checks for this kin\
d of input.scala.tools.nsc.Interpreter$$anonfun$5.simpleParse$0(Interpreter.scala:187)
        at scala.tools.nsc.Interpreter$$anonfun$5.apply(Interpreter.scala:192)
        at scala.tools.nsc.Interpreter$$anonfun$5.apply(Interpreter.scala:181)
        at scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:62)
        at scala.tools.nsc.Interpreter.scala$tools$nsc$Interpreter$$parse(Interpreter.scala:181)
        at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:270)
        at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:211)
        at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:198)
        at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:111)
        at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:246)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:92)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
what expected The scanner and the parser seem to fail on some unconventional inputs such as the ' and the ` characters. I guess the two issues are somewhat unrelated but it would be nice to do some additional checks for this kind of input. $ scala -version Scala code runner version 2.4.0-RC1 -- (c) 2002-2007 LAMP/EPFL
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-15 10:21:46.0
contribution #378. Assigned to Lex because it only crashes the interpreter. Keep in mind that the first example crashes the scanner, whereas the second crashes the parser.
Martin  edited on  2007-04-17 16:33:02.0
I noted these are fixed now.