From e1a331a2e2945f2b90c00d0af4d1ba5f67dbd256 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 24 Mar 2022 11:12:19 -0400 Subject: 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 --- tools/slang-cpp-extractor/identifier-lookup.cpp | 35 +++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'tools/slang-cpp-extractor/identifier-lookup.cpp') 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 -- cgit v1.2.3