diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-type-text-util.cpp | 16 | ||||
| -rw-r--r-- | source/core/slang-type-text-util.h | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp index 2261ed614..4797395b7 100644 --- a/source/core/slang-type-text-util.cpp +++ b/source/core/slang-type-text-util.cpp @@ -99,6 +99,12 @@ static const NamesDescriptionValue s_languageInfos[] = { {SLANG_SOURCE_LANGUAGE_CUDA, "cu,cuda", "CUDA"}, }; +static const NamesDescriptionValue s_stdRevisionInfos[] = { + {SLANG_STD_REVISION_UNKNOWN, "unknown", "Unknown"}, + {SLANG_STD_REVISION_2025, "2025,default", "Slang language rules for 2025 and older"}, + {SLANG_STD_REVISION_2026, "2026", "Slang language rules for 2026 and newer"}, +}; + static const NamesDescriptionValue s_compilerInfos[] = { {SLANG_PASS_THROUGH_NONE, "none", "Unknown"}, {SLANG_PASS_THROUGH_FXC, "fxc", "FXC HLSL compiler"}, @@ -217,6 +223,11 @@ static const NamesDescriptionValue s_fileSystemTypes[] = { return makeConstArrayView(s_languageInfos); } +/* static */ ConstArrayView<NamesDescriptionValue> TypeTextUtil::getStdRevisionInfos() +{ + return makeConstArrayView(s_stdRevisionInfos); +} + /* static */ ConstArrayView<NamesDescriptionValue> TypeTextUtil::getCompilerInfos() { return makeConstArrayView(s_compilerInfos); @@ -317,6 +328,11 @@ static const NamesDescriptionValue s_fileSystemTypes[] = { return NameValueUtil::findValue(getLanguageInfos(), text, SLANG_SOURCE_LANGUAGE_UNKNOWN); } +/* static */ SlangStdRevision TypeTextUtil::findStdRevision(const UnownedStringSlice& text) +{ + return NameValueUtil::findValue(getStdRevisionInfos(), text, SLANG_STD_REVISION_UNKNOWN); +} + /* static */ SlangPassThrough TypeTextUtil::findPassThrough(const UnownedStringSlice& slice) { return NameValueUtil::findValue(getCompilerInfos(), slice, SLANG_PASS_THROUGH_NONE); diff --git a/source/core/slang-type-text-util.h b/source/core/slang-type-text-util.h index 730888254..bc136c3ab 100644 --- a/source/core/slang-type-text-util.h +++ b/source/core/slang-type-text-util.h @@ -33,6 +33,8 @@ struct TypeTextUtil /// Get the language infos static ConstArrayView<NamesDescriptionValue> getLanguageInfos(); + /// Get the std revision infos + static ConstArrayView<NamesDescriptionValue> getStdRevisionInfos(); /// Get the compiler infos static ConstArrayView<NamesDescriptionValue> getCompilerInfos(); /// Get the archive type infos @@ -71,6 +73,9 @@ struct TypeTextUtil /// Given a source language name returns a source language. Name here is distinct from extension static SlangSourceLanguage findSourceLanguage(const UnownedStringSlice& text); + /// Given a std revision returns a std revision. + static SlangStdRevision findStdRevision(const UnownedStringSlice& text); + /// Given a name returns the pass through static SlangPassThrough findPassThrough(const UnownedStringSlice& slice); static SlangResult findPassThrough( |
