ast

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayLiteral added in v0.0.2

type ArrayLiteral struct {
	Token    token.Token
	Elements []Expression
}

func (*ArrayLiteral) Line added in v0.0.2

func (al *ArrayLiteral) Line() uint

func (*ArrayLiteral) String added in v0.0.2

func (al *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral added in v0.0.2

func (al *ArrayLiteral) TokenLiteral() string

type AssignStmt added in v1.1.0

type AssignStmt struct {
	Token token.Token // The 'var' or identifier token
	Name  *Identifier
	Value Expression
}

func (*AssignStmt) Line added in v1.1.0

func (as *AssignStmt) Line() uint

func (*AssignStmt) String added in v1.1.0

func (as *AssignStmt) String() string

func (*AssignStmt) TokenLiteral added in v1.1.0

func (as *AssignStmt) TokenLiteral() string

type BlockStmt added in v1.1.0

type BlockStmt struct {
	Token      token.Token
	Statements []Statement
}

func (*BlockStmt) Line added in v1.1.0

func (bs *BlockStmt) Line() uint

func (*BlockStmt) String added in v1.1.0

func (bs *BlockStmt) String() string

func (*BlockStmt) TokenLiteral added in v1.1.0

func (bs *BlockStmt) TokenLiteral() string

type BooleanLiteral

type BooleanLiteral struct {
	Token token.Token // The 'true' or 'false' token
	Value bool
}

func (*BooleanLiteral) Line added in v0.0.2

func (bl *BooleanLiteral) Line() uint

func (*BooleanLiteral) String

func (bl *BooleanLiteral) String() string

func (*BooleanLiteral) TokenLiteral

func (bl *BooleanLiteral) TokenLiteral() string

type BreakIfStmt added in v1.3.0

type BreakIfStmt struct {
	Token     token.Token // The '@breakIf' token
	Condition Expression
}

func (*BreakIfStmt) Line added in v1.3.0

func (bis *BreakIfStmt) Line() uint

func (*BreakIfStmt) String added in v1.3.0

func (bis *BreakIfStmt) String() string

func (*BreakIfStmt) TokenLiteral added in v1.3.0

func (bis *BreakIfStmt) TokenLiteral() string

type BreakStmt added in v1.2.0

type BreakStmt struct {
	Token token.Token // The '@break' token
}

func (*BreakStmt) Line added in v1.2.0

func (bs *BreakStmt) Line() uint

func (*BreakStmt) String added in v1.2.0

func (bs *BreakStmt) String() string

func (*BreakStmt) TokenLiteral added in v1.2.0

func (bs *BreakStmt) TokenLiteral() string

type CallExp added in v1.1.0

type CallExp struct {
	Token     token.Token // Function identifier token
	Receiver  Expression  // Receiver of the call
	Function  *Identifier // Function being called
	Arguments []Expression
}

func (*CallExp) Line added in v1.1.0

func (ce *CallExp) Line() uint

func (*CallExp) String added in v1.1.0

func (ce *CallExp) String() string

func (*CallExp) TokenLiteral added in v1.1.0

func (ce *CallExp) TokenLiteral() string

type ComponentStmt added in v1.4.0

type ComponentStmt struct {
	Token    token.Token // The '@component' token
	Name     *StringLiteral
	Argument *ObjectLiteral
	Block    *Program
}

func (*ComponentStmt) Line added in v1.4.0

func (cs *ComponentStmt) Line() uint

func (*ComponentStmt) String added in v1.4.0

func (cs *ComponentStmt) String() string

func (*ComponentStmt) TokenLiteral added in v1.4.0

func (cs *ComponentStmt) TokenLiteral() string

type ContinueIfStmt added in v1.3.0

type ContinueIfStmt struct {
	Token     token.Token // The '@continueIf' token
	Condition Expression
}

func (*ContinueIfStmt) Line added in v1.3.0

func (cis *ContinueIfStmt) Line() uint

func (*ContinueIfStmt) String added in v1.3.0

func (cis *ContinueIfStmt) String() string

func (*ContinueIfStmt) TokenLiteral added in v1.3.0

func (cis *ContinueIfStmt) TokenLiteral() string

type ContinueStmt added in v1.2.0

type ContinueStmt struct {
	Token token.Token // The '@continue' token
}

func (*ContinueStmt) Line added in v1.2.0

func (cs *ContinueStmt) Line() uint

func (*ContinueStmt) String added in v1.2.0

func (cs *ContinueStmt) String() string

func (*ContinueStmt) TokenLiteral added in v1.2.0

func (cs *ContinueStmt) TokenLiteral() string

type DotExp added in v1.1.0

type DotExp struct {
	Token token.Token // The dot token
	Left  Expression  // -->x.y
	Key   Expression  // x.y<--
}

func (*DotExp) Line added in v1.1.0

func (de *DotExp) Line() uint

func (*DotExp) String added in v1.1.0

func (de *DotExp) String() string

func (*DotExp) TokenLiteral added in v1.1.0

func (de *DotExp) TokenLiteral() string

type EachStmt added in v1.1.0

type EachStmt struct {
	Token       token.Token // The '@for' token
	Var         *Identifier // The variable name
	Array       Expression  // The array to loop over
	Alternative *BlockStmt  // The @else block
	Block       *BlockStmt
}

func (*EachStmt) Line added in v1.1.0

func (es *EachStmt) Line() uint

func (*EachStmt) String added in v1.1.0

func (es *EachStmt) String() string

func (*EachStmt) TokenLiteral added in v1.1.0

func (es *EachStmt) TokenLiteral() string

type ElseIfStmt added in v1.1.0

type ElseIfStmt struct {
	Token       token.Token
	Condition   Expression
	Consequence *BlockStmt
}

func (*ElseIfStmt) Line added in v1.1.0

func (eis *ElseIfStmt) Line() uint

func (*ElseIfStmt) String added in v1.1.0

func (eis *ElseIfStmt) String() string

func (*ElseIfStmt) TokenLiteral added in v1.1.0

func (eis *ElseIfStmt) TokenLiteral() string

type Expression

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

type ExpressionStmt added in v1.1.0

type ExpressionStmt struct {
	Token      token.Token
	Expression Expression
}

func (*ExpressionStmt) Line added in v1.1.0

func (es *ExpressionStmt) Line() uint

func (*ExpressionStmt) String added in v1.1.0

func (es *ExpressionStmt) String() string

func (*ExpressionStmt) TokenLiteral added in v1.1.0

func (es *ExpressionStmt) TokenLiteral() string

type FloatLiteral added in v0.0.2

type FloatLiteral struct {
	Token token.Token
	Value float64
}

func (*FloatLiteral) Line added in v0.0.2

func (fl *FloatLiteral) Line() uint

func (*FloatLiteral) String added in v0.0.2

func (fl *FloatLiteral) String() string

func (*FloatLiteral) TokenLiteral added in v0.0.2

func (fl *FloatLiteral) TokenLiteral() string

type ForStmt added in v1.1.0

type ForStmt struct {
	Token       token.Token // The '@for' token
	Init        Statement   // The initialization statement; or nil
	Condition   Expression  // The condition expression; or nil
	Post        Statement   // The post iteration statement; or nil
	Alternative *BlockStmt  // The @else block
	Block       *BlockStmt
}

func (*ForStmt) Line added in v1.1.0

func (fs *ForStmt) Line() uint

func (*ForStmt) String added in v1.1.0

func (fs *ForStmt) String() string

func (*ForStmt) TokenLiteral added in v1.1.0

func (fs *ForStmt) TokenLiteral() string

type HTMLStmt added in v1.1.0

type HTMLStmt struct {
	Token token.Token
}

func (*HTMLStmt) Line added in v1.1.0

func (hs *HTMLStmt) Line() uint

func (*HTMLStmt) String added in v1.1.0

func (hs *HTMLStmt) String() string

func (*HTMLStmt) TokenLiteral added in v1.1.0

func (hs *HTMLStmt) TokenLiteral() string

type Identifier

type Identifier struct {
	Token token.Token
	Value string
}

func (*Identifier) Line added in v0.0.2

func (i *Identifier) Line() uint

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfStmt added in v1.1.0

type IfStmt struct {
	Token        token.Token   // The '@if' token
	Condition    Expression    // The truthy condition
	Consequence  *BlockStmt    // The 'then' block
	Alternative  *BlockStmt    // The @else block
	Alternatives []*ElseIfStmt // The @elseif blocks
}

func (*IfStmt) Line added in v1.1.0

func (is *IfStmt) Line() uint

func (*IfStmt) String added in v1.1.0

func (is *IfStmt) String() string

func (*IfStmt) TokenLiteral added in v1.1.0

func (is *IfStmt) TokenLiteral() string

type IndexExp added in v1.1.0

type IndexExp struct {
	Token token.Token // The '[' token
	Left  Expression
	Index Expression
}

func (*IndexExp) Line added in v1.1.0

func (ie *IndexExp) Line() uint

func (*IndexExp) String added in v1.1.0

func (ie *IndexExp) String() string

func (*IndexExp) TokenLiteral added in v1.1.0

func (ie *IndexExp) TokenLiteral() string

type InfixExp added in v1.1.0

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

func (*InfixExp) Line added in v1.1.0

func (ie *InfixExp) Line() uint

func (*InfixExp) String added in v1.1.0

func (ie *InfixExp) String() string

func (*InfixExp) TokenLiteral added in v1.1.0

func (ie *InfixExp) TokenLiteral() string

type InsertStmt added in v1.1.0

type InsertStmt struct {
	Token    token.Token    // The '@insert' token
	Name     *StringLiteral // The name of the insert statement
	Argument Expression     // The argument to the insert statement; nil if has block
	Block    *BlockStmt     // The block of the insert statement; nil if has argument
}

func (*InsertStmt) Line added in v1.1.0

func (is *InsertStmt) Line() uint

func (*InsertStmt) String added in v1.1.0

func (is *InsertStmt) String() string

func (*InsertStmt) TokenLiteral added in v1.1.0

func (is *InsertStmt) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token
	Value int64
}

