Crate solar_ast

Crate solar_ast 

Source
Expand description

§solar-ast

Solidity and Yul AST (Abstract Syntax Tree) type and visitor trait definitions.

Re-exports§

pub use visit::Visit;
pub use visit::VisitMut;
pub use crate::token::CommentKind;
pub use bumpalo;
pub use solar_interface as interface;
pub use either;

Modules§

token
Solidity source code token.
visit
Constant and mutable AST visitor trait definitions.
yul
Yul AST.

Structs§

Arena
AST arena allocator.
AstPath
A boxed PathSlice.
BinOp
A binary operation: a + b, a += b.
Block
A block of statements.
CallArgs
A list of function call arguments.
DocComment
A single doc-comment: /// foo, /** bar */.
DocComments
A list of doc-comments.
Expr
An expression.
FunctionHeader
A function header: function helloWorld() external pure returns(string memory).
Ident
An identifier.
ImportDirective
An import directive: import "foo.sol";.
Item
A top-level item in a Solidity source file.
ItemContract
A contract, abstract contract, interface, or library definition: contract Foo layout at 10 is Bar("foo"), Baz { ... }.
ItemEnum
An enum definition: enum Foo { A, B, C }.
ItemError
An error definition: error Foo(uint256 a, uint256 b);.
ItemEvent
An event definition: event Transfer(address indexed from, address indexed to, uint256 value);.
ItemFunction
A function, constructor, fallback, receive, or modifier definition: function helloWorld() external pure returns(string memory);.
ItemId
A source unit item ID. Only used in SourceUnit.
ItemStruct
A struct definition: struct Foo { uint256 bar; }.
ItemUdvt
A user-defined value type definition: type Foo is uint256;.
Lit
A literal: hex"1234", 5.6 ether.
Modifier
A modifier invocation, or an inheritance specifier.
NamedArg
A named argument: name: value.
Override
An override specifier: override, override(a, b.c).
ParameterList
A list of variable declarations and its span, which includes the brackets.
Path
A qualified identifier: foo.bar.baz.
PathSlice
A qualified identifier: foo.bar.baz.
PragmaDirective
A pragma directive: pragma solidity ^0.8.0;.
SemverReq
A SemVer version requirement. This is a list of components, and is never empty.
SemverReqComponent
A single SemVer version requirement component.
SemverReqCon
A list of conjoint SemVer version requirement components.
SemverVersion
A SemVer version.
SemverVersionReqCompat
A list of or-ed semver::VersionReq.
SourceUnit
A Solidity source file.
Span
A source code location.
Spanned
A value paired with a source code location.
Stmt
A statement, usually ending in a semicolon.
StmtAssembly
An assembly block, with optional flags: assembly "evmasm" (...) { ... }.
StmtTry
A try statement: try fooBar(42) returns (...) { ... } catch (...) { ... }.
StorageLayoutSpecifier
The storage layout specifier of a contract.
StrLit
A single UTF-8 string literal. Only used in import paths and statements, not expressions.
Symbol
An interned string.
TryCatchClause
Clause of a try/catch block: returns/catch (...) { ... }.
Type
A type name.
TypeArray
An array type.
TypeFixedSize
Size of a fixed-point number (N) type. Valid values: 0..=80.
TypeFunction
A function type name.
TypeMapping
A mapping type.
TypeSize
Byte size of a fixed-bytes, integer, or fixed-point number (M) type. Valid values: 0..=32.
UnOp
A unary operation: !x, -x, x++.
UsingDirective
A using directive: using { A, B.add as + } for uint256 global;.
VariableDefinition
A state variable or constant definition: uint256 constant FOO = 42;.

Enums§

Base
Base of numeric literal encoding according to its prefix.
BinOpKind
A kind of binary operation.
CallArgsKind
A list of function call argument expressions.
ContractKind
The kind of contract.
DataLocation
A storage location.
Either
The enum Either with variants Left and Right is a general purpose sum type with two cases.
ElementaryType
Elementary/primitive type.
EtherSubDenomination
An ether SubDenomination.
ExprKind
A kind of expression.
FunctionKind
A kind of function.
IdentOrStrLit
An identifier or a string literal.
ImportItems
The path of an import directive.
IndexKind
A kind of square bracketed indexing expression: vector[index], slice[l:r].
ItemKind
An AST item. A more expanded version of a Solidity source unit.
LitKind
A kind of literal.
PragmaTokens
The parsed or unparsed tokens of a pragma directive.
SemverOp
SemVer comparison operator: =, >, >=, <, <=, ~, ^, *.
SemverReqComponentKind
A SemVer version requirement component.
SemverVersionNumber
A SemVer version number.
StateMutability
StmtKind
A kind of statement.
StrKind
A string literal kind.
SubDenomination
A number sub-denomination.
TimeSubDenomination
A time SubDenomination.
TypeKind
The kind of a type.
UnOpKind
A kind of unary operation.
UserDefinableOperator
A user-definable operator: +, *, |, etc.
UsingList
The path list of a using directive.
VarMut
The mutability of a variable.
Visibility
Visibility ordered from restricted to unrestricted.

Type Aliases§

Box
AST box. Allocated on the AST arena.
BoxSlice
AST box slice. Allocated on the AST arena.
NamedArgList
A list of named arguments: {a: "1", b: 2}.