enum class NodeRole
Description
A relation between a parent and child node, e.g. 'left-hand-side of a binary expression'. Used for implementing accessors. In general `NodeRole`s should be named the same as their accessors. Some roles describe parent/child relations that occur multiple times in language grammar. We define only one role to describe all instances of such recurring relations. For example, grammar for both "if" and "while" statements requires an opening paren and a closing paren. The opening paren token is assigned the OpenParen role regardless of whether it appears as a child of IfStatement or WhileStatement node. More generally, when grammar requires a certain fixed token (like a specific keyword, or an opening paren), we define a role for this token and use it across all grammar rules with the same requirement. Names of such reusable roles end with a ~Token or a ~Keyword suffix.
Declared at: clang/include/clang/Tooling/Syntax/Nodes.h:54
Enumerators
Name | Value | Comment |
---|---|---|
Detached | 0 | A node without a parent |
Unknown | 1 | Children of an unknown semantic nature, e.g. skipped tokens, comments. |
OpenParen | 2 | An opening parenthesis in argument lists and blocks, e.g. '{', '(', etc. |
CloseParen | 3 | A closing parenthesis in argument lists and blocks, e.g. '}', ')', etc. |
IntroducerKeyword | 4 | A keywords that introduces some grammar construct, e.g. 'if', 'try', etc. |
LiteralToken | 5 | A token that represents a literal, e.g. 'nullptr', '1', 'true', etc. |
ArrowToken | 6 | Tokens or Keywords. |
ExternKeyword | 7 | Tokens or Keywords. |
TemplateKeyword | 8 | Tokens or Keywords. |
BodyStatement | 9 | An inner statement for those that have only a single child of kind statement, e.g. loop body for while, for, etc; inner statement for case, default, etc. |
ListElement | 10 | List API roles. |
ListDelimiter | 11 | List API roles. |
OperatorToken | 12 | List API roles. |
Operand | 13 | List API roles. |
LeftHandSide | 14 | List API roles. |
RightHandSide | 15 | List API roles. |
ReturnValue | 16 | List API roles. |
CaseValue | 17 | List API roles. |
ThenStatement | 18 | List API roles. |
ElseKeyword | 19 | List API roles. |
ElseStatement | 20 | List API roles. |
Expression | 21 | List API roles. |
Statement | 22 | List API roles. |
Condition | 23 | List API roles. |
Message | 24 | List API roles. |
Declarator | 25 | List API roles. |
Declaration | 26 | List API roles. |
Size | 27 | List API roles. |
Parameters | 28 | List API roles. |
TrailingReturn | 29 | List API roles. |
UnqualifiedId | 30 | List API roles. |
Qualifier | 31 | List API roles. |
SubExpression | 32 | List API roles. |
Object | 33 | List API roles. |
AccessToken | 34 | List API roles. |
Member | 35 | List API roles. |
Callee | 36 | List API roles. |
Arguments | 37 | List API roles. |
Declarators | 38 | List API roles. |