diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-05-25 20:58:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-25 20:58:43 -0400 |
| commit | 7d1b8ac13faf80ed56b37243480d097059da5aab (patch) | |
| tree | 6613b13983083d16b8945c6d92b1f4f1d1fb2501 /source/compiler-core/slang-json-diagnostics.cpp | |
| parent | 89f67d9c626fa193dba4adafcb54e46b13aa5e98 (diff) | |
JSON Lexing and string encoding/decoding (#1858)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP Json lexer.
* Check JSON Lex with unit test
* Add JSON escaping/unescaping of strings.
* Big fix encoding/decoding.
* Fix typo in JSON diagnostics.
* Fix typo.
* Better float testing.
Diffstat (limited to 'source/compiler-core/slang-json-diagnostics.cpp')
| -rw-r--r-- | source/compiler-core/slang-json-diagnostics.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-diagnostics.cpp b/source/compiler-core/slang-json-diagnostics.cpp new file mode 100644 index 000000000..1d35e8faf --- /dev/null +++ b/source/compiler-core/slang-json-diagnostics.cpp @@ -0,0 +1,33 @@ +// slang-json-diagnostics.cpp +#include "slang-json-diagnostics.h" + +namespace Slang { + +namespace JSONDiagnostics +{ +#define DIAGNOSTIC(id, severity, name, messageFormat) const DiagnosticInfo name = { id, Severity::severity, #name, messageFormat }; +#include "slang-json-diagnostic-defs.h" +#undef DIAGNOSTIC +} + +static const DiagnosticInfo* const kJSONDiagnostics[] = +{ +#define DIAGNOSTIC(id, severity, name, messageFormat) &JSONDiagnostics::name, +#include "slang-json-diagnostic-defs.h" +#undef DIAGNOSTIC +}; + +static DiagnosticsLookup* _newJSONDiagnosticsLookup() +{ + auto lookup = new DiagnosticsLookup; + lookup->add(kJSONDiagnostics, SLANG_COUNT_OF(kJSONDiagnostics)); + return lookup; +} + +DiagnosticsLookup* getJSONDiagnosticsLookup() +{ + static RefPtr<DiagnosticsLookup> s_lookup = _newJSONDiagnosticsLookup(); + return s_lookup; +} + +} // namespace Slang |
