yakast

package
v1.3.7-beta6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FORMATTER_MAXWIDTH               = 121
	FORMATTER_RECOMMEND_PARAM_LENGTH = 40
	FORMATTER_RECOMMEND_LINE_LENGTH  = 75
)
View Source
const (
	CreateSymbolError = "SymbolTable cannot create build-in symbol[%s]"
)
View Source
const (
	FormatterVersion = "0.1.0"
)

Variables

This section is empty.

Functions

func GetEndPosition added in v1.2.6

func GetEndPosition(t antlr.Token) (int, int)

Types

type CompilerLanguage

type CompilerLanguage string

type CompilerOptionsFun

type CompilerOptionsFun func(*YakCompiler)

type ErrorStrategy

type ErrorStrategy struct {
	antlr.DefaultErrorStrategy
}

func NewErrorStrategy

func NewErrorStrategy() *ErrorStrategy

func (*ErrorStrategy) ReportNoViableAlternative

func (e *ErrorStrategy) ReportNoViableAlternative(recognizer antlr.Parser, n *antlr.NoViableAltException)

type Position

type Position struct {
	LineNumber   int
	ColumnNumber int
}

type YakCompiler

type YakCompiler struct {
	yak.BaseYaklangParserVisitor

	FreeValues []int

	// tokenStream
	AntlrTokenStream antlr.TokenStream
	// contains filtered or unexported fields
}

func NewYakCompiler

func NewYakCompiler(options ...CompilerOptionsFun) *YakCompiler

func NewYakCompilerWithSymbolTable

func NewYakCompilerWithSymbolTable(rootSymbol *yakvm.SymbolTable, options ...CompilerOptionsFun) *YakCompiler

func (*YakCompiler) CompileSourceCodeWithPath

func (y *YakCompiler) CompileSourceCodeWithPath(code string, fPath *string) bool

func (*YakCompiler) Compiler

func (y *YakCompiler) Compiler(code string) bool

func (*YakCompiler) GetCodeIndex

func (s *YakCompiler) GetCodeIndex() int

func (*YakCompiler) GetCompileErrors

func (y *YakCompiler) GetCompileErrors() antlr4util.SourceCodeErrors

func (*YakCompiler) GetConstError

func (y *YakCompiler) GetConstError(e constError) string

func (*YakCompiler) GetErrors

func (y *YakCompiler) GetErrors() antlr4util.SourceCodeErrors

func (*YakCompiler) GetFormattedCode

func (y *YakCompiler) GetFormattedCode() string

func (*YakCompiler) GetLexerErrorListener

func (y *YakCompiler) GetLexerErrorListener() antlr.ErrorListener

func (*YakCompiler) GetLexerErrors

func (y *YakCompiler) GetLexerErrors() antlr4util.SourceCodeErrors

func (*YakCompiler) GetNextCodeIndex

func (s *YakCompiler) GetNextCodeIndex() int

func (*YakCompiler) GetNormalErrors

func (y *YakCompiler) GetNormalErrors() (bool, error)

func (*YakCompiler) GetOpcodes

func (y *YakCompiler) GetOpcodes() []*yakvm.Code

func (*YakCompiler) GetParserErrorListener

func (y *YakCompiler) GetParserErrorListener() antlr.ErrorListener

func (*YakCompiler) GetParserErrors

func (y *YakCompiler) GetParserErrors() antlr4util.SourceCodeErrors

func (*YakCompiler) GetRangeVerbose

func (y *YakCompiler) GetRangeVerbose() string

func (*YakCompiler) GetRootSymbolTable

func (y *YakCompiler) GetRootSymbolTable() *yakvm.SymbolTable

func (*YakCompiler) Init

func (y *YakCompiler) Init(lexer *yak.YaklangLexer, parser *yak.YaklangParser)

func (*YakCompiler) NewWithSymbolTable

func (y *YakCompiler) NewWithSymbolTable(rootSymbol *yakvm.SymbolTable) yakvm.CompilerWrapperInterface

