parser

package
v0.0.0-...-a6f2f8b Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageALexerEqual           = 1
	LanguageALexerAdd             = 2
	LanguageALexerSubtract        = 3
	LanguageALexerMultiply        = 4
	LanguageALexerDivide          = 5
	LanguageALexerIdentifier      = 6
	LanguageALexerFloatConstant   = 7
	LanguageALexerIntegerConstant = 8
	LanguageALexerWhitespace      = 9
	LanguageALexerNewline         = 10
)

LanguageALexer tokens.

View Source
const (
	LanguageAParserEOF             = antlr.TokenEOF
	LanguageAParserEqual           = 1
	LanguageAParserAdd             = 2
	LanguageAParserSubtract        = 3
	LanguageAParserMultiply        = 4
	LanguageAParserDivide          = 5
	LanguageAParserIdentifier      = 6
	LanguageAParserFloatConstant   = 7
	LanguageAParserIntegerConstant = 8
	LanguageAParserWhitespace      = 9
	LanguageAParserNewline         = 10
)

LanguageAParser tokens.

View Source
const (
	LanguageAParserRULE_translation         = 0
	LanguageAParserRULE_topLevelStatement   = 1
	LanguageAParserRULE_variableDeclaration = 2
	LanguageAParserRULE_expression          = 3
	LanguageAParserRULE_binaryOperator      = 4
)

LanguageAParser rules.

Variables

This section is empty.

Functions

func LanguageALexerInit

func LanguageALexerInit()

LanguageALexerInit initializes any static state used to implement LanguageALexer. By default the static state used to implement the lexer is lazily initialized during the first call to NewLanguageALexer(). You can call this function if you wish to initialize the static state ahead of time.

func LanguageAParserInit

func LanguageAParserInit()

LanguageAParserInit initializes any static state used to implement LanguageAParser. By default the static state used to implement the parser is lazily initialized during the first call to NewLanguageAParser(). You can call this function if you wish to initialize the static state ahead of time.

Types

type BaseLanguageAVisitor

type BaseLanguageAVisitor struct {
	*antlr.BaseParseTreeVisitor
}

func (*BaseLanguageAVisitor) VisitBinaryOperator

func (v *BaseLanguageAVisitor) VisitBinaryOperator(ctx *BinaryOperatorContext) interface{}

func (*BaseLanguageAVisitor) VisitExpressionBinary

func (v *BaseLanguageAVisitor) VisitExpressionBinary(ctx *ExpressionBinaryContext) interface{}

func (*BaseLanguageAVisitor) VisitExpressionConstant

func (v *BaseLanguageAVisitor) VisitExpressionConstant(ctx *ExpressionConstantContext) interface{}

func (*BaseLanguageAVisitor) VisitTopLevelStatement

func (v *BaseLanguageAVisitor) VisitTopLevelStatement(ctx *TopLevelStatementContext) interface{}

func (*BaseLanguageAVisitor) VisitTranslation

func (v *BaseLanguageAVisitor) VisitTranslation(ctx *TranslationContext) interface{}

func (*BaseLanguageAVisitor) VisitVariableDeclaration

func (v *BaseLanguageAVisitor) VisitVariableDeclaration(ctx *VariableDeclarationContext) interface{}

type BinaryOperatorContext

type BinaryOperatorContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewBinaryOperatorContext

func NewBinaryOperatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BinaryOperatorContext

func NewEmptyBinaryOperatorContext

func NewEmptyBinaryOperatorContext() *BinaryOperatorContext

func (*BinaryOperatorContext) Accept

func (s *BinaryOperatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*BinaryOperatorContext) Add

func (*BinaryOperatorContext) Divide

func (*BinaryOperatorContext) GetParser

func (s *BinaryOperatorContext) GetParser() antlr.Parser

func (*BinaryOperatorContext) GetRuleContext

func (s *BinaryOperatorContext) GetRuleContext() antlr.RuleContext

func (*BinaryOperatorContext) IsBinaryOperatorContext

func (*BinaryOperatorContext) IsBinaryOperatorContext()

func (*BinaryOperatorContext) Multiply

func (*BinaryOperatorContext) Subtract

func (*BinaryOperatorContext) ToStringTree

