summaryrefslogtreecommitdiffstats
path: root/tools/slang-cpp-extractor/parser.h
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/parser.h
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/parser.h')
-rw-r--r--tools/slang-cpp-extractor/parser.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/slang-cpp-extractor/parser.h b/tools/slang-cpp-extractor/parser.h
index 4815821c5..cf0147e8b 100644
--- a/tools/slang-cpp-extractor/parser.h
+++ b/tools/slang-cpp-extractor/parser.h
@@ -34,10 +34,6 @@ public:
void setKindEnabled(Node::Kind kind, bool isEnabled = true);
bool isTypeEnabled(Node::Kind kind) { return (m_nodeTypeEnabled & (NodeTypeBitType(1) << int(kind))) != 0; }
- /// If set classes require a 'marker' to be reflected
- void setRequireMarker(bool requireMarker) { m_requireMarker = requireMarker; }
- bool getRequireMarker() const { return m_requireMarker; }
-
void setKindsEnabled(const Node::Kind* kinds, Index kindsCount, bool isEnabled = true);
Parser(NodeTree* nodeTree, DiagnosticSink* sink);
@@ -58,26 +54,33 @@ protected:
SlangResult _parseTypeDef();
SlangResult _parseEnum();
SlangResult _parseMarker();
+ SlangResult _parseSpecialMacro();
- SlangResult _maybeParseType(List<Token>& outToks);
- SlangResult _maybeParseType(UnownedStringSlice& outType);
+ SlangResult _maybeParseType(List<Token>& outToks, Token& outName);
+ SlangResult _maybeParseType(UnownedStringSlice& outType, Token& outName);
+ SlangResult _maybeParseType(Index& ioTemplateDepth, TokenReader::ParsingCursor& outCursor);
SlangResult _parseExpression(List<Token>& outExprTokens);
-
- SlangResult _maybeParseType(Index& ioTemplateDepth);
+
SlangResult _maybeParseTemplateArgs(Index& ioTemplateDepth);
SlangResult _maybeParseTemplateArg(Index& ioTemplateDepth);
/// Parse balanced - if a sink is set will report to that sink
SlangResult _parseBalanced(DiagnosticSink* sink);
+ bool _isCtor();
+
/// Concatenate all tokens from start to the current position
UnownedStringSlice _concatTokens(TokenReader::ParsingCursor start);
+ UnownedStringSlice _concatTokens(const Token* toks, Index toksCount);
+
+ UnownedStringSlice _concatType(TokenReader::ParsingCursor start, TokenReader::ParsingCursor nameCursor);
+
+ void _getTypeTokens(TokenReader::ParsingCursor start, TokenReader::ParsingCursor nameCursor, List<Token>& outToks);
/// Consume what looks like a template definition
SlangResult _consumeTemplate();
-
- void _consumeTypeModifiers();
+ SlangResult _maybeConsume(IdentifierStyle style);
SlangResult _consumeToSync();
/// Consumes balanced parens. Will return an error if not matched. Assumes starts on opening (
@@ -88,6 +91,8 @@ protected:
TokenList m_tokenList;
TokenReader m_reader;
+ List<ScopeNode*> m_scopeStack;
+
ScopeNode* m_currentScope; ///< The current scope being processed
SourceOrigin* m_sourceOrigin; ///< The source origin that all tokens are in
@@ -95,8 +100,6 @@ protected:
NodeTree* m_nodeTree; ///< Shared state between parses. Nodes will be added to this
- bool m_requireMarker = true;
-
const Options* m_options;
};