diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-07-18 23:54:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-18 23:54:05 +0800 |
| commit | 3750a4dcb284d4695f5188c497c5a9dcff98388e (patch) | |
| tree | 91d1127ea6170caaf5587d34ad2163752e756ab8 /source/compiler-core/slang-lexer.cpp | |
| parent | 6f1371a7870a7c371a77cfdee1daa5c32f0c5377 (diff) | |
Add unexpected end of input error to lexer (#4673)
* Add unexpected end of input error to lexer
* Add end of input test
* Simplify testcase
Diffstat (limited to 'source/compiler-core/slang-lexer.cpp')
| -rw-r--r-- | source/compiler-core/slang-lexer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/compiler-core/slang-lexer.cpp b/source/compiler-core/slang-lexer.cpp index 8c428159c..10c5aa1ae 100644 --- a/source/compiler-core/slang-lexer.cpp +++ b/source/compiler-core/slang-lexer.cpp @@ -1374,6 +1374,10 @@ namespace Slang char buffer[] = { (char) c, 0 }; sink->diagnose(loc, LexerDiagnostics::illegalCharacterPrint, buffer); } + else if(c == kEOF) + { + sink->diagnose(loc, LexerDiagnostics::unexpectedEndOfInput); + } else { // Fallback: print as hexadecimal |
