summaryrefslogtreecommitdiffstats
path: root/tools/slang-cpp-extractor/identifier-lookup.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-03-24 11:12:19 -0400
committerGitHub <noreply@github.com>2022-03-24 11:12:19 -0400
commite1a331a2e2945f2b90c00d0af4d1ba5f67dbd256 (patch)
treeba59b7055464a387ae52e67088a56ee1d5b5fc7d /tools/slang-cpp-extractor/identifier-lookup.cpp
parent91292b8ca80ede633d1c4effaf8b3f5cf2ac3f2b (diff)
C++ extractor parsing slang.h (#2162)
* #include an absolute path didn't work - because paths were taken to always be relative. * Split doc extractor such that can be used in C++ extractor. * Compiles. Update the stdlib docs. * Fix issue on release builds. * Add support for extracting documentation to C++ extractor. * Dump out markup. Make enum value backing type take tokens. * Node::Type -> Node::Kind * More improvements around Node::Type -> Node::Kind * Support for parsing callable types. * Fix issue params for callable, and default value for variable. * Add support for static. * Improve handling parsing of contained types. * Small improvements around template consumption. * Improve dumping with markup/static. * Small improvements around reflection. * Add more flexible handling of markers. Allow reflection without markers. * Handling external "C" unsigned/signed
Diffstat (limited to 'tools/slang-cpp-extractor/identifier-lookup.cpp')
-rw-r--r--tools/slang-cpp-extractor/identifier-lookup.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/tools/slang-cpp-extractor/identifier-lookup.cpp b/tools/slang-cpp-extractor/identifier-lookup.cpp
index db8ea2846..c429a29a4 100644
--- a/tools/slang-cpp-extractor/identifier-lookup.cpp
+++ b/tools/slang-cpp-extractor/identifier-lookup.cpp
@@ -27,6 +27,15 @@ using namespace Slang;
0, /// Calling convention
IdentifierFlag::Keyword, /// template
IdentifierFlag::Keyword, /// static
+
+ IdentifierFlag::Keyword, /// unsigned/signed
+
+ IdentifierFlag::Keyword, /// extern
+
+ 0, /// Callable misc
+ 0, /// IntegerType int, short, char, long
+
+ IdentifierFlag::Keyword, /// default
};
void IdentifierLookup::set(const UnownedStringSlice& name, IdentifierStyle style)
@@ -68,7 +77,7 @@ void IdentifierLookup::initDefault(const UnownedStringSlice& markPrefix)
// Some keywords
{
- const char* names[] = { "continue", "if", "case", "break", "catch", "default", "delete", "do", "else", "for", "new", "goto", "return", "switch", "throw", "using", "while", "operator", "explicit"};
+ const char* names[] = { "continue", "if", "case", "break", "catch", "delete", "do", "else", "for", "new", "goto", "return", "switch", "throw", "using", "while", "operator", "explicit"};
set(names, SLANG_COUNT_OF(names), IdentifierStyle::Keyword);
}
@@ -95,9 +104,26 @@ void IdentifierLookup::initDefault(const UnownedStringSlice& markPrefix)
{
set("virtual", IdentifierStyle::Virtual);
- set("SLANG_MCALL", IdentifierStyle::CallingConvention);
+
set("template", IdentifierStyle::Template);
set("static", IdentifierStyle::Static);
+ set("extern", IdentifierStyle::Extern);
+ set("default", IdentifierStyle::Default);
+ }
+
+ {
+ const char* names[] = { "char", "short", "int", "long"};
+ set(names, SLANG_COUNT_OF(names), IdentifierStyle::IntegerType);
+ }
+
+ {
+ const char* names[] = { "SLANG_MCALL" };
+ set(names, SLANG_COUNT_OF(names), IdentifierStyle::CallingConvention);
+ }
+
+ {
+ const char* names[] = { "SLANG_NO_THROW", "inline"};
+ set(names, SLANG_COUNT_OF(names), IdentifierStyle::CallableMisc);
}
// Keywords which introduce types/scopes
@@ -119,6 +145,11 @@ void IdentifierLookup::initDefault(const UnownedStringSlice& markPrefix)
const char* names[] = { "private", "protected", "public" };
set(names, SLANG_COUNT_OF(names), IdentifierStyle::Access);
}
+ {
+ const char* names[] = { "signed", "unsigned"};
+
+ set(names, SLANG_COUNT_OF(names), IdentifierStyle::IntegerModifier);
+ }
}
} // namespace CppExtract