Fix a line numbering off-by-one in parser

When we see a newline token, its number is the line it was on
(i.e. the line just ended) not the line we are now on.
This was correct in one place in Parser.java but not
in the other place.
This commit is contained in:
Havoc Pennington 2011-11-27 23:57:40 -05:00
parent 907048fe2b
commit 2a7c403aa6

View File

@ -110,7 +110,8 @@ final class Parser {
Token t = nextToken();
while (true) {
if (Tokens.isNewline(t)) {
lineNumber = Tokens.getLineNumber(t);
// newline number is the line just ended, so add one
lineNumber = Tokens.getLineNumber(t) + 1;
sawSeparatorOrNewline = true;
// we want to continue to also eat
// a comma if there is one.