Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,10 @@ class Parser(val source: CharSequence,
parserState.reportError(line.startPos, ErrorCode.FOREIGN_SYNTAX, "Pascal")
return null
} else {
parserState.reportError(tokens, ErrorCode.TOKEN_REQUIRED, "in")
if (tokens.hasNext)
parserState.reportError(tokens, ErrorCode.TOKEN_REQUIRED, "in")
else
parserState.reportError(tokens.endPos, ErrorCode.MISSING_TOKEN, "in")
if (expressionParser.firstOfTest(tokens))
expressionParser.parseTestListAsTuple(tokens)
else
Expand Down
3 changes: 3 additions & 0 deletions tpParser/shared/src/test/programs/erroneous/for_loop_04.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1
# MISSING_TOKEN
for x
2 changes: 2 additions & 0 deletions tpParser/shared/src/test/scala/TestErroneousPrograms.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,7 @@ class TestErroneousPrograms extends FunSuite {
}
assert(cs.get.line+1 == line_no)
assert(cs.get.errorCode.toString == error_msg)
// The error message must have all of its '%s' placeholders substituted with actual values
assert(!cs.get.errorMessage.contains("%s"), s"un-substituted placeholder in message: ${cs.get.errorMessage}")
}
}
Loading