Modules

Macros

Structs

  • A list of named or unnamed arguments: { foo: 42, bar: 64 } or (42, 64).
  • A list of flags of an assembly statement.
  • A curly-braced block of statements: { ... }.
  • A catch clause of a StmtTry: catch { ... }.
  • An event parameter.
  • An array literal expression: [a, b, c, d].
  • A binary operation: a + b, a += b.
  • A function call expression: foo(42) or foo({ bar: 42 }).
  • Function call options: foo.bar{ value: 1, gas: 2 }.
  • A unary delete expression: delete vector.
  • A square bracketed indexing expression: vector[2].
  • Access of a named member: obj.k.
  • A new expression: new Contract.
  • A payable expression: payable(address(0x...)).
  • A postfix unary expression: foo++.
  • A ternary (AKA conditional) expression: foo ? bar : baz.
  • A tuple expression: (a, b, c, d).
  • A type() expression: type(uint256)
  • A unary operation: !x, -x.
  • A Solidity file. The root of the AST.
  • A list of unique function attributes. Used in ItemFunction.
  • A hex string.
  • An import alias.
  • A list of import aliases: { Foo as Bar, Baz } from "foo.sol".
  • An import directive: import "foo.sol";.
  • A glob import directive: * as Foo from "foo.sol".
  • A plain import directive: import "foo.sol" as Foo;.
  • A list of inheritance specifiers of an ItemContract: is ERC20("Token", "TKN"), Ownable.
  • A contract, abstract contract, interface, or library definition: contract Foo is Bar("foo"), Baz { ... }.
  • An enum definition: enum Foo { A, B, C }.
  • An error definition: error Foo(uint256 a, uint256 b);.
  • A function, constructor, fallback, receive, or modifier definition: function helloWorld() external pure returns(string memory);.
  • A struct definition: struct Foo { uint256 bar; }.
  • A user-defined value type definition: type Foo is uint256;.
  • A line-column pair representing the start or end of a Span.
  • A modifier invocation, or an inheritance specifier.
  • A named argument in an argument list: foo: uint256(42).
  • A named argument list: { foo: uint256(42), bar: true }.
  • The override attribute.
  • A list of VariableDeclarations, separated by P.
  • A pragma directive: pragma solidity ^0.8.0;
  • The returns attribute of a function.
  • A Solidity identifier.
  • A list of identifiers, separated by dots.
  • An assembly block, with optional flags: assembly "evmasm" { ... }.
  • A break statement: break;.
  • A continue statement: continue;.
  • A do-while statement: do { ... } while (condition);.
  • An emit statement: emit FooBar(42);.
  • An expression with a trailing semicolon.
  • A for statement: for (uint256 i; i < 42; ++i) { ... }.
  • An if statement with an optional else block: if (expr) { ... } else { ... }.
  • A return statement: return 42;.
  • A revert statement: revert("error");.
  • A try statement: try fooBar(42) catch { ... }.
  • A variable declaration statement: uint256 foo = 42;.
  • A while statement: while (i < 42) { ... }.
  • An array type.
  • A function type: function() returns (string memory).
  • A mapping type: mapping(uint key => string value)
  • A tuple type.
  • An unchecked block: unchecked { ... }.
  • A unicode string.
  • A using directive: using { A, B.mul as * } for uint256 global;.
  • A declaration of variables in a tuple: (,,uint256 foo,string memory bar).
  • A list of unique variable attributes.
  • A variable declaration: string memory hello.
  • An enum variant.
  • Represents the walrus operator :=.
  • A Yul block contains YulStmt between curly braces.
  • Represents a non-default case of a Yul switch statement.
  • Yul function call.
  • Yul for loop e.g for {let i := 0} lt(i,10) {i := add(i,1)} {mstore(i,7)}.
  • Yul function definition: function f() -> a, b { ... }.
  • A Yul identifier.
  • A Yul if statement: if lt(a, b) { sstore(0, 1) }.
  • In inline assembly, only dot-less identifiers can be declared, but dotted paths can reference declarations made outside the assembly block.
  • The return attribute of a Yul function definition.
  • A Yul switch statement can consist of only a default-case or one or more non-default cases optionally followed by a default-case.
  • Represents the default case of a Yul switch statement.
  • Yul variable assignment. x := 0 or x, y := foo(). Assigning values to multiple variables requires a function call.
  • 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

Enums

Traits

  • A trait that can provide the Span of the complete contents of a syntax tree node.
  • Syntax tree traversal to walk a shared borrow of a syntax tree.

Functions

Type Aliases