Versions in this module Expand all Collapse all v0 v0.4.8 Apr 14, 2023 Changes in this version + func Preprocess(tokens []Token, absPath string, open func(name string) (io.ReadCloser, error), ...) ([]Token, map[string][][]rune, *Defines, []string, []error) + type Constant struct + Token Token + type DataType string + const DTBool + const DTImage + const DTNumber + const DTNumberList + const DTString + const DTStringList + type Define struct + Content []Token + End Position + Name Token + Start Position + func (d *Define) IsInScope(at Position) bool + func (d *Define) String() string + type Defines struct + func NewDefines() *Defines + func (d *Defines) GetDefine(name string, at Position) (Define, bool) + func (d *Defines) GetDefines(at Position) []Define + type Expr interface + Accept func(visitor ExprVisitor) error + Position func() (start, end Position) + Type func() DataType + type ExprBinary struct + Left Expr + Operator Token + ReturnType DataType + Right Expr + func (e *ExprBinary) Accept(visitor ExprVisitor) error + func (e *ExprBinary) Position() (start, end Position) + func (e *ExprBinary) Type() DataType + type ExprFuncCall struct + CloseParen Token + Name Token + Parameters []Expr + ReturnType DataType + func (e *ExprFuncCall) Accept(visitor ExprVisitor) error + func (e *ExprFuncCall) Position() (start, end Position) + func (e *ExprFuncCall) Type() DataType + type ExprGrouping struct + CloseParen Token + Expr Expr + OpenParen Token + func (e *ExprGrouping) Accept(visitor ExprVisitor) error + func (e *ExprGrouping) Position() (start, end Position) + func (e *ExprGrouping) Type() DataType + type ExprIdentifier struct + Name Token + ReturnType DataType + func (e *ExprIdentifier) Accept(visitor ExprVisitor) error + func (e *ExprIdentifier) Position() (start, end Position) + func (e *ExprIdentifier) Type() DataType + type ExprListInitializer struct + CloseBracket Token + OpenBracket Token + ReturnType DataType + Values []Expr + func (e *ExprListInitializer) Accept(visitor ExprVisitor) error + func (e *ExprListInitializer) Position() (start, end Position) + func (e *ExprListInitializer) Type() DataType + type ExprLiteral struct + End Position + ReturnType DataType + Token Token + func (e *ExprLiteral) Accept(visitor ExprVisitor) error + func (e *ExprLiteral) Position() (start, end Position) + func (e *ExprLiteral) Type() DataType + type ExprTypeCast struct + CloseParen Token + ReturnType DataType + Target Token + Value Expr + func (e *ExprTypeCast) Accept(visitor ExprVisitor) error + func (e *ExprTypeCast) Position() (start, end Position) + func (e *ExprTypeCast) Type() DataType + type ExprUnary struct + Operator Token + ReturnType DataType + Right Expr + func (e *ExprUnary) Accept(visitor ExprVisitor) error + func (e *ExprUnary) Position() (start, end Position) + func (e *ExprUnary) Type() DataType + type ExprVisitor interface + VisitBinary func(expr *ExprBinary) error + VisitExprFuncCall func(expr *ExprFuncCall) error + VisitGrouping func(expr *ExprGrouping) error + VisitIdentifier func(expr *ExprIdentifier) error + VisitListInitializer func(expr *ExprListInitializer) error + VisitLiteral func(expr *ExprLiteral) error + VisitTypeCast func(expr *ExprTypeCast) error + VisitUnary func(expr *ExprUnary) error + type FuncParam struct + Name Token + Type Token + type ParseError struct + Message string + Token Token + func (p ParseError) Error() string + type Position struct + Column int + Line int + Path string + type ScanError struct + Message string + Pos Position + func (s ScanError) Error() string + type Stmt interface + Accept func(visitor StmtVisitor) error + Position func() (start, end Position) + func Parse(tokens []Token) ([]Stmt, []error) + type StmtAssignment struct + Operator Token + Value Expr + Variable Token + func (s *StmtAssignment) Accept(visitor StmtVisitor) error + func (s *StmtAssignment) Position() (start, end Position) + type StmtCall struct + CloseParen Token + Name Token + Parameters []Expr + func (s *StmtCall) Accept(visitor StmtVisitor) error + func (s *StmtCall) Position() (start, end Position) + type StmtConstDecl struct + AssignToken Token + Name Token + Value Expr + func (s *StmtConstDecl) Accept(visitor StmtVisitor) error + func (s *StmtConstDecl) Position() (start, end Position) + type StmtEvent struct + At Token + Body []Stmt + Name Token + Parameter Expr + func (s *StmtEvent) Accept(visitor StmtVisitor) error + func (s *StmtEvent) Position() (start, end Position) + type StmtEventDecl struct + Keyword Token + Name Token + func (s *StmtEventDecl) Accept(visitor StmtVisitor) error + func (s *StmtEventDecl) Position() (start, end Position) + type StmtFuncDecl struct + Body []Stmt + CloseParen Token + EndLine int + Name Token + Params []FuncParam + StartLine int + func (s *StmtFuncDecl) Accept(visitor StmtVisitor) error + func (s *StmtFuncDecl) Position() (start, end Position) + type StmtIf struct + Body []Stmt + Condition Expr + ElseBody []Stmt + Keyword Token + func (s *StmtIf) Accept(visitor StmtVisitor) error + func (s *StmtIf) Position() (start, end Position) + type StmtLoop struct + Body []Stmt + Condition Expr + Keyword Token + func (s *StmtLoop) Accept(visitor StmtVisitor) error + func (s *StmtLoop) Position() (start, end Position) + type StmtVarDecl struct + AssignToken Token + DataType DataType + Name Token + Value Expr + func (s *StmtVarDecl) Accept(visitor StmtVisitor) error + func (s *StmtVarDecl) Position() (start, end Position) + type StmtVisitor interface + VisitAssignment func(stmt *StmtAssignment) error + VisitCall func(stmt *StmtCall) error + VisitConstDecl func(stmt *StmtConstDecl) error + VisitEvent func(stmt *StmtEvent) error + VisitEventDecl func(stmt *StmtEventDecl) error + VisitFuncDecl func(stmt *StmtFuncDecl) error + VisitIf func(stmt *StmtIf) error + VisitLoop func(stmt *StmtLoop) error + VisitVarDecl func(stmt *StmtVarDecl) error + type Token struct + DataType DataType + EndPos Position + Indent int + Lexeme string + LineAfterInclude int + Literal any + Pos Position + Type TokenType + func Scan(source io.Reader, path string) ([]Token, [][]rune, []error) + func (t Token) String() string + type TokenType int + const TkAnd + const TkAssign + const TkAt + const TkBang + const TkCloseBracket + const TkCloseParen + const TkColon + const TkComma + const TkConst + const TkDivide + const TkDivideAssign + const TkDot + const TkEOF + const TkElif + const TkElse + const TkEqual + const TkEvent + const TkFor + const TkFunc + const TkGreater + const TkGreaterEqual + const TkIdentifier + const TkIf + const TkLess + const TkLessEqual + const TkLiteral + const TkMinus + const TkMinusAssign + const TkModulus + const TkModulusAssign + const TkMultiply + const TkMultiplyAssign + const TkNewLine + const TkNotEqual + const TkOpenBracket + const TkOpenParen + const TkOr + const TkPlus + const TkPlusAssign + const TkPreprocessor + const TkType + const TkVar + const TkWhile