summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-lexer.cpp12
-rw-r--r--source/compiler-core/slang-lexer.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/source/compiler-core/slang-lexer.cpp b/source/compiler-core/slang-lexer.cpp
index 84a4df93b..048c266ca 100644
--- a/source/compiler-core/slang-lexer.cpp
+++ b/source/compiler-core/slang-lexer.cpp
@@ -1810,6 +1810,18 @@ TokenList Lexer::lexAllMarkupTokens()
}
}
+TokenList Lexer::lexAllTokens()
+{
+ TokenList tokenList;
+ for (;;)
+ {
+ Token token = lexToken();
+ tokenList.add(token);
+ if (token.type == TokenType::EndOfFile)
+ return tokenList;
+ }
+}
+
/* static */ UnownedStringSlice Lexer::sourceLocationLexer(const UnownedStringSlice& in)
{
Lexer lexer;
diff --git a/source/compiler-core/slang-lexer.h b/source/compiler-core/slang-lexer.h
index a36719ab7..0152ff6f5 100644
--- a/source/compiler-core/slang-lexer.h
+++ b/source/compiler-core/slang-lexer.h
@@ -139,6 +139,9 @@ struct Lexer
/// Lex all tokens (up to the end of the stream) that are relevant to things like markup
TokenList lexAllMarkupTokens();
+ /// Lex all tokens (up to the end of the stream) whether relevant or not.
+ TokenList lexAllTokens();
+
/// Get the diagnostic sink, taking into account flags. Will return null if suppressing
/// diagnostics.
DiagnosticSink* getDiagnosticSink()