Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/istc" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *istc.BaseistcListener } 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 := istc.NewistcLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := istc.NewistcParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.Istc() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- func NewistcLexer(input antlr.CharStream) *istcLexer
- func NewistcParser(input antlr.TokenStream) *istcParser
- type BaseistcListener
- func (s *BaseistcListener) EnterCheck(ctx *CheckContext)
- func (s *BaseistcListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseistcListener) EnterIstc(ctx *IstcContext)
- func (s *BaseistcListener) EnterRegistration(ctx *RegistrationContext)
- func (s *BaseistcListener) EnterWork(ctx *WorkContext)
- func (s *BaseistcListener) EnterYear(ctx *YearContext)
- func (s *BaseistcListener) ExitCheck(ctx *CheckContext)
- func (s *BaseistcListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseistcListener) ExitIstc(ctx *IstcContext)
- func (s *BaseistcListener) ExitRegistration(ctx *RegistrationContext)
- func (s *BaseistcListener) ExitWork(ctx *WorkContext)
- func (s *BaseistcListener) ExitYear(ctx *YearContext)
- func (s *BaseistcListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BaseistcListener) VisitTerminal(node antlr.TerminalNode)
- type CheckContext
- func (s *CheckContext) CHAR() antlr.TerminalNode
- func (s *CheckContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *CheckContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *CheckContext) GetParser() antlr.Parser
- func (s *CheckContext) GetRuleContext() antlr.RuleContext
- func (*CheckContext) IsCheckContext()
- func (s *CheckContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type ICheckContext
- type IIstcContext
- type IRegistrationContext
- type IWorkContext
- type IYearContext
- type IstcContext
- func (s *IstcContext) AllSEP() []antlr.TerminalNode
- func (s *IstcContext) Check() ICheckContext
- func (s *IstcContext) EOF() antlr.TerminalNode
- func (s *IstcContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *IstcContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *IstcContext) GetParser() antlr.Parser
- func (s *IstcContext) GetRuleContext() antlr.RuleContext
- func (*IstcContext) IsIstcContext()
- func (s *IstcContext) Registration() IRegistrationContext
- func (s *IstcContext) SEP(i int) antlr.TerminalNode
- func (s *IstcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *IstcContext) Work() IWorkContext
- func (s *IstcContext) Year() IYearContext
- type RegistrationContext
- func (s *RegistrationContext) AllCHAR() []antlr.TerminalNode
- func (s *RegistrationContext) CHAR(i int) antlr.TerminalNode
- func (s *RegistrationContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *RegistrationContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *RegistrationContext) GetParser() antlr.Parser
- func (s *RegistrationContext) GetRuleContext() antlr.RuleContext
- func (*RegistrationContext) IsRegistrationContext()
- func (s *RegistrationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type WorkContext
- func (s *WorkContext) AllCHAR() []antlr.TerminalNode
- func (s *WorkContext) CHAR(i int) antlr.TerminalNode
- func (s *WorkContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *WorkContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *WorkContext) GetParser() antlr.Parser
- func (s *WorkContext) GetRuleContext() antlr.RuleContext
- func (*WorkContext) IsWorkContext()
- func (s *WorkContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type YearContext
- func (s *YearContext) AllCHAR() []antlr.TerminalNode
- func (s *YearContext) CHAR(i int) antlr.TerminalNode
- func (s *YearContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *YearContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *YearContext) GetParser() antlr.Parser
- func (s *YearContext) GetRuleContext() antlr.RuleContext
- func (*YearContext) IsYearContext()
- func (s *YearContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewistcLexer ¶
func NewistcLexer(input antlr.CharStream) *istcLexer
func NewistcParser ¶
func NewistcParser(input antlr.TokenStream) *istcParser
Types ¶
type BaseistcListener ¶
type BaseistcListener struct{}
BaseistcListener is a complete listener for a parse tree produced by istcParser.
func (*BaseistcListener) EnterCheck ¶
func (s *BaseistcListener) EnterCheck(ctx *CheckContext)
EnterCheck is called when production check is entered.
func (*BaseistcListener) EnterEveryRule ¶
func (s *BaseistcListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BaseistcListener) EnterIstc ¶
func (s *BaseistcListener) EnterIstc(ctx *IstcContext)
EnterIstc is called when production istc is entered.
func (*BaseistcListener) EnterRegistration ¶
func (s *BaseistcListener) EnterRegistration(ctx *RegistrationContext)
EnterRegistration is called when production registration is entered.
func (*BaseistcListener) EnterWork ¶
func (s *BaseistcListener) EnterWork(ctx *WorkContext)
EnterWork is called when production work is entered.
func (*BaseistcListener) EnterYear ¶
func (s *BaseistcListener) EnterYear(ctx *YearContext)
EnterYear is called when production year is entered.
func (*BaseistcListener) ExitCheck ¶
func (s *BaseistcListener) ExitCheck(ctx *CheckContext)
ExitCheck is called when production check is exited.
func (*BaseistcListener) ExitEveryRule ¶
func (s *BaseistcListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BaseistcListener) ExitIstc ¶
func (s *BaseistcListener) ExitIstc(ctx *IstcContext)
ExitIstc is called when production istc is exited.
func (*BaseistcListener) ExitRegistration ¶
func (s *BaseistcListener) ExitRegistration(ctx *RegistrationContext)
ExitRegistration is called when production registration is exited.
func (*BaseistcListener) ExitWork ¶
func (s *BaseistcListener) ExitWork(ctx *WorkContext)
ExitWork is called when production work is exited.
func (*BaseistcListener) ExitYear ¶
func (s *BaseistcListener) ExitYear(ctx *YearContext)
ExitYear is called when production year is exited.
func (*BaseistcListener) VisitErrorNode ¶
func (s *BaseistcListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BaseistcListener) VisitTerminal ¶
func (s *BaseistcListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
type CheckContext ¶
type CheckContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewCheckContext ¶
func NewCheckContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CheckContext
func NewEmptyCheckContext ¶
func NewEmptyCheckContext() *CheckContext
func (*CheckContext) CHAR ¶
func (s *CheckContext) CHAR() antlr.TerminalNode
func (*CheckContext) EnterRule ¶
func (s *CheckContext) EnterRule(listener antlr.ParseTreeListener)
func (*CheckContext) ExitRule ¶
func (s *CheckContext) ExitRule(listener antlr.ParseTreeListener)
func (*CheckContext) GetParser ¶
func (s *CheckContext) GetParser() antlr.Parser
func (*CheckContext) GetRuleContext ¶
func (s *CheckContext) GetRuleContext() antlr.RuleContext
func (*CheckContext) IsCheckContext ¶
func (*CheckContext) IsCheckContext()
func (*CheckContext) ToStringTree ¶
func (s *CheckContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type ICheckContext ¶
type ICheckContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsCheckContext differentiates from other interfaces. IsCheckContext() }
ICheckContext is an interface to support dynamic dispatch.
type IIstcContext ¶
type IIstcContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsIstcContext differentiates from other interfaces. IsIstcContext() }
IIstcContext is an interface to support dynamic dispatch.
type IRegistrationContext ¶
type IRegistrationContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsRegistrationContext differentiates from other interfaces. IsRegistrationContext() }
IRegistrationContext is an interface to support dynamic dispatch.
type IWorkContext ¶
type IWorkContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsWorkContext differentiates from other interfaces. IsWorkContext() }
IWorkContext is an interface to support dynamic dispatch.
type IYearContext ¶
type IYearContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsYearContext differentiates from other interfaces. IsYearContext() }
IYearContext is an interface to support dynamic dispatch.
type IstcContext ¶
type IstcContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyIstcContext ¶
func NewEmptyIstcContext() *IstcContext
func NewIstcContext ¶
func NewIstcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IstcContext
func (*IstcContext) AllSEP ¶
func (s *IstcContext) AllSEP() []antlr.TerminalNode
func (*IstcContext) Check ¶
func (s *IstcContext) Check() ICheckContext
func (*IstcContext) EOF ¶
func (s *IstcContext) EOF() antlr.TerminalNode
func (*IstcContext) EnterRule ¶
func (s *IstcContext) EnterRule(listener antlr.ParseTreeListener)
func (*IstcContext) ExitRule ¶
func (s *IstcContext) ExitRule(listener antlr.ParseTreeListener)
func (*IstcContext) GetParser ¶
func (s *IstcContext) GetParser() antlr.Parser
func (*IstcContext) GetRuleContext ¶
func (s *IstcContext) GetRuleContext() antlr.RuleContext
func (*IstcContext) IsIstcContext ¶
func (*IstcContext) IsIstcContext()
func (*IstcContext) Registration ¶
func (s *IstcContext) Registration() IRegistrationContext
func (*IstcContext) SEP ¶
func (s *IstcContext) SEP(i int) antlr.TerminalNode
func (*IstcContext) ToStringTree ¶
func (s *IstcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*IstcContext) Work ¶
func (s *IstcContext) Work() IWorkContext
func (*IstcContext) Year ¶
func (s *IstcContext) Year() IYearContext
type RegistrationContext ¶
type RegistrationContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyRegistrationContext ¶
func NewEmptyRegistrationContext() *RegistrationContext
func NewRegistrationContext ¶
func NewRegistrationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RegistrationContext
func (*RegistrationContext) AllCHAR ¶
func (s *RegistrationContext) AllCHAR() []antlr.TerminalNode
func (*RegistrationContext) CHAR ¶
func (s *RegistrationContext) CHAR(i int) antlr.TerminalNode
func (*RegistrationContext) EnterRule ¶
func (s *RegistrationContext) EnterRule(listener antlr.ParseTreeListener)
func (*RegistrationContext) ExitRule ¶
func (s *RegistrationContext) ExitRule(listener antlr.ParseTreeListener)
func (*RegistrationContext) GetParser ¶
func (s *RegistrationContext) GetParser() antlr.Parser
func (*RegistrationContext) GetRuleContext ¶
func (s *RegistrationContext) GetRuleContext() antlr.RuleContext
func (*RegistrationContext) IsRegistrationContext ¶
func (*RegistrationContext) IsRegistrationContext()
func (*RegistrationContext) ToStringTree ¶
func (s *RegistrationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type WorkContext ¶
type WorkContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyWorkContext ¶
func NewEmptyWorkContext() *WorkContext
func NewWorkContext ¶
func NewWorkContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *WorkContext
func (*WorkContext) AllCHAR ¶
func (s *WorkContext) AllCHAR() []antlr.TerminalNode
func (*WorkContext) CHAR ¶
func (s *WorkContext) CHAR(i int) antlr.TerminalNode
func (*WorkContext) EnterRule ¶
func (s *WorkContext) EnterRule(listener antlr.ParseTreeListener)
func (*WorkContext) ExitRule ¶
func (s *WorkContext) ExitRule(listener antlr.ParseTreeListener)
func (*WorkContext) GetParser ¶
func (s *WorkContext) GetParser() antlr.Parser
func (*WorkContext) GetRuleContext ¶
func (s *WorkContext) GetRuleContext() antlr.RuleContext
func (*WorkContext) IsWorkContext ¶
func (*WorkContext) IsWorkContext()
func (*WorkContext) ToStringTree ¶
func (s *WorkContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type YearContext ¶
type YearContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyYearContext ¶
func NewEmptyYearContext() *YearContext
func NewYearContext ¶
func NewYearContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *YearContext
func (*YearContext) AllCHAR ¶
func (s *YearContext) AllCHAR() []antlr.TerminalNode
func (*YearContext) CHAR ¶
func (s *YearContext) CHAR(i int) antlr.TerminalNode
func (*YearContext) EnterRule ¶
func (s *YearContext) EnterRule(listener antlr.ParseTreeListener)
func (*YearContext) ExitRule ¶
func (s *YearContext) ExitRule(listener antlr.ParseTreeListener)
func (*YearContext) GetParser ¶
func (s *YearContext) GetParser() antlr.Parser
func (*YearContext) GetRuleContext ¶
func (s *YearContext) GetRuleContext() antlr.RuleContext
func (*YearContext) IsYearContext ¶
func (*YearContext) IsYearContext()
func (*YearContext) ToStringTree ¶
func (s *YearContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string