Crate osmium_libs_solidity_ast_extractor
Source - errors
- extract
- kw
- Solidity keywords.
- retriever
- spanned
- Helper trait and methods to manipulate syntax tree nodes’ spans.
- visit
- Syntax tree traversal to walk a shared borrow of a syntax tree.
- sol_path
- Create a
SolPath
from a list of identifiers.
- ArgList
- A list of named or unnamed arguments:
{ foo: 42, bar: 64 }
or (42, 64)
. - AssemblyFlags
- A list of flags of an assembly statement.
- Block
- A curly-braced block of statements:
{ ... }
. - CatchClause
- A catch clause of a
StmtTry
: catch { ... }
. - EventParameter
- An event parameter.
- ExprArray
- An array literal expression:
[a, b, c, d]
. - ExprBinary
- A binary operation:
a + b
, a += b
. - ExprCall
- A function call expression:
foo(42)
or foo({ bar: 42 })
. - ExprCallOptions
- Function call options:
foo.bar{ value: 1, gas: 2 }
. - ExprDelete
- A unary
delete
expression: delete vector
. - ExprIndex
- A square bracketed indexing expression:
vector[2]
. - ExprMember
- Access of a named member:
obj.k
. - ExprNew
- A
new
expression: new Contract
. - ExprPayable
- A
payable
expression: payable(address(0x...))
. - ExprPostfix
- A postfix unary expression:
foo++
. - ExprTernary
- A ternary (AKA conditional) expression:
foo ? bar : baz
. - ExprTuple
- A tuple expression:
(a, b, c, d)
. - ExprTypeCall
- A
type()
expression: type(uint256)
- ExprUnary
- A unary operation:
!x
, -x
. - File
- A Solidity file. The root of the AST.
- FunctionAttributes
- A list of unique function attributes. Used in
ItemFunction.
- HexStr
- A hex string.
- ImportAlias
- An import alias.
- ImportAliases
- A list of import aliases:
{ Foo as Bar, Baz } from "foo.sol"
. - ImportDirective
- An import directive:
import "foo.sol";
. - ImportGlob
- A glob import directive:
* as Foo from "foo.sol"
. - ImportPlain
- A plain import directive:
import "foo.sol" as Foo;
. - Inheritance
- A list of inheritance specifiers of an
ItemContract
:
is ERC20("Token", "TKN"), Ownable
. - ItemContract
- A contract, abstract contract, interface, or library definition:
contract Foo is Bar("foo"), Baz { ... }
. - ItemEnum
- An enum definition:
enum Foo { A, B, C }
. - ItemError
- An error definition:
error Foo(uint256 a, uint256 b);
. - ItemEvent
- ItemFunction
- A function, constructor, fallback, receive, or modifier definition:
function helloWorld() external pure returns(string memory);
. - ItemStruct
- A struct definition:
struct Foo { uint256 bar; }
. - ItemUdt
- A user-defined value type definition:
type Foo is uint256;
. - LineColumn
- A line-column pair representing the start or end of a
Span
. - LitDenominated
- LitHexStr
- LitStr
- LitUnicodeStr
- Modifier
- A modifier invocation, or an inheritance specifier.
- NamedArg
- A named argument in an argument list:
foo: uint256(42)
. - NamedArgList
- A named argument list:
{ foo: uint256(42), bar: true }
. - Override
- The
override
attribute. - Parameters
- A list of VariableDeclarations, separated by
P
. - PragmaDirective
- A pragma directive:
pragma solidity ^0.8.0;
- Returns
- The
returns
attribute of a function. - SolIdent
- A Solidity identifier.
- SolPath
- A list of identifiers, separated by dots.
- StmtAssembly
- An assembly block, with optional flags:
assembly "evmasm" { ... }
. - StmtBreak
- A break statement:
break;
. - StmtContinue
- A continue statement:
continue;
. - StmtDoWhile
- A do-while statement:
do { ... } while (condition);
. - StmtEmit
- An emit statement:
emit FooBar(42);
. - StmtExpr
- An expression with a trailing semicolon.
- StmtFor
- A for statement:
for (uint256 i; i < 42; ++i) { ... }
. - StmtIf
- An
if
statement with an optional else
block: if (expr) { ... } else { ... }
. - StmtReturn
- A return statement:
return 42;
. - StmtRevert
- A revert statement:
revert("error");
. - StmtTry
- A try statement:
try fooBar(42) catch { ... }
. - StmtVarDecl
- A variable declaration statement:
uint256 foo = 42;
. - StmtWhile
- A while statement:
while (i < 42) { ... }
. - TypeArray
- An array type.
- TypeFunction
- A function type:
function() returns (string memory)
. - TypeMapping
- A mapping type:
mapping(uint key => string value)
- TypeTuple
- A tuple type.
- UncheckedBlock
- An unchecked block:
unchecked { ... }
. - UnicodeStr
- A unicode string.
- UsingDirective
- A
using
directive: using { A, B.mul as * } for uint256 global;
. - UsingListItem
- VarDeclTuple
- A declaration of variables in a tuple:
(,,uint256 foo,string memory bar)
. - VariableAttributes
- A list of unique variable attributes.
- VariableDeclaration
- A variable declaration:
string memory hello
. - VariableDefinition
- Variant
- An enum variant.
- WalrusToken
- Represents the walrus operator
:=
. - YulBlock
- A Yul block contains
YulStmt
between curly braces. - YulCaseBranch
- Represents a non-default case of a Yul switch statement.
- YulFnCall
- Yul function call.
- YulFor
- Yul for loop e.g
for {let i := 0} lt(i,10) {i := add(i,1)} {mstore(i,7)}
. - YulFunctionDef
- Yul function definition:
function f() -> a, b { ... }
. - YulIdent
- A Yul identifier.
- YulIf
- A Yul if statement:
if lt(a, b) { sstore(0, 1) }
. - YulPath
- In inline assembly, only dot-less identifiers can be declared, but dotted
paths can reference declarations made outside the assembly block.
- YulReturns
- The return attribute of a Yul function definition.
- YulSwitch
- A Yul switch statement can consist of only a default-case or one
or more non-default cases optionally followed by a default-case.
- YulSwitchDefault
- Represents the default case of a Yul switch statement.
- YulVarAssign
- Yul variable assignment.
x := 0
or x, y := foo()
.
Assigning values to multiple variables requires a function call. - YulVarDecl
- Declares Yul variables, which may or may not have initial values. E.x.
let x := 0
let x
let x, y := foo()
let x, y, z
- ArgListImpl
- A list of either unnamed or named arguments.
- BinOp
- A binary operator:
+
, +=
, &
. - ContractKind
- The kind of contract.
- Expr
- An expression.
- ForInitStmt
- A for statement initializer.
- FunctionAttribute
- A function attribute.
- FunctionBody
- The body of a function.
- FunctionKind
- The kind of function.
- ImportPath
- The path of an import directive.
- Item
- An AST item. A more expanded version of a Solidity source unit.
- Lit
- A Solidity literal such as a string or integer or boolean.
- LitNumber
- An integer or fixed-point number literal:
1
or 1.0
. - Mutability
- A mutability attribute.
- PostUnOp
- Postfix unary operators.
- PragmaTokens
- Stmt
- A statement, usually ending in a semicolon.
- Storage
- A storage location.
- SubDenomination
- A sub-denomination suffix for a number literal.
- Type
- A type name.
- UnOp
- Unary operators.
- UserDefinableOperator
- A user-definable operator:
+
, *
, |
, etc. - UsingList
- UsingType
- VarDeclDecl
- The declaration of the variable(s) in a variable declaration statement.
- VariableAttribute
- A variable attribute.
- Visibility
- A visibility attribute.
- YulEVMBuiltIn
- Representation of an EVM builtin opcode.
- YulExpr
- A Yul expression.
- YulStmt
- A Yul statement.
- Spanned
- A trait that can provide the
Span
of the complete contents of a syntax
tree node. - Visit
- Syntax tree traversal to walk a shared borrow of a syntax tree.
- parse
- Parse a Solidity
proc_macro::TokenStream
into a File
. - parse2
- Parse a Solidity
proc_macro2::TokenStream
into a File
.
- FieldList
- A list of semicolon-separated VariableDeclarations.
- ParameterList
- A list of comma-separated VariableDeclarations.