ast

package
v0.0.0-...-8df0819 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assign

type Assign struct {
	Expression
	Token token.Token // the = token
	Name  *Identifier
	Value Expression
}

type Async

type Async struct {
	Statement
	Token token.Token // the 'async' token
	Call  Expression
}

type Block

type Block struct {
	Statement
	Token      token.Token // the { token
	Statements []Statement
}

type Boolean

type Boolean struct {
	Expression
	Token token.Token
	Value bool
}

type Break

type Break struct {
	Statement
	Token token.Token // the 'break' token
}

type Call

type Call struct {
	Expression
	Token     token.Token // The '(' token
	Function  Expression  // Identifier or Function
	Arguments []Expression
}

type Case

type Case struct {
	Expression
	Token   token.Token  // The "case" token
	Default bool         // Is this the default branch?
	Values  []Expression // The value of the case we'll be matching against
	Body    *Block       // The block that will be evaluated if matched
}

type Class

type Class struct {
	Expression
	Token token.Token
	Name  *Identifier
	Super *Identifier
	Body  *Block
}

type Compound

type Compound struct {
	Expression
	Token    token.Token // The operator token, e.g. +=,-=,*=,/=,%=
	Left     Expression
	Operator string
	Right    Expression
}

type Continue

type Continue struct {
	Statement
	Token token.Token // the 'continue' token
}

type Decorator

type Decorator struct {
	Expression
	Token     token.Token // @
	Function  Expression
	Decorated Expression
}

type Defer

type Defer struct {
	Statement
	Token token.Token // the 'defer' token
	Call  Expression
}

type Expression

type Expression interface {
	Node
}

type ExpressionStatement

type ExpressionStatement struct {
	Statement
	Token      token.Token // the first token of the expression
	Expression Expression
}

type Float

type Float struct {
	Expression
	Token token.Token
	Value float64
}

type For

type For struct {
	Expression
	Token      token.Token // The 'for' token
	Identifier string      // "i"
	Starter    Expression  // i = 0
	Closer     Expression  // i++
	Condition  Expression  // i < 1
	Block      *Block      // The block executed inside the for loop
}

type ForIn

type ForIn struct {
	Expression
	Token    token.Token // The 'for' token
	Key      string
	Value    string
	Iterable Expression // An expression that should return an iterable ([1, 2, 3] or x in 1..10)
	Block    *Block     // The block executed inside the for loop
}

type From

type From struct {
	Expression
	Token       token.Token
	File        string
	Identifiers map[string]*Identifier
	Everything  bool
}

type Function

type Function struct {
	Expression
	Token      token.Token // The 'func' token
	Name       string      // name of the function
	Parameters []*Identifier
	Defaults   map[string]Expression
	Args       *Identifier
	KwArgs     *Identifier
	Body       *Block
}

type Hash

type Hash struct {
	Expression
	Token token.Token // the '{' token
	Pairs map[Expression]Expression
}

type Identifier

type Identifier struct {
	Expression
	Token token.Token // the token.IDENTIFIER token
	Value string
}

type If

type If struct {
	Expression
	Token     token.Token // The 'if' token
	Scenarios []*Scenario
}

type Import

type Import struct {
	Expression
	Token       token.Token
	Identifiers map[string]*Identifier
}

type IndexAssignment

type IndexAssignment struct {
	Expression
	Token token.Token // the '=' token
	Name  *IndexExpression
	Value Expression
}

type IndexExpression

type IndexExpression struct {
	Expression
	Token   token.Token // The [ token
	Left    Expression
	Index   Expression
	IsRange bool       // whether the expression is a range [1:10]
	End     Expression // the end of the range, if the expression is a range
}

type Infix

type Infix struct {
	Expression
	Token    token.Token // The operator token, e.g. +
	Left     Expression
	Operator string
	Right    Expression
}

type Integer

type Integer struct {
	Expression
	Token token.Token
	Value int64
}

type List

type List struct {
	Expression
	Token    token.Token // the '[' token
	Elements []Expression
}

type Method

type Method struct {
	Expression
	Token     token.Token // The operator token .
	Object    Expression
	Method    Expression
	Arguments []Expression
}

type Node

type Node interface{}

type Null

type Null struct {
	Expression
	Token token.Token // the 'null' token
}

type Postfix

type Postfix struct {
	Expression
	Token    token.Token // The operator token, e.g. ++,--
	Left     Expression
	Operator string
}

type Prefix

type Prefix struct {
	Expression
	Token    token.Token // The prefix token, e.g. !
	Operator string
	Right    Expression
}

type Program

type Program struct {
	Statements []Statement
}

type PropertyAssignment

type PropertyAssignment struct {
	Expression
	Token token.Token // the '=' token
	Name  *PropertyExpression
	Value Expression
}

type PropertyExpression

type PropertyExpression struct {
	Expression
	Token    token.Token // The . token
	Object   Expression
	Property Expression
}

type Return

type Return struct {
	Statement
	Token token.Token // the 'return' token
	Value Expression
}

type Scenario

type Scenario struct {
	Condition Expression
	Block     *Block
}

type Statement

type Statement interface {
	Node
}

type String

type String struct {
	Expression
	Token token.Token
	Value string
}

type Super

type Super struct {
	Expression
	Token token.Token
}

type Switch

type Switch struct {
	Expression
	Token token.Token // The "switch" token
	Value Expression  // The value that will be used to determine the case
	Cases []*Case     // The cases this switch statement will handle
}

type Ternary

type Ternary struct {
	Expression
	Token     token.Token // The ? token
	Condition Expression
	IfTrue    Expression
	IfFalse   Expression
}

type This

type This struct {
	Expression
	Token token.Token
}

type While

type While struct {
	Expression
	Token     token.Token // The 'while' token
	Condition Expression
	Block     *Block
}

Jump to

Keyboard shortcuts

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