diff options
Diffstat (limited to 'source/core/slang-token-reader.h')
| -rw-r--r-- | source/core/slang-token-reader.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/core/slang-token-reader.h b/source/core/slang-token-reader.h index f8a455452..474db5c4a 100644 --- a/source/core/slang-token-reader.h +++ b/source/core/slang-token-reader.h @@ -189,6 +189,15 @@ namespace Slang { tokenPtr -= count; } + Token ReadMatchingToken(TokenType type) + { + auto token = ReadToken(); + if (token.Type != type) + { + throw TextFormatException("Text parsing error: unexpected token."); + } + return token; + } Token ReadToken() { if (tokenPtr < (int)tokens.getCount()) |