func (s *BinaryOperatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type ExpressionBinaryContext

type ExpressionBinaryContext struct {
	*ExpressionContext
}

func NewExpressionBinaryContext

func NewExpressionBinaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *ExpressionBinaryContext

func (*ExpressionBinaryContext) Accept

func (s *ExpressionBinaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*ExpressionBinaryContext) AllExpression

func (s *ExpressionBinaryContext) AllExpression() []IExpressionContext

func (*ExpressionBinaryContext) BinaryOperator

func (s *ExpressionBinaryContext) BinaryOperator() IBinaryOperatorContext

func (*ExpressionBinaryContext) Expression

func (*ExpressionBinaryContext) GetRuleContext

func (s *ExpressionBinaryContext) GetRuleContext() antlr.RuleContext

type ExpressionConstantContext

type ExpressionConstantContext struct {
	*ExpressionContext
}

func NewExpressionConstantContext

func NewExpressionConstantContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *ExpressionConstantContext

func (*ExpressionConstantContext) Accept

func (s *ExpressionConstantContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*ExpressionConstantContext) FloatConstant

func (s *ExpressionConstantContext) FloatConstant() antlr.TerminalNode

func (*ExpressionConstantContext) GetRuleContext

func (s *ExpressionConstantContext) GetRuleContext() antlr.RuleContext

func (*ExpressionConstantContext) IntegerConstant

func (s *ExpressionConstantContext) IntegerConstant() antlr.TerminalNode

type ExpressionContext

type ExpressionContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyExpressionContext

func NewEmptyExpressionContext() *ExpressionContext

func NewExpressionContext

func NewExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExpressionContext

func (*ExpressionContext) CopyFrom

func (s *ExpressionContext) CopyFrom(ctx *ExpressionContext)

func (*ExpressionContext) GetParser

func (s *ExpressionContext) GetParser() antlr.Parser

func (*ExpressionContext) GetRuleContext

func (s *ExpressionContext) GetRuleContext() antlr.RuleContext

func (*ExpressionContext) IsExpressionContext

func (*ExpressionContext) IsExpressionContext()

func (*ExpressionContext) ToStringTree

func (s *ExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type IBinaryOperatorContext

type IBinaryOperatorContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsBinaryOperatorContext differentiates from other interfaces.
	IsBinaryOperatorContext()
}

IBinaryOperatorContext is an interface to support dynamic dispatch.

type IExpressionContext

type IExpressionContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsExpressionContext differentiates from other interfaces.
	IsExpressionContext()
}

IExpressionContext is an interface to support dynamic dispatch.

type ITopLevelStatementContext

type ITopLevelStatementContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsTopLevelStatementContext differentiates from other interfaces.
	IsTopLevelStatementContext()
}

ITopLevelStatementContext is an interface to support dynamic dispatch.

type ITranslationContext

type ITranslationContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsTranslationContext differentiates from other interfaces.
	IsTranslationContext()
}

ITranslationContext is an interface to support dynamic dispatch.

type IVariableDeclarationContext

type IVariableDeclarationContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsVariableDeclarationContext differentiates from other interfaces.
	IsVariableDeclarationContext()
}

IVariableDeclarationContext is an interface to support dynamic dispatch.

type LanguageALexer

type LanguageALexer struct {
	*antlr.BaseLexer
	// contains filtered or unexported fields
}

func NewLanguageALexer

func NewLanguageALexer(input antlr.CharStream) *LanguageALexer

NewLanguageALexer produces a new lexer instance for the optional input antlr.CharStream.

type LanguageAParser

type LanguageAParser struct {
	*antlr.BaseParser
}

func NewLanguageAParser

func NewLanguageAParser(input antlr.TokenStream) *LanguageAParser

NewLanguageAParser produces a new parser instance for the optional input antlr.TokenStream.

func (*LanguageAParser) BinaryOperator

func (p *LanguageAParser) BinaryOperator() (localctx IBinaryOperatorContext)

func (*LanguageAParser) Expression

func (p *LanguageAParser) Expression() (localctx IExpressionContext)

func (*LanguageAParser) Expression_Sempred

func (p *LanguageAParser) Expression_Sempred(localctx antlr.RuleContext, predIndex int) bool

func (*LanguageAParser) Sempred

