ast

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(node Node, f WalkFn)

Types

type ArrayAccess

type ArrayAccess struct {
	Token token.Token // The '${' token
	Left  Expression
	Index Expression
}

func (*ArrayAccess) String

func (aa *ArrayAccess) String() string

func (*ArrayAccess) TokenLiteral

func (aa *ArrayAccess) TokenLiteral() string

type BlockStatement

type BlockStatement struct {
	Token      token.Token // the { token or then token
	Statements []Statement
}

func (*BlockStatement) String

func (bs *BlockStatement) String() string

func (*BlockStatement) TokenLiteral

func (bs *BlockStatement) TokenLiteral() string

type Boolean

type Boolean struct {
	Token token.Token // the token.TRUE or token.FALSE token
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type BracketExpression

type BracketExpression struct {
	Token       token.Token // The '[' token
	Expressions []Expression
}

func (*BracketExpression) String

func (be *BracketExpression) String() string

func (*BracketExpression) TokenLiteral

func (be *BracketExpression) TokenLiteral() string

type CallExpression

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

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

type CommandSubstitution

type CommandSubstitution struct {
	Token   token.Token // The ` or $() token
	Command Expression
}

func (*CommandSubstitution) String

func (cs *CommandSubstitution) String() string

func (*CommandSubstitution) TokenLiteral

func (cs *CommandSubstitution) TokenLiteral() string

type DollarParenExpression

type DollarParenExpression struct {
	Token   token.Token // The '$(' token
	Command Expression
}

func (*DollarParenExpression) String

func (dpe *DollarParenExpression) String() string

func (*DollarParenExpression) TokenLiteral

func (dpe *DollarParenExpression) TokenLiteral() string

type DoubleBracketExpression

type DoubleBracketExpression struct {
	Token       token.Token // The '[[' token
	Expressions []Expression
}

func (*DoubleBracketExpression) String

func (dbe *DoubleBracketExpression) String() string

func (*DoubleBracketExpression) TokenLiteral

func (dbe *DoubleBracketExpression) TokenLiteral() string

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

type ExpressionStatement

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

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type ForLoopStatement

type ForLoopStatement struct {
	Token     token.Token // The 'for' token
	Init      Expression
	Condition Expression
	Post      Expression
	Body      *BlockStatement
}

func (*ForLoopStatement) String

func (fls *ForLoopStatement) String() string

func (*ForLoopStatement) TokenLiteral

func (fls *ForLoopStatement) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      token.Token // The 'fn' token
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type Identifier

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

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfStatement

type IfStatement struct {
	Token       token.Token // The 'if' token
	Condition   Expression
	Consequence *BlockStatement
	Alternative *BlockStatement
}

func (*IfStatement) String

func (is *IfStatement) String() string

func (*IfStatement) TokenLiteral

func (is *IfStatement) TokenLiteral() string

type InfixExpression

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

func (*InfixExpression) String

func (ie *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token // the token.INT token
	Value int64
}

func (*IntegerLiteral) String

func (il *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

type InvalidArrayAccess

type InvalidArrayAccess struct {
	Token token.Token // The '$' token
	Left  Expression
	Index Expression
}

func (*InvalidArrayAccess) String

func (iaa *InvalidArrayAccess) String() string

func (*InvalidArrayAccess) TokenLiteral

func (iaa *InvalidArrayAccess) TokenLiteral() string

type LetStatement

type LetStatement struct {
	Token token.Token // the token.LET token
	Name  *Identifier
	Value Expression
}

func (*LetStatement) String

func (ls *LetStatement) String() string

func (*LetStatement) TokenLiteral

func (ls *LetStatement) TokenLiteral() string

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

type PostfixExpression

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

func (*PostfixExpression) String

func (pe *PostfixExpression) String() string

func (*PostfixExpression) TokenLiteral

func (pe *PostfixExpression) TokenLiteral() string

type PrefixExpression

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

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	Token       token.Token // the token.RETURN token
	ReturnValue Expression
}

func (*ReturnStatement) String

func (rs *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (rs *ReturnStatement) TokenLiteral() string

type Shebang

type Shebang struct {
	Token token.Token // The #! token
	Path  string
}

func (*Shebang) String

func (s *Shebang) String() string

func (*Shebang) TokenLiteral

func (s *Shebang) TokenLiteral() string

type SimpleCommand

type SimpleCommand struct {
	Token     token.Token // The first token of the command
	Name      Expression
	Arguments []Expression
}

func (*SimpleCommand) String

func (sc *SimpleCommand) String() string

func (*SimpleCommand) TokenLiteral

func (sc *SimpleCommand) TokenLiteral() string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type StringLiteral

type StringLiteral struct {
	Token token.Token
	Value string
}

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

type WalkFn

type WalkFn func(node Node) bool

Jump to

Keyboard shortcuts

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