diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-04-12 17:08:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-12 17:08:52 -0700 |
| commit | 021a4923f429278b1d7434e01cbf83edcdf43da4 (patch) | |
| tree | 7c3c5534de8a98c28554d36c41e3e3c1e1b48aee /source/slang/lexer.h | |
| parent | baf194e7456ba4568dcf11249896af35b3ce18cc (diff) | |
Preprocessor cleanups (#484)
* For a `#error` or `#warning`, read the rest of the line as raw text to include in the error message
* When skipping tokens (e.g., in an `#ifdef`d out block), don't emit errors on invalid characters
* TODO: we could clearly get more efficient and skip whole raw lines in the future
* Fix an issue when a macro invocation that expands to nothing (zero tokens) is the last thing before a directive. The preprocessor was returning the `#` as an ordinary token, because it has already gone past its test for directives.
Diffstat (limited to 'source/slang/lexer.h')
| -rw-r--r-- | source/slang/lexer.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/slang/lexer.h b/source/slang/lexer.h index 23eddf04e..1f2954d27 100644 --- a/source/slang/lexer.h +++ b/source/slang/lexer.h @@ -64,8 +64,10 @@ namespace Slang typedef unsigned int LexerFlags; enum { - kLexerFlag_InDirective = 1 << 0, - kLexerFlag_ExpectFileName = 1 << 1, + kLexerFlag_InDirective = 1 << 0, ///< Turn end-of-line and end-of-file into end-of-directive + kLexerFlag_ExpectFileName = 1 << 1, ///< Support `<>` style strings for file paths + kLexerFlag_IgnoreInvalid = 1 << 2, ///< Suppress errors about invalid/unsupported characters + kLexerFlag_ExpectDirectiveMessage = 1 << 3, ///< Don't lexer ordinary tokens, and instead consume rest of line as a string }; struct Lexer @@ -77,7 +79,7 @@ namespace Slang ~Lexer(); - Token lexToken(); + Token lexToken(LexerFlags extraFlags = 0); TokenList lexAllTokens(); @@ -121,4 +123,4 @@ namespace Slang FloatingPointLiteralValue getFloatingPointLiteralValue(Token const& token, String* outSuffix = 0); } -#endif
\ No newline at end of file +#endif |
