Documentation ¶
Index ¶
- Constants
- Variables
- type Ast
- type BooleanConst
- type BuiltinTypeSymbol
- type CronSymbol
- type Error
- type ErrorCode
- type ErrorType
- type FloatConst
- type IntegerConst
- type Interpreter
- func (i *Interpreter) Interpret() (interface{}, error)
- func (i *Interpreter) SetComponent(bus event.Bus, rdb *redis.Client, message pb.MessageSvcClient, ...)
- func (i *Interpreter) Stdout() string
- func (i *Interpreter) Visit(node Ast) interface{}
- func (i *Interpreter) VisitBooleanConst(node *BooleanConst) bool
- func (i *Interpreter) VisitFloatConst(node *FloatConst) float64
- func (i *Interpreter) VisitIntegerConst(node *IntegerConst) int64
- func (i *Interpreter) VisitMessageConst(node *MessageConst) interface{}
- func (i *Interpreter) VisitNoOp(_ *NoOp) interface{}
- func (i *Interpreter) VisitOpcode(node *Opcode) float64
- func (i *Interpreter) VisitProgram(node *Program) interface{}
- func (i *Interpreter) VisitStringConst(node *StringConst) string
- func (i *Interpreter) VisitVar(_ *Var) interface{}
- type Lexer
- func (l *Lexer) Advance()
- func (l *Lexer) CarriageReturn() (*Token, error)
- func (l *Lexer) GetNextToken() (*Token, error)
- func (l *Lexer) Id() (*Token, error)
- func (l *Lexer) Message() (*Token, error)
- func (l *Lexer) Number() (*Token, error)
- func (l *Lexer) Peek() rune
- func (l *Lexer) SkipComment()
- func (l *Lexer) SkipWhitespace()
- func (l *Lexer) String() (*Token, error)
- type MessageConst
- type NoOp
- type Opcode
- type OpcodeSymbol
- type Parser
- func (p *Parser) Eat(tokenType TokenType) (err error)
- func (p *Parser) Empty() (Ast, error)
- func (p *Parser) Expression() ([]Ast, error)
- func (p *Parser) Factor() (Ast, error)
- func (p *Parser) OpcodeStatement() (Ast, error)
- func (p *Parser) Parse() (Ast, error)
- func (p *Parser) Program() (Ast, error)
- func (p *Parser) Statement() (Ast, error)
- func (p *Parser) StatementList() ([]Ast, error)
- func (p *Parser) Variable() (Ast, error)
- type Program
- type ScopedSymbolTable
- type SemanticAnalyzer
- func (b *SemanticAnalyzer) Visit(node Ast) error
- func (b *SemanticAnalyzer) VisitBooleanConst(_ *BooleanConst) error
- func (b *SemanticAnalyzer) VisitIntegerConst(_ *IntegerConst) error
- func (b *SemanticAnalyzer) VisitMessageConst(_ *MessageConst) error
- func (b *SemanticAnalyzer) VisitNoOp(_ *NoOp) error
- func (b *SemanticAnalyzer) VisitOpcode(node *Opcode) error
- func (b *SemanticAnalyzer) VisitProgram(node *Program) error
- func (b *SemanticAnalyzer) VisitStringConst(_ *StringConst) error
- func (b *SemanticAnalyzer) VisitVar(node *Var) error
- type StringConst
- type Symbol
- type Token
- type TokenType
- type Var
- type WebhookSymbol
Constants ¶
View Source
const ( TokenPlus = "+" TokenMinus = "-" TokenMultiply = "*" TokenFloatDiv = "/" TokenLParen = "(" TokenRParen = ")" TokenLSquare = "[" TokenRSquare = "]" TokenLCurly = "{" TokenRCurly = "}" TokenSemi = ";" TokenDot = "." TokenColon = ":" TokenComma = "," TokenID = "ID" TokenIntegerConst = "INTEGER_CONST" TokenFloatConst = "FLOAT_CONST" TokenStringConst = "STRING_CONST" TokenMessageConst = "MESSAGE_CONST" TokenTrue = "TRUE" TokenFalse = "FALSE" TokenCarriageReturn = "\n" TokenEOF = "EOF" )
Variables ¶
View Source
var Debug bool
View Source
var ReservedKeywords = map[string]Token{ "TRUE": {Type: TokenTrue, Value: true}, "FALSE": {Type: TokenFalse, Value: false}, }
Functions ¶
This section is empty.
Types ¶
type BooleanConst ¶
func NewBooleanConst ¶
func NewBooleanConst(token *Token) *BooleanConst
type BuiltinTypeSymbol ¶ added in v0.0.18
func NewBuiltinTypeSymbol ¶ added in v0.0.18
func NewBuiltinTypeSymbol(name string) *BuiltinTypeSymbol
func (*BuiltinTypeSymbol) String ¶ added in v0.0.18
func (s *BuiltinTypeSymbol) String() string
type CronSymbol ¶ added in v0.0.18
type CronSymbol struct {
When string
}
func NewCronSymbol ¶ added in v0.0.18
func NewCronSymbol(when string) *CronSymbol
func (*CronSymbol) String ¶ added in v0.0.18
func (s *CronSymbol) String() string
type FloatConst ¶
func NewFloatConst ¶
func NewFloatConst(token *Token) *FloatConst
type IntegerConst ¶
func NewIntegerConst ¶
func NewIntegerConst(token *Token) *IntegerConst
type Interpreter ¶
func NewInterpreter ¶
func NewInterpreter(ctx context.Context, tree Ast) *Interpreter
func (*Interpreter) Interpret ¶
func (i *Interpreter) Interpret() (interface{}, error)
func (*Interpreter) SetComponent ¶ added in v0.0.25
func (i *Interpreter) SetComponent(bus event.Bus, rdb *redis.Client, message pb.MessageSvcClient, middle pb.MiddleSvcClient, logger log.Logger)
func (*Interpreter) Stdout ¶
func (i *Interpreter) Stdout() string
func (*Interpreter) Visit ¶
func (i *Interpreter) Visit(node Ast) interface{}
func (*Interpreter) VisitBooleanConst ¶
func (i *Interpreter) VisitBooleanConst(node *BooleanConst) bool
func (*Interpreter) VisitFloatConst ¶
func (i *Interpreter) VisitFloatConst(node *FloatConst) float64
func (*Interpreter) VisitIntegerConst ¶
func (i *Interpreter) VisitIntegerConst(node *IntegerConst) int64
func (*Interpreter) VisitMessageConst ¶
func (i *Interpreter) VisitMessageConst(node *MessageConst) interface{}
func (*Interpreter) VisitNoOp ¶
func (i *Interpreter) VisitNoOp(_ *NoOp) interface{}
func (*Interpreter) VisitOpcode ¶
func (i *Interpreter) VisitOpcode(node *Opcode) float64
func (*Interpreter) VisitProgram ¶
func (i *Interpreter) VisitProgram(node *Program) interface{}
func (*Interpreter) VisitStringConst ¶
func (i *Interpreter) VisitStringConst(node *StringConst) string
func (*Interpreter) VisitVar ¶
func (i *Interpreter) VisitVar(_ *Var) interface{}
type Lexer ¶
func (*Lexer) CarriageReturn ¶
func (*Lexer) GetNextToken ¶
func (*Lexer) SkipComment ¶
func (l *Lexer) SkipComment()
func (*Lexer) SkipWhitespace ¶
func (l *Lexer) SkipWhitespace()
type MessageConst ¶
type MessageConst struct { Token *Token Value interface{} }
func NewMessageConst ¶
func NewMessageConst(token *Token) *MessageConst
type OpcodeSymbol ¶ added in v0.0.18
func NewOpcodeSymbol ¶ added in v0.0.18
func NewOpcodeSymbol(name string) *OpcodeSymbol
func (*OpcodeSymbol) String ¶ added in v0.0.18
func (s *OpcodeSymbol) String() string
type Parser ¶
func (*Parser) Expression ¶
func (*Parser) OpcodeStatement ¶
func (*Parser) StatementList ¶
type Program ¶
func NewProgram ¶
type ScopedSymbolTable ¶ added in v0.0.18
type ScopedSymbolTable struct { ScopeName string ScopeLevel int EnclosingScope *ScopedSymbolTable // contains filtered or unexported fields }
func NewScopedSymbolTable ¶ added in v0.0.18
func NewScopedSymbolTable(scopeName string, scopeLevel int, enclosingScope *ScopedSymbolTable) *ScopedSymbolTable
func (*ScopedSymbolTable) Insert ¶ added in v0.0.18
func (t *ScopedSymbolTable) Insert(symbol Symbol)
func (*ScopedSymbolTable) Lookup ¶ added in v0.0.18
func (t *ScopedSymbolTable) Lookup(name string, currentScopeOnly bool) Symbol
func (*ScopedSymbolTable) String ¶ added in v0.0.18
func (t *ScopedSymbolTable) String() string
type SemanticAnalyzer ¶ added in v0.0.18
type SemanticAnalyzer struct { CurrentScope *ScopedSymbolTable Webhook *WebhookSymbol Cron *CronSymbol }
func NewSemanticAnalyzer ¶ added in v0.0.18
func NewSemanticAnalyzer() *SemanticAnalyzer
func (*SemanticAnalyzer) Visit ¶ added in v0.0.18
func (b *SemanticAnalyzer) Visit(node Ast) error
func (*SemanticAnalyzer) VisitBooleanConst ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitBooleanConst(_ *BooleanConst) error
func (*SemanticAnalyzer) VisitIntegerConst ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitIntegerConst(_ *IntegerConst) error
func (*SemanticAnalyzer) VisitMessageConst ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitMessageConst(_ *MessageConst) error
func (*SemanticAnalyzer) VisitNoOp ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitNoOp(_ *NoOp) error
func (*SemanticAnalyzer) VisitOpcode ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitOpcode(node *Opcode) error
func (*SemanticAnalyzer) VisitProgram ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitProgram(node *Program) error
func (*SemanticAnalyzer) VisitStringConst ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitStringConst(_ *StringConst) error
func (*SemanticAnalyzer) VisitVar ¶ added in v0.0.18
func (b *SemanticAnalyzer) VisitVar(node *Var) error
type StringConst ¶
func NewStringConst ¶
func NewStringConst(token *Token) *StringConst
type WebhookSymbol ¶ added in v0.0.18
func NewWebhookSymbol ¶ added in v0.0.18
func NewWebhookSymbol(flag string, secret string) *WebhookSymbol
func (*WebhookSymbol) String ¶ added in v0.0.18
func (s *WebhookSymbol) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.