Permalink
Browse files

make the compiler reject ?0, ?-1, etc (fixes #16)

  • Loading branch information...
1 parent 39279ee commit 34779a1e0f99e3d71f137b77c0621490905d2534 @SethTisue SethTisue committed Feb 28, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/main/org/nlogo/compiler/IdentifierParser.scala
@@ -48,7 +48,8 @@ private class IdentifierParser(program:Program,
if(ident.length == 1) 1
// if it's more than just "?", it needs to be an integer.
else try { Integer.parseInt(ident.substring(1)) }
- catch { case e:NumberFormatException => exception(INVALID_TASK_VARIABLE,tok ) }
+ catch { case e:NumberFormatException => exception(INVALID_TASK_VARIABLE, tok) }
+ cAssert(varNumber > 0, INVALID_TASK_VARIABLE, tok)
newToken(new _taskvariable(varNumber),
ident,TokenType.REPORTER,tok.startPos,tok.endPos,tok.fileName)
}

0 comments on commit 34779a1

Please sign in to comment.