runtime

package
v0.0.0-...-b972740 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnythingToString

func AnythingToString(val interface{}) (string, error)

func FloatToString

func FloatToString(input_num float64) string

func RuleToInt

func RuleToInt(rule antlr.ParseTree) (int, error)

func Run

func Run(code string, out io.Writer) interface{}

Run runs code and returns visiter output

func RunCmd

func RunCmd(name string, args ...string) string

func ThrowIncorrectFunctionCall

func ThrowIncorrectFunctionCall(logger *Logger,
	function string, expected int, actual int)

func ThrowRuntimeError

func ThrowRuntimeError(logger *Logger, message string)

func Validate

func Validate(code string)

Validate checks code is syntactically correct

Types

type BeepBoopVisitor

type BeepBoopVisitor struct {
	*parser.BaseBeepBoopVisitor
	// contains filtered or unexported fields
}

func NewBeepBoopVisitor

func NewBeepBoopVisitor(out io.Writer) *BeepBoopVisitor

func (*BeepBoopVisitor) EndScope

func (v *BeepBoopVisitor) EndScope()

func (*BeepBoopVisitor) StartScope

func (v *BeepBoopVisitor) StartScope()

func (*BeepBoopVisitor) Visit

func (v *BeepBoopVisitor) Visit(tree antlr.ParseTree) interface{}

func (*BeepBoopVisitor) VisitAdditiveMath

func (v *BeepBoopVisitor) VisitAdditiveMath(ctx *parser.AdditiveMathContext) interface{}

func (*BeepBoopVisitor) VisitAndCond

func (v *BeepBoopVisitor) VisitAndCond(ctx *parser.AndCondContext) interface{}

func (*BeepBoopVisitor) VisitAssignStatement

func (v *BeepBoopVisitor) VisitAssignStatement(ctx *parser.AssignStatementContext) interface{}

func (*BeepBoopVisitor) VisitAssignstat

func (v *BeepBoopVisitor) VisitAssignstat(ctx *parser.AssignstatContext) interface{}

func (*BeepBoopVisitor) VisitBeepboop

func (v *BeepBoopVisitor) VisitBeepboop(ctx *parser.BoopContext) interface{}

func (*BeepBoopVisitor) VisitBoolCond

func (v *BeepBoopVisitor) VisitBoolCond(ctx *parser.BoolCondContext) interface{}

func (*BeepBoopVisitor) VisitBoolLiteral

func (v *BeepBoopVisitor) VisitBoolLiteral(ctx *parser.BoolLiteralContext) interface{}

func (*BeepBoopVisitor) VisitBoolexpr

func (v *BeepBoopVisitor) VisitBoolexpr(ctx *parser.BoolexprContext) interface{}

func (*BeepBoopVisitor) VisitBoop

func (v *BeepBoopVisitor) VisitBoop(ctx *parser.BoopContext) interface{}

func (*BeepBoopVisitor) VisitDivFnargs

func (v *BeepBoopVisitor) VisitDivFnargs(ctx *parser.DivFnargsContext) interface{}

func (*BeepBoopVisitor) VisitEqualsCond

func (v *BeepBoopVisitor) VisitEqualsCond(ctx *parser.EqualsCondContext) interface{}

func (*BeepBoopVisitor) VisitErrorNode

func (v *BeepBoopVisitor) VisitErrorNode(node antlr.ErrorNode) interface{}

func (*BeepBoopVisitor) VisitExportStatement

func (v *BeepBoopVisitor) VisitExportStatement(ctx *parser.ExportStatementContext) interface{}

func (*BeepBoopVisitor) VisitExportstat

func (v *BeepBoopVisitor) VisitExportstat(ctx *parser.ExportstatContext) interface{}

func (*BeepBoopVisitor) VisitExprAssign

func (v *BeepBoopVisitor) VisitExprAssign(ctx *parser.ExprAssignContext) interface{}

func (*BeepBoopVisitor) VisitFlagFnargs

func (v *BeepBoopVisitor) VisitFlagFnargs(ctx *parser.FlagFnargsContext) interface{}

func (*BeepBoopVisitor) VisitFloatNum

func (v *BeepBoopVisitor) VisitFloatNum(ctx *parser.FloatNumContext) interface{}

func (*BeepBoopVisitor) VisitFncall

func (v *BeepBoopVisitor) VisitFncall(ctx *parser.FncallContext) interface{}

func (*BeepBoopVisitor) VisitFncallAssign

func (v *BeepBoopVisitor) VisitFncallAssign(ctx *parser.FncallAssignContext) interface{}

func (*BeepBoopVisitor) VisitFncallPipe

func (v *BeepBoopVisitor) VisitFncallPipe(ctx *parser.FncallPipeContext) interface{}

func (*BeepBoopVisitor) VisitFncallStatement

func (v *BeepBoopVisitor) VisitFncallStatement(ctx *parser.FncallStatementContext) interface{}

func (*BeepBoopVisitor) VisitFuncdef

func (v *BeepBoopVisitor) VisitFuncdef(ctx *parser.FuncdefContext) interface{}