func (*IntegerLiteral) Line added in v0.0.2

func (il *IntegerLiteral) Line() uint

func (*IntegerLiteral) String

func (il *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

type NilLiteral

type NilLiteral struct {
	Token token.Token // The 'nil' token
}

func (*NilLiteral) Line added in v0.0.2

func (nl *NilLiteral) Line() uint

func (*NilLiteral) String

func (nl *NilLiteral) String() string

func (*NilLiteral) TokenLiteral

func (nl *NilLiteral) TokenLiteral() string

type Node

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

type ObjectLiteral added in v0.0.8

type ObjectLiteral struct {
	Token token.Token           // The '{' token
	Pairs map[string]Expression // The key-value pairs
}

func (*ObjectLiteral) Line added in v0.0.8

func (os *ObjectLiteral) Line() uint

func (*ObjectLiteral) String added in v0.0.8

func (ol *ObjectLiteral) String() string

func (*ObjectLiteral) TokenLiteral added in v0.0.8

func (ol *ObjectLiteral) TokenLiteral() string

type PostfixExp added in v1.1.0

type PostfixExp struct {
	Token    token.Token // The '++' or '--' token
	Operator string
	Left     Expression
}

func (*PostfixExp) Line added in v1.1.0

func (pe *PostfixExp) Line() uint

func (*PostfixExp) String added in v1.1.0

func (pe *PostfixExp) String() string

func (*PostfixExp) TokenLiteral added in v1.1.0

func (pe *PostfixExp) TokenLiteral() string

type PrefixExp added in v1.1.0

type PrefixExp struct {
	Token    token.Token // The '!' or '-' token
	Operator string
	Right    Expression
}

func (*PrefixExp) Line added in v1.1.0

func (pe *PrefixExp) Line() uint

func (*PrefixExp) String added in v1.1.0

func (pe *PrefixExp) String() string

func (*PrefixExp) TokenLiteral added in v1.1.0

func (pe *PrefixExp) TokenLiteral() string

type Program

type Program struct {
	Token      token.Token // The 'program' token
	IsLayout   bool
	UseStmt    *UseStmt
	Statements []Statement
	Components []*ComponentStmt
	Reserves   map[string]*ReserveStmt
	Inserts    map[string]*InsertStmt
}

func (*Program) ApplyComponent added in v1.4.0

func (p *Program) ApplyComponent(name string, prog *Program)

func (*Program) ApplyInserts added in v0.0.2

func (p *Program) ApplyInserts(inserts map[string]*InsertStmt, absPath string) *fail.Error

func (*Program) ApplyLayout added in v0.0.2

func (p *Program) ApplyLayout(prog *Program)

func (*Program) HasReserveStmt added in v0.0.2

func (p *Program) HasReserveStmt() bool

func (*Program) HasUseStmt added in v0.0.2

func (p *Program) HasUseStmt() bool

func (*Program) Line added in v0.0.2

func (p *Program) Line() uint

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type ReserveStmt added in v1.1.0

type ReserveStmt struct {
	Token  token.Token // The '@reserve' token
	Insert *InsertStmt // The insert statement; nil if not yet parsed
	Name   *StringLiteral
}

func (*ReserveStmt) Line added in v1.1.0

func (rs *ReserveStmt) Line() uint

func (*ReserveStmt) String added in v1.1.0

func (rs *ReserveStmt) String() string

func (*ReserveStmt) TokenLiteral added in v1.1.0

func (rs *ReserveStmt) TokenLiteral() string

type Statement

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

type StringLiteral

type StringLiteral struct {
	Token token.Token // The content of the string
	Value string
}

func (*StringLiteral) Line added in v0.0.2

func (sl *StringLiteral) Line() uint

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

type TernaryExp added in v1.1.0

type TernaryExp struct {
	Token       token.Token // The '?' token
	Condition   Expression
	Consequence Expression
	Alternative Expression
}

func (*TernaryExp) Line added in v1.1.0

func (te *TernaryExp) Line() uint

func (*TernaryExp) String added in v1.1.0

func (te *TernaryExp) String() string

func (*TernaryExp) TokenLiteral added in v1.1.0

func (te *TernaryExp) TokenLiteral() string

type UseStmt added in v1.1.0

type UseStmt struct {
	Token   token.Token    // The '@use' token
	Name    *StringLiteral // The relative path to the layout like 'layouts/main'
	Program *Program
}

func (*UseStmt) Line added in v1.1.0

func (us *UseStmt) Line() uint

func (*UseStmt) String added in v1.1.0

func (us *UseStmt) String() string

func (*UseStmt) TokenLiteral added in v1.1.0

func (us *UseStmt) TokenLiteral() string

Jump to

Keyboard shortcuts

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