func (p *LanguageAParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool

func (*LanguageAParser) TopLevelStatement

func (p *LanguageAParser) TopLevelStatement() (localctx ITopLevelStatementContext)

func (*LanguageAParser) Translation

func (p *LanguageAParser) Translation() (localctx ITranslationContext)

func (*LanguageAParser) VariableDeclaration

func (p *LanguageAParser) VariableDeclaration() (localctx IVariableDeclarationContext)

type LanguageAVisitor

type LanguageAVisitor interface {
	antlr.ParseTreeVisitor

	// Visit a parse tree produced by LanguageAParser#translation.
	VisitTranslation(ctx *TranslationContext) interface{}

	// Visit a parse tree produced by LanguageAParser#topLevelStatement.
	VisitTopLevelStatement(ctx *TopLevelStatementContext) interface{}

	// Visit a parse tree produced by LanguageAParser#variableDeclaration.
	VisitVariableDeclaration(ctx *VariableDeclarationContext) interface{}

	// Visit a parse tree produced by LanguageAParser#ExpressionBinary.
	VisitExpressionBinary(ctx *ExpressionBinaryContext) interface{}

	// Visit a parse tree produced by LanguageAParser#ExpressionConstant.
	VisitExpressionConstant(ctx *ExpressionConstantContext) interface{}

	// Visit a parse tree produced by LanguageAParser#binaryOperator.
	VisitBinaryOperator(ctx *BinaryOperatorContext) interface{}
}

A complete Visitor for a parse tree produced by LanguageAParser.

type TopLevelStatementContext

type TopLevelStatementContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyTopLevelStatementContext

func NewEmptyTopLevelStatementContext() *TopLevelStatementContext

func NewTopLevelStatementContext

func NewTopLevelStatementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TopLevelStatementContext

func (*TopLevelStatementContext) Accept

func (s *TopLevelStatementContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*TopLevelStatementContext) GetParser

func (s *TopLevelStatementContext) GetParser() antlr.Parser

func (*TopLevelStatementContext) GetRuleContext

func (s *TopLevelStatementContext) GetRuleContext() antlr.RuleContext

func (*TopLevelStatementContext) IsTopLevelStatementContext

func (*TopLevelStatementContext) IsTopLevelStatementContext()

func (*TopLevelStatementContext) ToStringTree

func (s *TopLevelStatementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*TopLevelStatementContext) VariableDeclaration

func (s *TopLevelStatementContext) VariableDeclaration() IVariableDeclarationContext

type TranslationContext

type TranslationContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyTranslationContext

func NewEmptyTranslationContext() *TranslationContext

func NewTranslationContext

func NewTranslationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TranslationContext

func (*TranslationContext) Accept

func (s *TranslationContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*TranslationContext) AllTopLevelStatement

func (s *TranslationContext) AllTopLevelStatement() []ITopLevelStatementContext

func (*TranslationContext) GetParser

func (s *TranslationContext) GetParser() antlr.Parser

func (*TranslationContext) GetRuleContext

func (s *TranslationContext) GetRuleContext() antlr.RuleContext

func (*TranslationContext) IsTranslationContext

func (*TranslationContext) IsTranslationContext()

func (*TranslationContext) ToStringTree

func (s *TranslationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*TranslationContext) TopLevelStatement

func (s *TranslationContext) TopLevelStatement(i int) ITopLevelStatementContext

type VariableDeclarationContext

type VariableDeclarationContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyVariableDeclarationContext

func NewEmptyVariableDeclarationContext() *VariableDeclarationContext

func NewVariableDeclarationContext

func NewVariableDeclarationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VariableDeclarationContext

func (*VariableDeclarationContext) Accept

func (s *VariableDeclarationContext) Accept(visitor antlr.ParseTreeVisitor) interface{}

func (*VariableDeclarationContext) Equal

func (*VariableDeclarationContext) Expression

func (*VariableDeclarationContext) GetParser

func (s *VariableDeclarationContext) GetParser() antlr.Parser

func (*VariableDeclarationContext) GetRuleContext

func (s *VariableDeclarationContext) GetRuleContext() antlr.RuleContext

func (*VariableDeclarationContext) Identifier

func (*VariableDeclarationContext) IsVariableDeclarationContext

func (*VariableDeclarationContext) IsVariableDeclarationContext()

func (*VariableDeclarationContext) ToStringTree

func (s *VariableDeclarationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

Jump to

Keyboard shortcuts

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