Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/lcc" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *lcc.BaselccListener } 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 := lcc.NewlccLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := lcc.NewlccParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.Lcc() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- func NewlccLexer(input antlr.CharStream) *lccLexer
- func NewlccParser(input antlr.TokenStream) *lccParser
- type BaselccListener
- func (s *BaselccListener) EnterCutter(ctx *CutterContext)
- func (s *BaselccListener) EnterCutters(ctx *CuttersContext)
- func (s *BaselccListener) EnterDate(ctx *DateContext)
- func (s *BaselccListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaselccListener) EnterLcc(ctx *LccContext)
- func (s *BaselccListener) EnterSubclass(ctx *SubclassContext)
- func (s *BaselccListener) EnterSubclasses(ctx *SubclassesContext)
- func (s *BaselccListener) EnterSubtopic(ctx *SubtopicContext)
- func (s *BaselccListener) EnterTopic(ctx *TopicContext)
- func (s *BaselccListener) ExitCutter(ctx *CutterContext)
- func (s *BaselccListener) ExitCutters(ctx *CuttersContext)
- func (s *BaselccListener) ExitDate(ctx *DateContext)
- func (s *BaselccListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaselccListener) ExitLcc(ctx *LccContext)
- func (s *BaselccListener) ExitSubclass(ctx *SubclassContext)
- func (s *BaselccListener) ExitSubclasses(ctx *SubclassesContext)
- func (s *BaselccListener) ExitSubtopic(ctx *SubtopicContext)
- func (s *BaselccListener) ExitTopic(ctx *TopicContext)
- func (s *BaselccListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BaselccListener) VisitTerminal(node antlr.TerminalNode)
- type CutterContext
- func (s *CutterContext) AllDIGIT() []antlr.TerminalNode
- func (s *CutterContext) DIGIT(i int) antlr.TerminalNode
- func (s *CutterContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *CutterContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *CutterContext) GetParser() antlr.Parser
- func (s *CutterContext) GetRuleContext() antlr.RuleContext
- func (*CutterContext) IsCutterContext()
- func (s *CutterContext) LETTER() antlr.TerminalNode
- func (s *CutterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type CuttersContext
- func (s *CuttersContext) AllCutter() []ICutterContext
- func (s *CuttersContext) Cutter(i int) ICutterContext
- func (s *CuttersContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *CuttersContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *CuttersContext) GetParser() antlr.Parser
- func (s *CuttersContext) GetRuleContext() antlr.RuleContext
- func (*CuttersContext) IsCuttersContext()
- func (s *CuttersContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type DateContext
- func (s *DateContext) AllDIGIT() []antlr.TerminalNode
- func (s *DateContext) DIGIT(i int) antlr.TerminalNode
- func (s *DateContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *DateContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *DateContext) GetParser() antlr.Parser
- func (s *DateContext) GetRuleContext() antlr.RuleContext
- func (*DateContext) IsDateContext()
- func (s *DateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type ICutterContext
- type ICuttersContext
- type IDateContext
- type ILccContext
- type ISubclassContext
- type ISubclassesContext
- type ISubtopicContext
- type ITopicContext
- type LccContext
- func (s *LccContext) Cutters() ICuttersContext
- func (s *LccContext) Date() IDateContext
- func (s *LccContext) EOF() antlr.TerminalNode
- func (s *LccContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *LccContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *LccContext) GetParser() antlr.Parser
- func (s *LccContext) GetRuleContext() antlr.RuleContext
- func (*LccContext) IsLccContext()
- func (s *LccContext) Subclasses() ISubclassesContext
- func (s *LccContext) Subtopic() ISubtopicContext
- func (s *LccContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *LccContext) Topic() ITopicContext
- type SubclassContext
- func (s *SubclassContext) AllDIGIT() []antlr.TerminalNode
- func (s *SubclassContext) DIGIT(i int) antlr.TerminalNode
- func (s *SubclassContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *SubclassContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *SubclassContext) GetParser() antlr.Parser
- func (s *SubclassContext) GetRuleContext() antlr.RuleContext
- func (*SubclassContext) IsSubclassContext()
- func (s *SubclassContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type SubclassesContext
- func (s *SubclassesContext) AllSubclass() []ISubclassContext
- func (s *SubclassesContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *SubclassesContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *SubclassesContext) GetParser() antlr.Parser
- func (s *SubclassesContext) GetRuleContext() antlr.RuleContext
- func (*SubclassesContext) IsSubclassesContext()
- func (s *SubclassesContext) Subclass(i int) ISubclassContext
- func (s *SubclassesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type SubtopicContext
- func (s *SubtopicContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *SubtopicContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *SubtopicContext) GetParser() antlr.Parser
- func (s *SubtopicContext) GetRuleContext() antlr.RuleContext
- func (*SubtopicContext) IsSubtopicContext()
- func (s *SubtopicContext) LETTER() antlr.TerminalNode
- func (s *SubtopicContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type TopicContext
- func (s *TopicContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *TopicContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *TopicContext) GetParser() antlr.Parser
- func (s *TopicContext) GetRuleContext() antlr.RuleContext
- func (*TopicContext) IsTopicContext()
- func (s *TopicContext) LETTER() antlr.TerminalNode
- func (s *TopicContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewlccLexer ¶
func NewlccLexer(input antlr.CharStream) *lccLexer
func NewlccParser ¶
func NewlccParser(input antlr.TokenStream) *lccParser
Types ¶
type BaselccListener ¶
type BaselccListener struct{}
BaselccListener is a complete listener for a parse tree produced by lccParser.
func (*BaselccListener) EnterCutter ¶
func (s *BaselccListener) EnterCutter(ctx *CutterContext)
EnterCutter is called when production cutter is entered.
func (*BaselccListener) EnterCutters ¶
func (s *BaselccListener) EnterCutters(ctx *CuttersContext)
EnterCutters is called when production cutters is entered.
func (*BaselccListener) EnterDate ¶
func (s *BaselccListener) EnterDate(ctx *DateContext)
EnterDate is called when production date is entered.
func (*BaselccListener) EnterEveryRule ¶
func (s *BaselccListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BaselccListener) EnterLcc ¶
func (s *BaselccListener) EnterLcc(ctx *LccContext)
EnterLcc is called when production lcc is entered.
func (*BaselccListener) EnterSubclass ¶
func (s *BaselccListener) EnterSubclass(ctx *SubclassContext)
EnterSubclass is called when production subclass is entered.
func (*BaselccListener) EnterSubclasses ¶
func (s *BaselccListener) EnterSubclasses(ctx *SubclassesContext)
EnterSubclasses is called when production subclasses is entered.
func (*BaselccListener) EnterSubtopic ¶
func (s *BaselccListener) EnterSubtopic(ctx *SubtopicContext)
EnterSubtopic is called when production subtopic is entered.
func (*BaselccListener) EnterTopic ¶
func (s *BaselccListener) EnterTopic(ctx *TopicContext)
EnterTopic is called when production topic is entered.
func (*BaselccListener) ExitCutter ¶
func (s *BaselccListener) ExitCutter(ctx *CutterContext)
ExitCutter is called when production cutter is exited.
func (*BaselccListener) ExitCutters ¶
func (s *BaselccListener) ExitCutters(ctx *CuttersContext)
ExitCutters is called when production cutters is exited.
func (*BaselccListener) ExitDate ¶
func (s *BaselccListener) ExitDate(ctx *DateContext)
ExitDate is called when production date is exited.
func (*BaselccListener) ExitEveryRule ¶
func (s *BaselccListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BaselccListener) ExitLcc ¶
func (s *BaselccListener) ExitLcc(ctx *LccContext)
ExitLcc is called when production lcc is exited.
func (*BaselccListener) ExitSubclass ¶
func (s *BaselccListener) ExitSubclass(ctx *SubclassContext)
ExitSubclass is called when production subclass is exited.
func (*BaselccListener) ExitSubclasses ¶
func (s *BaselccListener) ExitSubclasses(ctx *SubclassesContext)
ExitSubclasses is called when production subclasses is exited.
func (*BaselccListener) ExitSubtopic ¶
func (s *BaselccListener) ExitSubtopic(ctx *SubtopicContext)
ExitSubtopic is called when production subtopic is exited.
func (*BaselccListener) ExitTopic ¶
func (s *BaselccListener) ExitTopic(ctx *TopicContext)
ExitTopic is called when production topic is exited.
func (*BaselccListener) VisitErrorNode ¶
func (s *BaselccListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BaselccListener) VisitTerminal ¶
func (s *BaselccListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
type CutterContext ¶
type CutterContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewCutterContext ¶
func NewCutterContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CutterContext
func NewEmptyCutterContext ¶
func NewEmptyCutterContext() *CutterContext
func (*CutterContext) AllDIGIT ¶
func (s *CutterContext) AllDIGIT() []antlr.TerminalNode
func (*CutterContext) DIGIT ¶
func (s *CutterContext) DIGIT(i int) antlr.TerminalNode
func (*CutterContext) EnterRule ¶
func (s *CutterContext) EnterRule(listener antlr.ParseTreeListener)
func (*CutterContext) ExitRule ¶
func (s *CutterContext) ExitRule(listener antlr.ParseTreeListener)
func (*CutterContext) GetParser ¶
func (s *CutterContext) GetParser() antlr.Parser
func (*CutterContext) GetRuleContext ¶
func (s *CutterContext) GetRuleContext() antlr.RuleContext
func (*CutterContext) IsCutterContext ¶
func (*CutterContext) IsCutterContext()
func (*CutterContext) LETTER ¶
func (s *CutterContext) LETTER() antlr.TerminalNode
func (*CutterContext) ToStringTree ¶
func (s *CutterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type CuttersContext ¶
type CuttersContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewCuttersContext ¶
func NewCuttersContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CuttersContext
func NewEmptyCuttersContext ¶
func NewEmptyCuttersContext() *CuttersContext
func (*CuttersContext) AllCutter ¶
func (s *CuttersContext) AllCutter() []ICutterContext
func (*CuttersContext) Cutter ¶
func (s *CuttersContext) Cutter(i int) ICutterContext
func (*CuttersContext) EnterRule ¶
func (s *CuttersContext) EnterRule(listener antlr.ParseTreeListener)
func (*CuttersContext) ExitRule ¶
func (s *CuttersContext) ExitRule(listener antlr.ParseTreeListener)
func (*CuttersContext) GetParser ¶
func (s *CuttersContext) GetParser() antlr.Parser
func (*CuttersContext) GetRuleContext ¶
func (s *CuttersContext) GetRuleContext() antlr.RuleContext
func (*CuttersContext) IsCuttersContext ¶
func (*CuttersContext) IsCuttersContext()
func (*CuttersContext) ToStringTree ¶
func (s *CuttersContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type DateContext ¶
type DateContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewDateContext ¶
func NewDateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DateContext
func NewEmptyDateContext ¶
func NewEmptyDateContext() *DateContext
func (*DateContext) AllDIGIT ¶
func (s *DateContext) AllDIGIT() []antlr.TerminalNode
func (*DateContext) DIGIT ¶
func (s *DateContext) DIGIT(i int) antlr.TerminalNode
func (*DateContext) EnterRule ¶
func (s *DateContext) EnterRule(listener antlr.ParseTreeListener)
func (*DateContext) ExitRule ¶
func (s *DateContext) ExitRule(listener antlr.ParseTreeListener)
func (*DateContext) GetParser ¶
func (s *DateContext) GetParser() antlr.Parser
func (*DateContext) GetRuleContext ¶
func (s *DateContext) GetRuleContext() antlr.RuleContext
func (*DateContext) IsDateContext ¶
func (*DateContext) IsDateContext()
func (*DateContext) ToStringTree ¶
func (s *DateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type ICutterContext ¶
type ICutterContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsCutterContext differentiates from other interfaces. IsCutterContext() }
ICutterContext is an interface to support dynamic dispatch.
type ICuttersContext ¶
type ICuttersContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsCuttersContext differentiates from other interfaces. IsCuttersContext() }
ICuttersContext is an interface to support dynamic dispatch.
type IDateContext ¶
type IDateContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsDateContext differentiates from other interfaces. IsDateContext() }
IDateContext is an interface to support dynamic dispatch.
type ILccContext ¶
type ILccContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsLccContext differentiates from other interfaces. IsLccContext() }
ILccContext is an interface to support dynamic dispatch.
type ISubclassContext ¶
type ISubclassContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsSubclassContext differentiates from other interfaces. IsSubclassContext() }
ISubclassContext is an interface to support dynamic dispatch.
type ISubclassesContext ¶
type ISubclassesContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsSubclassesContext differentiates from other interfaces. IsSubclassesContext() }
ISubclassesContext is an interface to support dynamic dispatch.
type ISubtopicContext ¶
type ISubtopicContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsSubtopicContext differentiates from other interfaces. IsSubtopicContext() }
ISubtopicContext is an interface to support dynamic dispatch.
type ITopicContext ¶
type ITopicContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsTopicContext differentiates from other interfaces. IsTopicContext() }
ITopicContext is an interface to support dynamic dispatch.
type LccContext ¶
type LccContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyLccContext ¶
func NewEmptyLccContext() *LccContext
func NewLccContext ¶
func NewLccContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LccContext
func (*LccContext) Cutters ¶
func (s *LccContext) Cutters() ICuttersContext
func (*LccContext) Date ¶
func (s *LccContext) Date() IDateContext
func (*LccContext) EOF ¶
func (s *LccContext) EOF() antlr.TerminalNode
func (*LccContext) EnterRule ¶
func (s *LccContext) EnterRule(listener antlr.ParseTreeListener)
func (*LccContext) ExitRule ¶
func (s *LccContext) ExitRule(listener antlr.ParseTreeListener)
func (*LccContext) GetParser ¶
func (s *LccContext) GetParser() antlr.Parser
func (*LccContext) GetRuleContext ¶
func (s *LccContext) GetRuleContext() antlr.RuleContext
func (*LccContext) IsLccContext ¶
func (*LccContext) IsLccContext()
func (*LccContext) Subclasses ¶
func (s *LccContext) Subclasses() ISubclassesContext
func (*LccContext) Subtopic ¶
func (s *LccContext) Subtopic() ISubtopicContext
func (*LccContext) ToStringTree ¶
func (s *LccContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*LccContext) Topic ¶
func (s *LccContext) Topic() ITopicContext
type SubclassContext ¶
type SubclassContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptySubclassContext ¶
func NewEmptySubclassContext() *SubclassContext
func NewSubclassContext ¶
func NewSubclassContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SubclassContext
func (*SubclassContext) AllDIGIT ¶
func (s *SubclassContext) AllDIGIT() []antlr.TerminalNode
func (*SubclassContext) DIGIT ¶
func (s *SubclassContext) DIGIT(i int) antlr.TerminalNode
func (*SubclassContext) EnterRule ¶
func (s *SubclassContext) EnterRule(listener antlr.ParseTreeListener)
func (*SubclassContext) ExitRule ¶
func (s *SubclassContext) ExitRule(listener antlr.ParseTreeListener)
func (*SubclassContext) GetParser ¶
func (s *SubclassContext) GetParser() antlr.Parser
func (*SubclassContext) GetRuleContext ¶
func (s *SubclassContext) GetRuleContext() antlr.RuleContext
func (*SubclassContext) IsSubclassContext ¶
func (*SubclassContext) IsSubclassContext()
func (*SubclassContext) ToStringTree ¶
func (s *SubclassContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type SubclassesContext ¶
type SubclassesContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptySubclassesContext ¶
func NewEmptySubclassesContext() *SubclassesContext
func NewSubclassesContext ¶
func NewSubclassesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SubclassesContext
func (*SubclassesContext) AllSubclass ¶
func (s *SubclassesContext) AllSubclass() []ISubclassContext
func (*SubclassesContext) EnterRule ¶
func (s *SubclassesContext) EnterRule(listener antlr.ParseTreeListener)
func (*SubclassesContext) ExitRule ¶
func (s *SubclassesContext) ExitRule(listener antlr.ParseTreeListener)
func (*SubclassesContext) GetParser ¶
func (s *SubclassesContext) GetParser() antlr.Parser
func (*SubclassesContext) GetRuleContext ¶
func (s *SubclassesContext) GetRuleContext() antlr.RuleContext
func (*SubclassesContext) IsSubclassesContext ¶
func (*SubclassesContext) IsSubclassesContext()
func (*SubclassesContext) Subclass ¶
func (s *SubclassesContext) Subclass(i int) ISubclassContext
func (*SubclassesContext) ToStringTree ¶
func (s *SubclassesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type SubtopicContext ¶
type SubtopicContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptySubtopicContext ¶
func NewEmptySubtopicContext() *SubtopicContext
func NewSubtopicContext ¶
func NewSubtopicContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SubtopicContext
func (*SubtopicContext) EnterRule ¶
func (s *SubtopicContext) EnterRule(listener antlr.ParseTreeListener)
func (*SubtopicContext) ExitRule ¶
func (s *SubtopicContext) ExitRule(listener antlr.ParseTreeListener)
func (*SubtopicContext) GetParser ¶
func (s *SubtopicContext) GetParser() antlr.Parser
func (*SubtopicContext) GetRuleContext ¶
func (s *SubtopicContext) GetRuleContext() antlr.RuleContext
func (*SubtopicContext) IsSubtopicContext ¶
func (*SubtopicContext) IsSubtopicContext()
func (*SubtopicContext) LETTER ¶
func (s *SubtopicContext) LETTER() antlr.TerminalNode
func (*SubtopicContext) ToStringTree ¶
func (s *SubtopicContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type TopicContext ¶
type TopicContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyTopicContext ¶
func NewEmptyTopicContext() *TopicContext
func NewTopicContext ¶
func NewTopicContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TopicContext
func (*TopicContext) EnterRule ¶
func (s *TopicContext) EnterRule(listener antlr.ParseTreeListener)
func (*TopicContext) ExitRule ¶
func (s *TopicContext) ExitRule(listener antlr.ParseTreeListener)
func (*TopicContext) GetParser ¶
func (s *TopicContext) GetParser() antlr.Parser
func (*TopicContext) GetRuleContext ¶
func (s *TopicContext) GetRuleContext() antlr.RuleContext
func (*TopicContext) IsTopicContext ¶
func (*TopicContext) IsTopicContext()
func (*TopicContext) LETTER ¶
func (s *TopicContext) LETTER() antlr.TerminalNode
func (*TopicContext) ToStringTree ¶
func (s *TopicContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string