func (*BeepBoopVisitor) VisitFuncdefCode

func (v *BeepBoopVisitor) VisitFuncdefCode(ctx *parser.FuncdefCodeContext) interface{}

func (*BeepBoopVisitor) VisitFuncguts

func (v *BeepBoopVisitor) VisitFuncguts(ctx *parser.FuncgutsContext) interface{}

func (*BeepBoopVisitor) VisitGthanCond

func (v *BeepBoopVisitor) VisitGthanCond(ctx *parser.GthanCondContext) interface{}

func (*BeepBoopVisitor) VisitGthanequalsCond

func (v *BeepBoopVisitor) VisitGthanequalsCond(ctx *parser.GthanequalsCondContext) interface{}

func (*BeepBoopVisitor) VisitIfStatement

func (v *BeepBoopVisitor) VisitIfStatement(ctx *parser.IfStatementContext) interface{}

func (*BeepBoopVisitor) VisitIfstat

func (v *BeepBoopVisitor) VisitIfstat(ctx *parser.IfstatContext) interface{}

func (*BeepBoopVisitor) VisitImportStatement

func (v *BeepBoopVisitor) VisitImportStatement(ctx *parser.ImportStatementContext) interface{}

func (*BeepBoopVisitor) VisitImportstat

func (v *BeepBoopVisitor) VisitImportstat(ctx *parser.ImportstatContext) interface{}

func (*BeepBoopVisitor) VisitIntNum

func (v *BeepBoopVisitor) VisitIntNum(ctx *parser.IntNumContext) interface{}

func (*BeepBoopVisitor) VisitLabel

func (v *BeepBoopVisitor) VisitLabel(ctx *parser.LabelContext) interface{}

func (*BeepBoopVisitor) VisitLabelTerm

func (v *BeepBoopVisitor) VisitLabelTerm(ctx *parser.LabelTermContext) interface{}

func (*BeepBoopVisitor) VisitLetterWords

func (v *BeepBoopVisitor) VisitLetterWords(ctx *parser.LetterWordsContext) interface{}

func (*BeepBoopVisitor) VisitList

func (v *BeepBoopVisitor) VisitList(ctx *parser.ListContext) interface{}

func (*BeepBoopVisitor) VisitListTerm

func (v *BeepBoopVisitor) VisitListTerm(ctx *parser.ListTermContext) interface{}

func (*BeepBoopVisitor) VisitListterm

func (v *BeepBoopVisitor) VisitListterm(ctx *parser.ListtermContext) interface{}

func (*BeepBoopVisitor) VisitLiteralTerm

func (v *BeepBoopVisitor) VisitLiteralTerm(ctx *parser.LiteralTermContext) interface{}

func (*BeepBoopVisitor) VisitLthanCond

func (v *BeepBoopVisitor) VisitLthanCond(ctx *parser.LthanCondContext) interface{}

func (*BeepBoopVisitor) VisitLthanequalsCond

func (v *BeepBoopVisitor) VisitLthanequalsCond(ctx *parser.LthanequalsCondContext) interface{}

func (*BeepBoopVisitor) VisitMathTerm

func (v *BeepBoopVisitor) VisitMathTerm(ctx *parser.MathTermContext) interface{}

func (*BeepBoopVisitor) VisitMultFnargs

func (v *BeepBoopVisitor) VisitMultFnargs(ctx *parser.MultFnargsContext) interface{}

func (*BeepBoopVisitor) VisitMultiplicativeMath

func (v *BeepBoopVisitor) VisitMultiplicativeMath(ctx *parser.MultiplicativeMathContext) interface{}

func (*BeepBoopVisitor) VisitNewlinePipe

func (v *BeepBoopVisitor) VisitNewlinePipe(ctx *parser.NewlinePipeContext) interface{}

func (*BeepBoopVisitor) VisitNewlineStatement

func (v *BeepBoopVisitor) VisitNewlineStatement(ctx *parser.NewlineStatementContext) interface{}

func (*BeepBoopVisitor) VisitNum

func (v *BeepBoopVisitor) VisitNum(ctx *parser.NumContext) interface{}

func (*BeepBoopVisitor) VisitNumLiteral

func (v *BeepBoopVisitor) VisitNumLiteral(ctx *parser.NumLiteralContext) interface{}

func (*BeepBoopVisitor) VisitOrCond

func (v *BeepBoopVisitor) VisitOrCond(ctx *parser.OrCondContext) interface{}

func (*BeepBoopVisitor) VisitParen_fncall

func (v *BeepBoopVisitor) VisitParen_fncall(ctx *parser.Paren_fncallContext) interface{}

func (*BeepBoopVisitor) VisitParenfncallTerm

func (v *BeepBoopVisitor) VisitParenfncallTerm(ctx *parser.ParenfncallTermContext) interface{}

func (*BeepBoopVisitor) VisitPipeStatement

func (v *BeepBoopVisitor) VisitPipeStatement(ctx *parser.PipeStatementContext) interface{}

func (*BeepBoopVisitor) VisitPipeToFncallPipe

