diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-06-02 12:58:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-02 09:58:08 -0700 |
| commit | b699a36444a03a6f7b312e805de31395a2d2ff9c (patch) | |
| tree | edcb033b9b81c487f9000ca1f8dd818a063aaa39 /source/compiler-core/slang-json-lexer.cpp | |
| parent | 7a3c87b58de2683c077bd5341052c2e3cebeb048 (diff) | |
JSONBuilder (#1865)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP JSONWriter/JSONParser.
* Checking different Layout styles for JSON.
* Add slang-json-parser.h/.cpp
* WIP JSONValue.
* Added JSONValue::destroy/Recursive.
* Improvement to JSONValue.
* Improve text double conversion precision. Testing.
* Simplify double parsing (just use atof).
JSON comparison
More testing of conversions and start of JSONValue.
* Add <math.h> for isnan, isinf etc.
* Small improvement with object comparison.
* Fix typo in getArgsByName.
* Removed use of isnan and isinf as includes don't work on linux.
* Improve JSON unit test.
* Added asInteger/asFloat/asBool to JSONValue.
* Add SourceLoc to JSONListener.
* Added ability to walk the JSONValue
* JSONBuilder.
* Add converting from lexemes via JSONBuilder.
* Fix VS warning.
* Fix warning for res not being used.
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); |