func (*YakCompiler) NowInFor

func (y *YakCompiler) NowInFor() bool

func (*YakCompiler) NowInSwitch

func (y *YakCompiler) NowInSwitch() bool

func (*YakCompiler) PreviewProgram

func (y *YakCompiler) PreviewProgram(raw yak.IProgramContext) (int, *yak.StatementContext)

func (*YakCompiler) PreviewStatementList

func (y *YakCompiler) PreviewStatementList(raw yak.IStatementListContext) (int, *yak.StatementContext)

func (*YakCompiler) SetCurrentSymTable

func (y *YakCompiler) SetCurrentSymTable(tbl *yakvm.SymbolTable)

func (*YakCompiler) SetExternalVariableNames

func (y *YakCompiler) SetExternalVariableNames(extVars []string)

func (*YakCompiler) SetOpcodes

func (y *YakCompiler) SetOpcodes(codes []*yakvm.Code)

func (*YakCompiler) SetRange

func (y *YakCompiler) SetRange(b canStartStopToken) func()

SetRange 设置当前解析到的范围,用来自动关联 Opcode 的 Range

func (*YakCompiler) SetRootSymTable

func (y *YakCompiler) SetRootSymTable(tbl *yakvm.SymbolTable)

func (*YakCompiler) SetStrictMode

func (y *YakCompiler) SetStrictMode(b bool)

func (*YakCompiler) ShowOpcodes

func (y *YakCompiler) ShowOpcodes()

func (*YakCompiler) ShowOpcodesWithSource added in v1.2.3

func (y *YakCompiler) ShowOpcodesWithSource(src string)

func (*YakCompiler) SwitchCodes

func (y *YakCompiler) SwitchCodes() func()

func (*YakCompiler) SwitchSymbolTable

func (y *YakCompiler) SwitchSymbolTable(name ...string) func()

func (*YakCompiler) SwitchSymbolTableInNewScope

func (y *YakCompiler) SwitchSymbolTableInNewScope(name ...string) func()

func (*YakCompiler) TrimEos

func (y *YakCompiler) TrimEos(s string) int

func (*YakCompiler) VisitAnonymousFunctionDecl

func (y *YakCompiler) VisitAnonymousFunctionDecl(raw yak.IAnonymousFunctionDeclContext) interface{}

func (*YakCompiler) VisitAssertStmt

func (y *YakCompiler) VisitAssertStmt(raw yak.IAssertStmtContext) interface{}

func (*YakCompiler) VisitAssignExpression

func (y *YakCompiler) VisitAssignExpression(raw yak.IAssignExpressionContext) interface{}

func (*YakCompiler) VisitAssignExpressionStmt

func (y *YakCompiler) VisitAssignExpressionStmt(raw yak.IAssignExpressionStmtContext) interface{}

func (*YakCompiler) VisitBlock

func (y *YakCompiler) VisitBlock(raw yak.IBlockContext, inlineOpt ...bool) interface{}

func (*YakCompiler) VisitBlockWithCallback

func (y *YakCompiler) VisitBlockWithCallback(raw yak.IBlockContext, callback func(*YakCompiler), inlineOpt ...bool) interface{}

func (*YakCompiler) VisitBoolLiteral

func (y *YakCompiler) VisitBoolLiteral(raw yak.IBoolLiteralContext) interface{}

func (*YakCompiler) VisitCallExpr

func (y *YakCompiler) VisitCallExpr(raw yak.ICallExprContext) interface{}

func (*YakCompiler) VisitCharacterLiteral added in v1.2.8

func (y *YakCompiler) VisitCharacterLiteral(raw yak.ICharacterLiteralContext) interface{}

func (*YakCompiler) VisitDeclareAndAssignExpression added in v1.2.8

func (y *YakCompiler) VisitDeclareAndAssignExpression(raw yak.IDeclareAndAssignExpressionContext) interface{}

func (*YakCompiler) VisitDeclareVariableExpression added in v1.2.8