func (v *BeepBoopVisitor) VisitPipeToFncallPipe(ctx *parser.PipeToFncallPipeContext) interface{}

func (*BeepBoopVisitor) VisitPipeToPipe

func (v *BeepBoopVisitor) VisitPipeToPipe(ctx *parser.PipeToPipeContext) interface{}

func (*BeepBoopVisitor) VisitQuotedWords

func (v *BeepBoopVisitor) VisitQuotedWords(ctx *parser.QuotedWordsContext) interface{}

func (*BeepBoopVisitor) VisitReturnStatement

func (v *BeepBoopVisitor) VisitReturnStatement(ctx *parser.ReturnStatementContext) interface{}

func (*BeepBoopVisitor) VisitReturnstat

func (v *BeepBoopVisitor) VisitReturnstat(ctx *parser.ReturnstatContext) interface{}

func (*BeepBoopVisitor) VisitSoloMath

func (v *BeepBoopVisitor) VisitSoloMath(ctx *parser.SoloMathContext) interface{}

func (*BeepBoopVisitor) VisitStatementCode

func (v *BeepBoopVisitor) VisitStatementCode(ctx *parser.StatementCodeContext) interface{}

func (*BeepBoopVisitor) VisitStringWords

func (v *BeepBoopVisitor) VisitStringWords(ctx *parser.StringWordsContext) interface{}

func (*BeepBoopVisitor) VisitStructTerm

func (v *BeepBoopVisitor) VisitStructTerm(ctx *parser.StructTermContext) interface{}

func (*BeepBoopVisitor) VisitStructexpr

func (v *BeepBoopVisitor) VisitStructexpr(ctx *parser.StructexprContext) interface{}

func (*BeepBoopVisitor) VisitTermFnargs

func (v *BeepBoopVisitor) VisitTermFnargs(ctx *parser.TermFnargsContext) interface{}

func (*BeepBoopVisitor) VisitTermPipe

func (v *BeepBoopVisitor) VisitTermPipe(ctx *parser.TermPipeContext) interface{}

func (*BeepBoopVisitor) VisitTerminal

func (v *BeepBoopVisitor) VisitTerminal(node antlr.TerminalNode) interface{}

func (*BeepBoopVisitor) VisitUnarySubMath

func (v *BeepBoopVisitor) VisitUnarySubMath(ctx *parser.UnarySubMathContext) interface{}

func (*BeepBoopVisitor) VisitWordsLiteral

func (v *BeepBoopVisitor) VisitWordsLiteral(ctx *parser.WordsLiteralContext) interface{}

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

func NewFrame

func NewFrame() Frame

func (*Frame) Get

func (f *Frame) Get(key string) interface{}

func (*Frame) Set

func (f *Frame) Set(key string, value interface{})

type Function

type Function struct {
	// contains filtered or unexported fields
}

func NewFunc

func NewFunc(name string, args []string, guts parser.IFuncgutsContext) Function

type Listener

type Listener struct {
	*antlr.BaseParseTreeListener
}

func (*Listener) EnterEveryRule

func (l *Listener) EnterEveryRule(ctx antlr.ParserRuleContext)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger lets you print to a specific file instead of just stdout which can be useful for testing

func NewLogger

func NewLogger(to io.Writer) *Logger

func (*Logger) Print

func (l *Logger) Print(a ...interface{}) (n int, err error)

func (*Logger) Println

func (l *Logger) Println(a ...interface{}) (n int, err error)

type Tree

type Tree struct {
	Parent *Tree
	// contains filtered or unexported fields
}

func NewTree

func NewTree(parent *Tree) *Tree

func (*Tree) Get

func (t *Tree) Get(label string) (interface{}, error)

func (*Tree) Set

func (t *Tree) Set(label string, value interface{})

type Type

type Type int
const (
	STRING Type = iota
	BOOL
	INT
	FLOAT
	UNKNOWN
)

type Variable

type Variable struct {
	Type  Type
	Value interface{}
}

func GetVariable

func GetVariable(val interface{}) *Variable

func GetVariableFromString

func GetVariableFromString(str string) *Variable

func NewVariable

func NewVariable(t Type, val interface{}) *Variable

func (*Variable) AsFloat

func (v *Variable) AsFloat() float64

func (*Variable) AsInt

func (v *Variable) AsInt() int

func (*Variable) AsString

func (v *Variable) AsString() string

AsString forces the variable to be a string. Not a good idea to call unless you're sure.

func (*Variable) Equals

func (v *Variable) Equals(val interface{}) bool

Equals returns true if the interface matches the stored val

func (*Variable) Is

func (v *Variable) Is(t Type) bool

Is returns true if t is the same type as we've stored

func (*Variable) IsNum

func (v *Variable) IsNum() bool

func (*Variable) Minus

func (v *Variable) Minus(other *Variable) *Variable

func (*Variable) Negate

func (v *Variable) Negate() *Variable

func (*Variable) Plus

func (v *Variable) Plus(other *Variable) *Variable

Jump to

Keyboard shortcuts

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