Expand description
Bindings for the Solidity and Yul ASTs.
The Yul AST bindings are available in the yul module.
To gain an overview of the AST, it might be helpful to start at the entry point of a complete Solidity AST: the SourceUnit node.
§Version Support
These types should be compatible with at least Solidity 0.5.x and above, but may also support 0.4.x-0.5.x in most cases.
The legacy Solidity AST is not supported.
Modules§
Structs§
- Array
Type Name - An array type name.
- Assignment
- An assignment expression.
- Ast
- Represents the AST field in the solc output
- Binary
Operation - A binary operation.
- Block
- A block of statements.
- Break
- The break keyword.
- Conditional
- A conditional expression.
- Continue
- The continue keyword.
- Contract
Definition - A contract definition.
- DoWhile
Statement - A do while statement.
- Elementary
Type Name - Elementary
Type Name Expression - Emit
Statement - An emit statement.
- Enum
Definition - An enum definition.
- Enum
Value - An enum value.
- Error
Definition - A custom error definition.
- Event
Definition - An event definition.
- Expression
Statement - An expression statement.
- External
Inline Assembly Reference - A reference to an external variable or slot in an inline assembly block.
- ForStatement
- A for statement.
- Function
Call - A function call expression.
- Function
Call Options - A function call options expression (e.g.
x.f{gas: 1}
). - Function
Definition - A function definition.
- Function
Identifier Path - A wrapper around IdentifierPath for the UsingForDirective.
- Function
Type Name - A function type name.
- Identifier
- An identifier.
- Identifier
Path - An identifier path.
- IfStatement
- An if statement.
- Import
Directive - An import directive.
- Index
Access - An index access.
- Index
Range Access - An index range access.
- Inheritance
Specifier - An inheritance specifier.
- Inline
Assembly - A block of inline assembly.
- Literal
- A literal value.
- LowFidelity
Source Location - Represents the source location of a node:
<start byte>:<length>:<source index>
. - Mapping
- A mapping type.
- Member
Access - Member access.
- Modifier
Definition - A modifier definition.
- Modifier
Invocation - A modifier or base constructor invocation.
- NewExpression
- A
new
expression. - Node
- Override
Specifier - An override specifier.
- Parameter
List - A parameter list.
- Placeholder
Statement - A placeholder statement (
_
) - Pragma
Directive - A pragma directive.
- Return
- A return statement.
- Revert
Statement - A revert statement.
- Source
Location - Represents the source location of a node:
<start byte>:<length>:<source index>
. - Source
Unit - The root node of a Solidity AST.
- Struct
Definition - A struct definition.
- Symbol
Alias - A symbol alias.
- TryCatch
Clause - A try/catch clause.
- TryStatement
- A try/catch statement.
- Tuple
Expression - A tuple expression.
- Type
Descriptions - A type description.
- Unary
Operation - A unary operation.
- Unchecked
Block - An unchecked block.
- User
Defined Type Name - A user defined type name.
- User
Defined Value Type Definition - A user defined value type definition.
- Using
ForDirective - A using for directive.
- Variable
Declaration - A variable declaration.
- Variable
Declaration Statement - A variable declaration statement.
- While
Statement - A while statement.
Enums§
- Assembly
Reference Suffix - An assembly reference suffix.
- Assignment
Operator - Assignment operators.
- Binary
Operator - Binary operators.
- Block
OrStatement - Contract
Definition Part - Contract
Kind - All Solidity contract kinds.
- Elementary
OrRaw Type Name - Expression
- Expression
OrVariable Declaration Statement - Function
Call Kind - Function call kinds.
- Function
Kind - Function kinds.
- Identifier
OrIdentifier Path - Inline
Assembly Flag - Inline assembly flags.
- Literal
Kind - Literal kinds.
- Modifier
Invocation Kind - Modifier invocation kinds.
- Mutability
- Variable mutability specifier.
- Node
Type - Source
Unit Part - State
Mutability - Function mutability specifier.
- Statement
- Storage
Location - Storage location specifier.
- Structured
Documentation - Structured documentation (NatSpec).
- Type
Name - Unary
Operator - Unary operators.
- User
Defined Type Name OrIdentifier Path - Visibility
- Visibility specifier.