Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/lambda" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *lambda.BaselambdaListener } func (l *exampleListener) EnterEveryRule(ctx antlr.ParserRuleContext) { fmt.Println(ctx.GetText()) } func main() { // Setup the input is := antlr.NewInputStream("...some text to parse...") // Create the Lexer lexer := lambda.NewlambdaLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := lambda.NewlambdaParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.Expression() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- func NewlambdaLexer(input antlr.CharStream) *lambdaLexer
- func NewlambdaParser(input antlr.TokenStream) *lambdaParser
- type ApplicationContext
- func (s *ApplicationContext) AllExpression() []IExpressionContext
- func (s *ApplicationContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *ApplicationContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *ApplicationContext) Expression(i int) IExpressionContext
- func (s *ApplicationContext) GetParser() antlr.Parser
- func (s *ApplicationContext) GetRuleContext() antlr.RuleContext
- func (*ApplicationContext) IsApplicationContext()
- func (s *ApplicationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type BaselambdaListener
- func (s *BaselambdaListener) EnterApplication(ctx *ApplicationContext)
- func (s *BaselambdaListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaselambdaListener) EnterExpression(ctx *ExpressionContext)
- func (s *BaselambdaListener) EnterFunction(ctx *FunctionContext)
- func (s *BaselambdaListener) EnterScope(ctx *ScopeContext)
- func (s *BaselambdaListener) ExitApplication(ctx *ApplicationContext)
- func (s *BaselambdaListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaselambdaListener) ExitExpression(ctx *ExpressionContext)
- func (s *BaselambdaListener) ExitFunction(ctx *FunctionContext)
- func (s *BaselambdaListener) ExitScope(ctx *ScopeContext)
- func (s *BaselambdaListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BaselambdaListener) VisitTerminal(node antlr.TerminalNode)
- type ExpressionContext
- func (s *ExpressionContext) Application() IApplicationContext
- func (s *ExpressionContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *ExpressionContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *ExpressionContext) Function() IFunctionContext
- func (s *ExpressionContext) GetParser() antlr.Parser
- func (s *ExpressionContext) GetRuleContext() antlr.RuleContext
- func (*ExpressionContext) IsExpressionContext()
- func (s *ExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *ExpressionContext) VARIABLE() antlr.TerminalNode
- type FunctionContext
- func (s *FunctionContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *FunctionContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *FunctionContext) GetParser() antlr.Parser
- func (s *FunctionContext) GetRuleContext() antlr.RuleContext
- func (*FunctionContext) IsFunctionContext()
- func (s *FunctionContext) Scope() IScopeContext
- func (s *FunctionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *FunctionContext) VARIABLE() antlr.TerminalNode
- type IApplicationContext
- type IExpressionContext
- type IFunctionContext
- type IScopeContext
- type ScopeContext
- func (s *ScopeContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *ScopeContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *ScopeContext) Expression() IExpressionContext
- func (s *ScopeContext) GetParser() antlr.Parser
- func (s *ScopeContext) GetRuleContext() antlr.RuleContext
- func (*ScopeContext) IsScopeContext()
- func (s *ScopeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewlambdaLexer ¶
func NewlambdaLexer(input antlr.CharStream) *lambdaLexer
func NewlambdaParser ¶
func NewlambdaParser(input antlr.TokenStream) *lambdaParser
Types ¶
type ApplicationContext ¶
type ApplicationContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewApplicationContext ¶
func NewApplicationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApplicationContext
func NewEmptyApplicationContext ¶
func NewEmptyApplicationContext() *ApplicationContext
func (*ApplicationContext) AllExpression ¶
func (s *ApplicationContext) AllExpression() []IExpressionContext
func (*ApplicationContext) EnterRule ¶
func (s *ApplicationContext) EnterRule(listener antlr.ParseTreeListener)
func (*ApplicationContext) ExitRule ¶
func (s *ApplicationContext) ExitRule(listener antlr.ParseTreeListener)
func (*ApplicationContext) Expression ¶
func (s *ApplicationContext) Expression(i int) IExpressionContext
func (*ApplicationContext) GetParser ¶
func (s *ApplicationContext) GetParser() antlr.Parser
func (*ApplicationContext) GetRuleContext ¶
func (s *ApplicationContext) GetRuleContext() antlr.RuleContext
func (*ApplicationContext) IsApplicationContext ¶
func (*ApplicationContext) IsApplicationContext()
func (*ApplicationContext) ToStringTree ¶
func (s *ApplicationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type BaselambdaListener ¶
type BaselambdaListener struct{}
BaselambdaListener is a complete listener for a parse tree produced by lambdaParser.
func (*BaselambdaListener) EnterApplication ¶
func (s *BaselambdaListener) EnterApplication(ctx *ApplicationContext)
EnterApplication is called when production application is entered.
func (*BaselambdaListener) EnterEveryRule ¶
func (s *BaselambdaListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BaselambdaListener) EnterExpression ¶
func (s *BaselambdaListener) EnterExpression(ctx *ExpressionContext)
EnterExpression is called when production expression is entered.
func (*BaselambdaListener) EnterFunction ¶
func (s *BaselambdaListener) EnterFunction(ctx *FunctionContext)
EnterFunction is called when production function is entered.
func (*BaselambdaListener) EnterScope ¶
func (s *BaselambdaListener) EnterScope(ctx *ScopeContext)
EnterScope is called when production scope is entered.
func (*BaselambdaListener) ExitApplication ¶
func (s *BaselambdaListener) ExitApplication(ctx *ApplicationContext)
ExitApplication is called when production application is exited.
func (*BaselambdaListener) ExitEveryRule ¶
func (s *BaselambdaListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BaselambdaListener) ExitExpression ¶
func (s *BaselambdaListener) ExitExpression(ctx *ExpressionContext)
ExitExpression is called when production expression is exited.
func (*BaselambdaListener) ExitFunction ¶
func (s *BaselambdaListener) ExitFunction(ctx *FunctionContext)
ExitFunction is called when production function is exited.
func (*BaselambdaListener) ExitScope ¶
func (s *BaselambdaListener) ExitScope(ctx *ScopeContext)
ExitScope is called when production scope is exited.
func (*BaselambdaListener) VisitErrorNode ¶
func (s *BaselambdaListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BaselambdaListener) VisitTerminal ¶
func (s *BaselambdaListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
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) Application ¶
func (s *ExpressionContext) Application() IApplicationContext
func (*ExpressionContext) EnterRule ¶
func (s *ExpressionContext) EnterRule(listener antlr.ParseTreeListener)
func (*ExpressionContext) ExitRule ¶
func (s *ExpressionContext) ExitRule(listener antlr.ParseTreeListener)
func (*ExpressionContext) Function ¶
func (s *ExpressionContext) Function() IFunctionContext
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
func (*ExpressionContext) VARIABLE ¶
func (s *ExpressionContext) VARIABLE() antlr.TerminalNode
type FunctionContext ¶
type FunctionContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyFunctionContext ¶
func NewEmptyFunctionContext() *FunctionContext
func NewFunctionContext ¶
func NewFunctionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FunctionContext
func (*FunctionContext) EnterRule ¶
func (s *FunctionContext) EnterRule(listener antlr.ParseTreeListener)
func (*FunctionContext) ExitRule ¶
func (s *FunctionContext) ExitRule(listener antlr.ParseTreeListener)
func (*FunctionContext) GetParser ¶
func (s *FunctionContext) GetParser() antlr.Parser
func (*FunctionContext) GetRuleContext ¶
func (s *FunctionContext) GetRuleContext() antlr.RuleContext
func (*FunctionContext) IsFunctionContext ¶
func (*FunctionContext) IsFunctionContext()
func (*FunctionContext) Scope ¶
func (s *FunctionContext) Scope() IScopeContext
func (*FunctionContext) ToStringTree ¶
func (s *FunctionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*FunctionContext) VARIABLE ¶
func (s *FunctionContext) VARIABLE() antlr.TerminalNode
type IApplicationContext ¶
type IApplicationContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsApplicationContext differentiates from other interfaces. IsApplicationContext() }
IApplicationContext 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 IFunctionContext ¶
type IFunctionContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsFunctionContext differentiates from other interfaces. IsFunctionContext() }
IFunctionContext is an interface to support dynamic dispatch.
type IScopeContext ¶
type IScopeContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsScopeContext differentiates from other interfaces. IsScopeContext() }
IScopeContext is an interface to support dynamic dispatch.
type ScopeContext ¶
type ScopeContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyScopeContext ¶
func NewEmptyScopeContext() *ScopeContext
func NewScopeContext ¶
func NewScopeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ScopeContext
func (*ScopeContext) EnterRule ¶
func (s *ScopeContext) EnterRule(listener antlr.ParseTreeListener)
func (*ScopeContext) ExitRule ¶
func (s *ScopeContext) ExitRule(listener antlr.ParseTreeListener)
func (*ScopeContext) Expression ¶
func (s *ScopeContext) Expression() IExpressionContext
func (*ScopeContext) GetParser ¶
func (s *ScopeContext) GetParser() antlr.Parser
func (*ScopeContext) GetRuleContext ¶
func (s *ScopeContext) GetRuleContext() antlr.RuleContext
func (*ScopeContext) IsScopeContext ¶
func (*ScopeContext) IsScopeContext()
func (*ScopeContext) ToStringTree ¶
func (s *ScopeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string