parser

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// 15. Comma operator: ,
	LOWEST int
	// 14. Ternary operator: ?
	// Assignment operators: =, |=, ^=, &=, <<=, >>=, +=, -=, *=, /=, %=
	TERNARY
	// 13. Logical OR operator: ||
	LOGICAL_OR
	// 12. Logical AND operator: &&
	LOGICAL_AND
	// 11. Equality operators: ==, !=
	EQUALITY
	// 10. Inequality operators: <, >, <=, >=
	INEQUALITY
	// 9. Bitwise OR operator: |
	BITWISE_OR
	// 8. Bitwise XOR operator: ^
	BITWISE_XOR
	// 7. Bitwise AND operator: &
	BITWISE_AND
	// 6. Shift operators: <<, >>
	BITWISE_SHIFT
	// 5. Addition and subtraction operators: +, -
	SUM
	// 4. Multiplication, division, and modulo operators: *, /, %
	PRODUCT
	// 3. Exponentiation operator: **
	EXPONENT
	// 2. Prefix incremend and decrement operators: ++, --
	// Unary minus: -
	// Unary operations: delete
	// Logical NOT: !
	// Bitwise NOT: ~
	PREFIX
	// 1. Postfix increment, decrement: ++, --
	// New expression: new <type name>
	// Array subscripting: <array>[<index>]
	// Member access: <object>.<member>
	// Function-like call: <function>(<args...>)
	// Parentheses: (<statement>)
	HIGHEST
)

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(filename string, src io.Reader, opts ...Option) (*ast.File, error)

ParseFile parses the Solidity source code from src and returns the corresponding AST. The filename parameter is used for context in error messages and position tracking. Optional configuration, such as tracing, can be provided via the opts parameter.

If parsing fails with syntax errors, the function returns a non-nil *ast.File (which may be partially complete) and an error of type ErrorList.

Types

type Error

type Error struct {
	Filename string
	Line     int
	Column   int
	Msg      string
}

func (Error) Error

func (e Error) Error() string

type ErrorList

type ErrorList []Error

func (ErrorList) Error

func (e ErrorList) Error() string

type Option

type Option func(*parser)

func WithTracing

func WithTracing() Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL