fix: add lexError function and fix line counting for unterminated block comments

Add a dedicated lexError function that marks compilation as failed and formats
error messages consistently with a trailing newline. Move line counting from
readRawToken into nextChar so that newlines are tracked during all lexer phases,
including block comment scanning. Replace the TODO placeholder in
skipBlockComment with a proper lexError call for unterminated block comments,
and add test cases for unterminated block and nested block comments.
This commit is contained in:
Bob Nystrom
2013-12-23 22:51:06 +00:00
parent 0067070804
commit 4fc948f2ca
5 changed files with 36 additions and 6 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ else:
EXPECT_PATTERN = re.compile(r'// expect: (.*)')
EXPECT_ERROR_PATTERN = re.compile(r'// expect error')
EXPECT_ERROR_LINE_PATTERN = re.compile(r'// expect error line (\d+)')
ERROR_PATTERN = re.compile(r'\[Line (\d+)\] Error ')
ERROR_PATTERN = re.compile(r'\[Line (\d+)\] Error')
SKIP_PATTERN = re.compile(r'// skip: (.*)')
NONTEST_PATTERN = re.compile(r'// nontest')