diff options
Diffstat (limited to 'source/slang/lexer.cpp')
| -rw-r--r-- | source/slang/lexer.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/source/slang/lexer.cpp b/source/slang/lexer.cpp index 9ea86cc82..339d98d49 100644 --- a/source/slang/lexer.cpp +++ b/source/slang/lexer.cpp @@ -84,22 +84,22 @@ namespace Slang // Lexer void Lexer::initialize( - SourceFile* inSourceFile, + SourceUnit* inSourceUnit, DiagnosticSink* inSink, NamePool* inNamePool) { - sourceFile = inSourceFile; + sourceUnit = inSourceUnit; sink = inSink; namePool = inNamePool; - auto content = inSourceFile->content; + auto content = inSourceUnit->getSourceFile()->content; begin = content.begin(); cursor = content.begin(); end = content.end(); - spellingStartLoc = inSourceFile->sourceRange.begin; - presumedStartLoc = spellingStartLoc; + // Set the start location + startLoc = inSourceUnit->getRange().begin; tokenFlags = TokenFlag::AtStartOfLine | TokenFlag::AfterWhitespace; lexerFlags = 0; @@ -227,7 +227,7 @@ namespace Slang lexer->tokenFlags |= TokenFlag::ScrubbingNeeded; // Now try again, looking at the character after the - // escaped nmewline. + // escaped newline. continue; default: @@ -333,23 +333,7 @@ namespace Slang static SourceLoc getSourceLoc(Lexer* lexer) { - return lexer->presumedStartLoc + (lexer->cursor - lexer->begin); - } - - // Begin overriding the reported locations of tokens, - // based on a `#line` directives - void Lexer::startOverridingSourceLocations( - SourceLoc loc) - { - if(loc.isValid()) - { - presumedStartLoc = loc; - } - } - - void Lexer::stopOverridingSourceLocations() - { - presumedStartLoc = spellingStartLoc; + return lexer->startLoc + (lexer->cursor - lexer->begin); } static void lexDigits(Lexer* lexer, int base) |