func (y *YakCompiler) VisitDeclareVariableExpression(raw yak.IDeclareVariableExpressionContext) interface{}

func (*YakCompiler) VisitDeclareVariableExpressionStmt added in v1.2.8

func (y *YakCompiler) VisitDeclareVariableExpressionStmt(raw yak.IDeclareVariableExpressionStmtContext) interface{}

func (*YakCompiler) VisitDeclareVariableOnly added in v1.2.8

func (y *YakCompiler) VisitDeclareVariableOnly(raw yak.IDeclareVariableOnlyContext) interface{}

func (*YakCompiler) VisitDeferStmt

func (y *YakCompiler) VisitDeferStmt(raw yak.IDeferStmtContext) interface{}

func (*YakCompiler) VisitDoc

func (y *YakCompiler) VisitDoc(raw yak.IStringLiteralContext) interface{}

func (*YakCompiler) VisitExpression

func (y *YakCompiler) VisitExpression(raw yak.IExpressionContext) interface{}

func (*YakCompiler) VisitExpressionList

func (y *YakCompiler) VisitExpressionList(raw yak.IExpressionListContext) int

func (*YakCompiler) VisitExpressionListMultiline

func (y *YakCompiler) VisitExpressionListMultiline(raw yak.IExpressionListMultilineContext) int

func (*YakCompiler) VisitExpressionStmt

func (y *YakCompiler) VisitExpressionStmt(raw yak.IExpressionStmtContext) interface{}

func (*YakCompiler) VisitForFirstExpr

func (y *YakCompiler) VisitForFirstExpr(raw yak.IForFirstExprContext) interface{}

func (*YakCompiler) VisitForRangeStmt

func (y *YakCompiler) VisitForRangeStmt(raw yak.IForRangeStmtContext) interface{}

func (*YakCompiler) VisitForStmt

func (y *YakCompiler) VisitForStmt(raw yak.IForStmtContext) interface{}

func (*YakCompiler) VisitForThirdExpr

func (y *YakCompiler) VisitForThirdExpr(raw yak.IForThirdExprContext) interface{}

func (*YakCompiler) VisitFunctionCall

func (y *YakCompiler) VisitFunctionCall(raw yak.IFunctionCallContext) interface{}

func (*YakCompiler) VisitFunctionCallExpr

func (y *YakCompiler) VisitFunctionCallExpr(raw yak.IFunctionCallExprContext) interface{}

func (*YakCompiler) VisitFunctionParamDecl

func (y *YakCompiler) VisitFunctionParamDecl(raw yak.IFunctionParamDeclContext) ([]int, bool)

func (*YakCompiler) VisitGoStmt

func (y *YakCompiler) VisitGoStmt(raw yak.IGoStmtContext) interface{}

func (*YakCompiler) VisitIfStmt

func (y *YakCompiler) VisitIfStmt(raw yak.IIfStmtContext) interface{}

func (*YakCompiler) VisitIncludeStmt

func (y *YakCompiler) VisitIncludeStmt(raw yak.IIncludeStmtContext) interface{}

func (*YakCompiler) VisitInstanceCode

func (y *YakCompiler) VisitInstanceCode(raw yak.IInstanceCodeContext) interface{}

func (*YakCompiler) VisitLeftExpression

func (y *YakCompiler) VisitLeftExpression(forceNewSymbol bool, raw yak.ILeftExpressionContext) interface{}

func (*YakCompiler) VisitLeftExpressionList

func (y *YakCompiler) VisitLeftExpressionList(forceNewSymbol bool, raw yak.ILeftExpressionListContext) int

func (*YakCompiler) VisitLeftMemberCall

func (y *YakCompiler) VisitLeftMemberCall(raw yak.ILeftMemberCallContext) interface{}

func (*YakCompiler) VisitLeftSliceCall

func (y *YakCompiler) VisitLeftSliceCall(raw yak.ILeftSliceCallContext) interface{}

func (*YakCompiler) VisitLineCommentStmt

