diff options
Diffstat (limited to 'source/compiler-core/slang-json-lexer.cpp')
| -rw-r--r-- | source/compiler-core/slang-json-lexer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-lexer.cpp b/source/compiler-core/slang-json-lexer.cpp index 261d5f413..9f96ef4f5 100644 --- a/source/compiler-core/slang-json-lexer.cpp +++ b/source/compiler-core/slang-json-lexer.cpp @@ -80,6 +80,17 @@ bool JSONLexer::advanceIf(JSONTokenType type) return false; } +bool JSONLexer::advanceIf(JSONTokenType type, JSONToken& out) +{ + if (type == peekType()) + { + out = m_token; + advance(); + return true; + } + return false; +} + UnownedStringSlice JSONLexer::getLexeme(const JSONToken& tok) const { auto offset = m_sourceView->getRange().getOffset(tok.loc); |
