#[non_exhaustive]pub enum SyntaxNode {
Show 66 variants
Annotation {
name: String,
arguments_id: Option<NodeId>,
},
Argument,
ArgumentList,
ArrayInitializer {
variable_type: Option<String>,
},
Assignment {
variable_id: NodeId,
value_id: Option<NodeId>,
operator: Option<String>,
},
Attribute {
name: String,
},
AwaitExpression {
expression_id: NodeId,
},
BinaryOperation {
operator: String,
left_id: Option<NodeId>,
right_id: Option<NodeId>,
},
Break,
CatchClause {
block_id: Option<NodeId>,
catch_declaration: Option<NodeId>,
},
CatchDeclaration,
Class {
name: String,
block_id: Option<NodeId>,
modifiers_id: Option<NodeId>,
inherited_class: Option<String>,
access_modifiers: Option<String>,
},
ClassBody,
Comment {
comment: String,
},
Continue,
Declaration {
name: String,
block_id: Option<NodeId>,
access_modifiers: Option<String>,
},
DeclarationBlock,
Default,
DoStatement {
block_id: NodeId,
condition_id: NodeId,
},
ElementAccess {
expression_id: NodeId,
arguments_id: Option<NodeId>,
},
ElseClause {
block_id: NodeId,
},
ExecutionBlock,
Export {
expression: Option<String>,
declaration_id: Option<NodeId>,
alias: Option<String>,
default_id: Option<NodeId>,
},
ExpressionStatement,
File,
FinallyClause {
block_id: Option<NodeId>,
},
ForEachStatement {
variable_id: NodeId,
iterable_item_id: NodeId,
block_id: Option<NodeId>,
},
ForStatement {
block_id: NodeId,
initializer_id: Option<NodeId>,
condition_id: Option<NodeId>,
update_id: Option<NodeId>,
},
If {
condition_id: NodeId,
true_id: Option<NodeId>,
false_id: Option<NodeId>,
initializer: Option<NodeId>,
},
Import {
expression: Option<String>,
alias: Option<String>,
method_name: Option<String>,
import_type: Option<String>,
module_name: Option<String>,
},
JsxElement,
LambdaFunctionType,
Literal {
value: String,
value_type: String,
},
MemberAccess {
member: String,
expression: String,
expression_id: NodeId,
symbol_scope: Option<NodeId>,
},
Metadata {
path: String,
structure: BTreeMap<String, FileStructData>,
instances: BTreeMap<String, BTreeMap<String, FileInstanceData>>,
imports: Vec<String>,
package: Option<String>,
},
MethodDeclaration {
name: Option<String>,
access_modifiers: Option<String>,
block_id: Option<NodeId>,
modifiers_id: Option<NodeId>,
parameters_id: Option<NodeId>,
},
MethodInvocation {
expression: String,
object: Option<String>,
symbol_scope: Option<NodeId>,
expression_id: Option<NodeId>,
arguments_id: Option<NodeId>,
object_id: Option<NodeId>,
block_id: Option<NodeId>,
receiver_type_fqn: Option<String>,
},
MissingNode {
node_type: String,
},
Modifiers,
ModuleImport {
expression: String,
alias: Option<String>,
module_name: Option<String>,
},
NamedArgument {
value_id: NodeId,
argument_name: Option<String>,
},
Namespace {
name: String,
block_id: Option<NodeId>,
},
NewExpression {
constructor_id: NodeId,
arguments_id: Option<NodeId>,
},
Object {
name: Option<String>,
tf_reference: Option<String>,
},
ObjectCreation {
name: String,
arguments_id: Option<NodeId>,
initializer_id: Option<NodeId>,
},
Pair {
key_id: NodeId,
value_id: NodeId,
},
Parameter {
variable: Option<String>,
variable_type: Option<String>,
value_id: Option<NodeId>,
parameter_mode: Option<String>,
},
ParameterList,
ParenthesizedExpression,
ReservedWord {
value: String,
},
RestPattern {
value_id: NodeId,
},
Return {
value_id: Option<NodeId>,
},
Selector {
selector_name: Option<String>,
},
SpreadElement {
value_id: NodeId,
},
SwitchBody,
SwitchSection {
case_expression: String,
},
SwitchStatement {
block_id: NodeId,
value_id: NodeId,
},
SymbolLookup {
symbol: String,
symbol_scope: Option<NodeId>,
value: Option<String>,
},
TernaryOperation {
condition_id: NodeId,
true_id: NodeId,
false_id: NodeId,
},
This {
value: String,
},
ThrowStatement {
expression_id: Option<NodeId>,
},
TryStatement {
block_id: NodeId,
resources_id: Option<NodeId>,
},
UnaryExpression {
operator: String,
operand_id: NodeId,
},
UsingStatement {
block_id: NodeId,
declaration_id: Option<NodeId>,
},
VariableDeclaration {
variable: String,
variable_type: Option<String>,
value_id: Option<NodeId>,
variable_id: Option<NodeId>,
access_modifier: Option<String>,
},
WhileStatement {
block_id: NodeId,
condition_id: Option<NodeId>,
},
}Expand description
A tree-sitter-independent syntax node: one variant per label the readers emit.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Annotation
A decorator/annotation applied to a declaration.
Fields
Argument
A single call argument.
ArgumentList
A call’s argument list.
ArrayInitializer
An array literal initializer.
Assignment
An assignment expression.
Fields
Attribute
An attribute applied to a declaration (non-annotation form).
AwaitExpression
An await expression.
BinaryOperation
A binary operator expression.
Fields
Break
A break statement.
CatchClause
A catch clause of a try statement.
Fields
CatchDeclaration
The exception variable declared by a catch clause.
Class
A class declaration.
Fields
ClassBody
A class’s member list.
Comment
A source comment.
Continue
A continue statement.
Declaration
A generic (language-agnostic) declaration.
Fields
DeclarationBlock
A block holding one or more declarations.
Default
A default label or value.
DoStatement
A do/while loop.
Fields
ElementAccess
An indexed element access (e.g. a[i]).
Fields
ElseClause
The else branch of a conditional.
ExecutionBlock
A block of executable statements.
Export
An export statement.
Fields
ExpressionStatement
A statement that is a bare expression.
File
The file’s root node.
FinallyClause
The finally clause of a try statement.
ForEachStatement
A for-each/for-in loop.
Fields
ForStatement
A classic C-style for loop.
Fields
If
An if conditional.
Fields
Import
An import statement.
Fields
JsxElement
A JSX element.
LambdaFunctionType
A lambda/closure’s declared type.
Literal
A literal value.
MemberAccess
A member access expression (e.g. a.b).
Fields
Metadata
A file’s top-level metadata: structure, instances and imports.
Fields
structure: BTreeMap<String, FileStructData>The file’s top-level members, keyed by name.
MethodDeclaration
A method or function declaration.
Fields
MethodInvocation
A method or function call.
Fields
MissingNode
A node the grammar could not classify.
Modifiers
A declaration’s modifier list (e.g. public static).
ModuleImport
A whole-module import.
Fields
NamedArgument
A call argument passed by name.
Fields
Namespace
A namespace/module declaration.
Fields
NewExpression
An object-construction expression (new X(...)).
Fields
Object
An object literal or reference (e.g. a Terraform resource block).
Fields
ObjectCreation
An object instantiation with an initializer.
Fields
Pair
A key/value pair (e.g. in a map or object literal).
Parameter
A function/method parameter.
Fields
ParameterList
A function/method’s parameter list.
ParenthesizedExpression
A parenthesized expression.
ReservedWord
A language reserved word used as a value (e.g. self).
RestPattern
A rest/spread binding pattern (e.g. ...rest).
Return
A return statement.
Selector
A Go-style type selector.
SpreadElement
A spread element in a call or literal (e.g. ...xs).
SwitchBody
A switch statement’s body.
SwitchSection
One case/when section of a switch.
SwitchStatement
A switch statement.
SymbolLookup
A bare symbol reference.
Fields
TernaryOperation
A ternary conditional expression (a ? b : c).
Fields
This
A this/self reference.
ThrowStatement
A throw/raise statement.
TryStatement
A try statement.
Fields
UnaryExpression
A unary operator expression.
UsingStatement
A using/with resource-scoped statement.
Fields
VariableDeclaration
A variable declaration.
Fields
WhileStatement
A while loop.
Implementations§
Source§impl SyntaxNode
impl SyntaxNode
Sourcepub const fn arguments_id(&self) -> Option<NodeId>
pub const fn arguments_id(&self) -> Option<NodeId>
Id of this node’s argument list, for variants that take one.
Sourcepub const fn block_id(&self) -> Option<NodeId>
pub const fn block_id(&self) -> Option<NodeId>
Id of this node’s body block, for variants that have one.
Sourcepub fn variable(&self) -> Option<&str>
pub fn variable(&self) -> Option<&str>
The declared variable’s name, for variants that declare one.
Sourcepub const fn symbol(&self) -> Option<&str>
pub const fn symbol(&self) -> Option<&str>
The looked-up symbol’s name, for Self::SymbolLookup.
Sourcepub fn expression(&self) -> Option<&str>
pub fn expression(&self) -> Option<&str>
This node’s expression text, for variants that carry one.
Sourcepub fn alias(&self) -> Option<&str>
pub fn alias(&self) -> Option<&str>
The bound local alias, for import/export variants that have one.
Sourcepub fn value(&self) -> Option<&str>
pub fn value(&self) -> Option<&str>
This node’s literal value, as written, for variants that have one.
Sourcepub const fn object_id(&self) -> Option<NodeId>
pub const fn object_id(&self) -> Option<NodeId>
Id of the call receiver node, for Self::MethodInvocation.
Sourcepub const fn value_id(&self) -> Option<NodeId>
pub const fn value_id(&self) -> Option<NodeId>
Id of this node’s value node, for variants that carry one.
Sourcepub const fn variable_id(&self) -> Option<NodeId>
pub const fn variable_id(&self) -> Option<NodeId>
Id of the declared variable’s node, for variants that declare one.
Sourcepub fn label_type(&self) -> &'static str
pub fn label_type(&self) -> &'static str
This node’s syntax-kind label, e.g. "MethodDeclaration".