func (y *YakCompiler) VisitLineCommentStmt(i *yak.LineCommentStmtContext) interface{}

func (*YakCompiler) VisitLiteral

func (y *YakCompiler) VisitLiteral(raw yak.ILiteralContext) interface{}

func (*YakCompiler) VisitMakeExpression

func (y *YakCompiler) VisitMakeExpression(raw yak.IMakeExpressionContext) interface{}

func (*YakCompiler) VisitMapLiteral

func (y *YakCompiler) VisitMapLiteral(raw yak.IMapLiteralContext) interface{}

func (*YakCompiler) VisitMapTypeLiteral

func (y *YakCompiler) VisitMapTypeLiteral(raw yak.IMapTypeLiteralContext) interface{}

func (*YakCompiler) VisitMapTypedLiteral

func (y *YakCompiler) VisitMapTypedLiteral(raw yak.IMapTypedLiteralContext) interface{}

func (*YakCompiler) VisitMemberCall

func (y *YakCompiler) VisitMemberCall(raw parser.IMemberCallContext) interface{}

func (*YakCompiler) VisitNumericLiteral

func (y *YakCompiler) VisitNumericLiteral(raw yak.INumericLiteralContext) interface{}

func (*YakCompiler) VisitOrdinaryArguments

func (y *YakCompiler) VisitOrdinaryArguments(raw yak.IOrdinaryArgumentsContext) (int, bool)

func (*YakCompiler) VisitPanicStmt

func (y *YakCompiler) VisitPanicStmt(raw yak.IPanicStmtContext)

func (*YakCompiler) VisitProgram

func (y *YakCompiler) VisitProgram(raw yak.IProgramContext, inline ...bool) interface{}

func (*YakCompiler) VisitProgramWithoutSymbolTable

func (y *YakCompiler) VisitProgramWithoutSymbolTable(raw yak.IProgramContext, inline ...bool) interface{}

func (*YakCompiler) VisitRecoverStmt

func (y *YakCompiler) VisitRecoverStmt(raw yak.IRecoverStmtContext)

func (*YakCompiler) VisitReturnStmt

func (y *YakCompiler) VisitReturnStmt(raw yak.IReturnStmtContext) interface{}

func (*YakCompiler) VisitSliceCall

func (y *YakCompiler) VisitSliceCall(raw yak.ISliceCallContext) interface{}

func (*YakCompiler) VisitSliceLiteral

func (y *YakCompiler) VisitSliceLiteral(raw yak.ISliceLiteralContext) interface{}

func (*YakCompiler) VisitSliceTypeLiteral

func (y *YakCompiler) VisitSliceTypeLiteral(raw yak.ISliceTypeLiteralContext) interface{}

func (*YakCompiler) VisitSliceTypedLiteral

func (y *YakCompiler) VisitSliceTypedLiteral(raw yak.ISliceTypedLiteralContext) interface{}

func (*YakCompiler) VisitStatement

func (y *YakCompiler) VisitStatement(i *yak.StatementContext) (newLine bool)

func (*YakCompiler) VisitStatementList

func (y *YakCompiler) VisitStatementList(raw yak.IStatementListContext, inline ...bool) interface{}

func (*YakCompiler) VisitStringLiteral

func (y *YakCompiler) VisitStringLiteral(raw yak.IStringLiteralContext) interface{}

func (*YakCompiler) VisitSwitchStmt

func (y *YakCompiler) VisitSwitchStmt(raw yak.ISwitchStmtContext) interface{}

func (*YakCompiler) VisitTemplateStringLiteral

func (y *YakCompiler) VisitTemplateStringLiteral(raw yak.ITemplateStringLiteralContext) interface{}

func (*YakCompiler) VisitTryStmt

func (y *YakCompiler) VisitTryStmt(raw yak.ITryStmtContext) interface{}

func (*YakCompiler) VisitTypeLiteral

func (y *YakCompiler) VisitTypeLiteral(raw yak.ITypeLiteralContext) interface{}

Jump to

Keyboard shortcuts

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