Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/properties" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *properties.BasepropertiesListener } 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 := properties.NewpropertiesLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := properties.NewpropertiesParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.PropertiesFile() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- func NewpropertiesLexer(input antlr.CharStream) *propertiesLexer
- func NewpropertiesParser(input antlr.TokenStream) *propertiesParser
- type BasepropertiesListener
- func (s *BasepropertiesListener) EnterComment(ctx *CommentContext)
- func (s *BasepropertiesListener) EnterDecl(ctx *DeclContext)
- func (s *BasepropertiesListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BasepropertiesListener) EnterKey(ctx *KeyContext)
- func (s *BasepropertiesListener) EnterPropertiesFile(ctx *PropertiesFileContext)
- func (s *BasepropertiesListener) EnterRow(ctx *RowContext)
- func (s *BasepropertiesListener) EnterValue(ctx *ValueContext)
- func (s *BasepropertiesListener) ExitComment(ctx *CommentContext)
- func (s *BasepropertiesListener) ExitDecl(ctx *DeclContext)
- func (s *BasepropertiesListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BasepropertiesListener) ExitKey(ctx *KeyContext)
- func (s *BasepropertiesListener) ExitPropertiesFile(ctx *PropertiesFileContext)
- func (s *BasepropertiesListener) ExitRow(ctx *RowContext)
- func (s *BasepropertiesListener) ExitValue(ctx *ValueContext)
- func (s *BasepropertiesListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BasepropertiesListener) VisitTerminal(node antlr.TerminalNode)
- type CommentContext
- func (s *CommentContext) COMMENT() antlr.TerminalNode
- func (s *CommentContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *CommentContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *CommentContext) GetParser() antlr.Parser
- func (s *CommentContext) GetRuleContext() antlr.RuleContext
- func (*CommentContext) IsCommentContext()
- func (s *CommentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type DeclContext
- func (s *DeclContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *DeclContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *DeclContext) GetParser() antlr.Parser
- func (s *DeclContext) GetRuleContext() antlr.RuleContext
- func (*DeclContext) IsDeclContext()
- func (s *DeclContext) Key() IKeyContext
- func (s *DeclContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *DeclContext) Value() IValueContext
- type ICommentContext
- type IDeclContext
- type IKeyContext
- type IPropertiesFileContext
- type IRowContext
- type IValueContext
- type KeyContext
- func (s *KeyContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *KeyContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *KeyContext) GetParser() antlr.Parser
- func (s *KeyContext) GetRuleContext() antlr.RuleContext
- func (*KeyContext) IsKeyContext()
- func (s *KeyContext) TEXT() antlr.TerminalNode
- func (s *KeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type PropertiesFileContext
- func (s *PropertiesFileContext) AllRow() []IRowContext
- func (s *PropertiesFileContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *PropertiesFileContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *PropertiesFileContext) GetParser() antlr.Parser
- func (s *PropertiesFileContext) GetRuleContext() antlr.RuleContext
- func (*PropertiesFileContext) IsPropertiesFileContext()
- func (s *PropertiesFileContext) Row(i int) IRowContext
- func (s *PropertiesFileContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type RowContext
- func (s *RowContext) Comment() ICommentContext
- func (s *RowContext) Decl() IDeclContext
- func (s *RowContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *RowContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *RowContext) GetParser() antlr.Parser
- func (s *RowContext) GetRuleContext() antlr.RuleContext
- func (*RowContext) IsRowContext()
- func (s *RowContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type ValueContext
- func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *ValueContext) GetParser() antlr.Parser
- func (s *ValueContext) GetRuleContext() antlr.RuleContext
- func (*ValueContext) IsValueContext()
- func (s *ValueContext) STRING() antlr.TerminalNode
- func (s *ValueContext) TEXT() antlr.TerminalNode
- func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewpropertiesLexer ¶
func NewpropertiesLexer(input antlr.CharStream) *propertiesLexer
func NewpropertiesParser ¶
func NewpropertiesParser(input antlr.TokenStream) *propertiesParser
Types ¶
type BasepropertiesListener ¶
type BasepropertiesListener struct{}
BasepropertiesListener is a complete listener for a parse tree produced by propertiesParser.
func (*BasepropertiesListener) EnterComment ¶
func (s *BasepropertiesListener) EnterComment(ctx *CommentContext)
EnterComment is called when production comment is entered.
func (*BasepropertiesListener) EnterDecl ¶
func (s *BasepropertiesListener) EnterDecl(ctx *DeclContext)
EnterDecl is called when production decl is entered.
func (*BasepropertiesListener) EnterEveryRule ¶
func (s *BasepropertiesListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BasepropertiesListener) EnterKey ¶
func (s *BasepropertiesListener) EnterKey(ctx *KeyContext)
EnterKey is called when production key is entered.
func (*BasepropertiesListener) EnterPropertiesFile ¶
func (s *BasepropertiesListener) EnterPropertiesFile(ctx *PropertiesFileContext)
EnterPropertiesFile is called when production propertiesFile is entered.
func (*BasepropertiesListener) EnterRow ¶
func (s *BasepropertiesListener) EnterRow(ctx *RowContext)
EnterRow is called when production row is entered.
func (*BasepropertiesListener) EnterValue ¶
func (s *BasepropertiesListener) EnterValue(ctx *ValueContext)
EnterValue is called when production value is entered.
func (*BasepropertiesListener) ExitComment ¶
func (s *BasepropertiesListener) ExitComment(ctx *CommentContext)
ExitComment is called when production comment is exited.
func (*BasepropertiesListener) ExitDecl ¶
func (s *BasepropertiesListener) ExitDecl(ctx *DeclContext)
ExitDecl is called when production decl is exited.
func (*BasepropertiesListener) ExitEveryRule ¶
func (s *BasepropertiesListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BasepropertiesListener) ExitKey ¶
func (s *BasepropertiesListener) ExitKey(ctx *KeyContext)
ExitKey is called when production key is exited.
func (*BasepropertiesListener) ExitPropertiesFile ¶
func (s *BasepropertiesListener) ExitPropertiesFile(ctx *PropertiesFileContext)
ExitPropertiesFile is called when production propertiesFile is exited.
func (*BasepropertiesListener) ExitRow ¶
func (s *BasepropertiesListener) ExitRow(ctx *RowContext)
ExitRow is called when production row is exited.
func (*BasepropertiesListener) ExitValue ¶
func (s *BasepropertiesListener) ExitValue(ctx *ValueContext)
ExitValue is called when production value is exited.
func (*BasepropertiesListener) VisitErrorNode ¶
func (s *BasepropertiesListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BasepropertiesListener) VisitTerminal ¶
func (s *BasepropertiesListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
type CommentContext ¶
type CommentContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewCommentContext ¶
func NewCommentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CommentContext
func NewEmptyCommentContext ¶
func NewEmptyCommentContext() *CommentContext
func (*CommentContext) COMMENT ¶
func (s *CommentContext) COMMENT() antlr.TerminalNode
func (*CommentContext) EnterRule ¶
func (s *CommentContext) EnterRule(listener antlr.ParseTreeListener)
func (*CommentContext) ExitRule ¶
func (s *CommentContext) ExitRule(listener antlr.ParseTreeListener)
func (*CommentContext) GetParser ¶
func (s *CommentContext) GetParser() antlr.Parser
func (*CommentContext) GetRuleContext ¶
func (s *CommentContext) GetRuleContext() antlr.RuleContext
func (*CommentContext) IsCommentContext ¶
func (*CommentContext) IsCommentContext()
func (*CommentContext) ToStringTree ¶
func (s *CommentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type DeclContext ¶
type DeclContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewDeclContext ¶
func NewDeclContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DeclContext
func NewEmptyDeclContext ¶
func NewEmptyDeclContext() *DeclContext
func (*DeclContext) EnterRule ¶
func (s *DeclContext) EnterRule(listener antlr.ParseTreeListener)
func (*DeclContext) ExitRule ¶
func (s *DeclContext) ExitRule(listener antlr.ParseTreeListener)
func (*DeclContext) GetParser ¶
func (s *DeclContext) GetParser() antlr.Parser
func (*DeclContext) GetRuleContext ¶
func (s *DeclContext) GetRuleContext() antlr.RuleContext
func (*DeclContext) IsDeclContext ¶
func (*DeclContext) IsDeclContext()
func (*DeclContext) Key ¶
func (s *DeclContext) Key() IKeyContext
func (*DeclContext) ToStringTree ¶
func (s *DeclContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*DeclContext) Value ¶
func (s *DeclContext) Value() IValueContext
type ICommentContext ¶
type ICommentContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsCommentContext differentiates from other interfaces. IsCommentContext() }
ICommentContext is an interface to support dynamic dispatch.
type IDeclContext ¶
type IDeclContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsDeclContext differentiates from other interfaces. IsDeclContext() }
IDeclContext is an interface to support dynamic dispatch.
type IKeyContext ¶
type IKeyContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsKeyContext differentiates from other interfaces. IsKeyContext() }
IKeyContext is an interface to support dynamic dispatch.
type IPropertiesFileContext ¶
type IPropertiesFileContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsPropertiesFileContext differentiates from other interfaces. IsPropertiesFileContext() }
IPropertiesFileContext is an interface to support dynamic dispatch.
type IRowContext ¶
type IRowContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsRowContext differentiates from other interfaces. IsRowContext() }
IRowContext is an interface to support dynamic dispatch.
type IValueContext ¶
type IValueContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsValueContext differentiates from other interfaces. IsValueContext() }
IValueContext is an interface to support dynamic dispatch.
type KeyContext ¶
type KeyContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyKeyContext ¶
func NewEmptyKeyContext() *KeyContext
func NewKeyContext ¶
func NewKeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeyContext
func (*KeyContext) EnterRule ¶
func (s *KeyContext) EnterRule(listener antlr.ParseTreeListener)
func (*KeyContext) ExitRule ¶
func (s *KeyContext) ExitRule(listener antlr.ParseTreeListener)
func (*KeyContext) GetParser ¶
func (s *KeyContext) GetParser() antlr.Parser
func (*KeyContext) GetRuleContext ¶
func (s *KeyContext) GetRuleContext() antlr.RuleContext
func (*KeyContext) IsKeyContext ¶
func (*KeyContext) IsKeyContext()
func (*KeyContext) TEXT ¶
func (s *KeyContext) TEXT() antlr.TerminalNode
func (*KeyContext) ToStringTree ¶
func (s *KeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type PropertiesFileContext ¶
type PropertiesFileContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyPropertiesFileContext ¶
func NewEmptyPropertiesFileContext() *PropertiesFileContext
func NewPropertiesFileContext ¶
func NewPropertiesFileContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PropertiesFileContext
func (*PropertiesFileContext) AllRow ¶
func (s *PropertiesFileContext) AllRow() []IRowContext
func (*PropertiesFileContext) EnterRule ¶
func (s *PropertiesFileContext) EnterRule(listener antlr.ParseTreeListener)
func (*PropertiesFileContext) ExitRule ¶
func (s *PropertiesFileContext) ExitRule(listener antlr.ParseTreeListener)
func (*PropertiesFileContext) GetParser ¶
func (s *PropertiesFileContext) GetParser() antlr.Parser
func (*PropertiesFileContext) GetRuleContext ¶
func (s *PropertiesFileContext) GetRuleContext() antlr.RuleContext
func (*PropertiesFileContext) IsPropertiesFileContext ¶
func (*PropertiesFileContext) IsPropertiesFileContext()
func (*PropertiesFileContext) Row ¶
func (s *PropertiesFileContext) Row(i int) IRowContext
func (*PropertiesFileContext) ToStringTree ¶
func (s *PropertiesFileContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type RowContext ¶
type RowContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyRowContext ¶
func NewEmptyRowContext() *RowContext
func NewRowContext ¶
func NewRowContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowContext
func (*RowContext) Comment ¶
func (s *RowContext) Comment() ICommentContext
func (*RowContext) Decl ¶
func (s *RowContext) Decl() IDeclContext
func (*RowContext) EnterRule ¶
func (s *RowContext) EnterRule(listener antlr.ParseTreeListener)
func (*RowContext) ExitRule ¶
func (s *RowContext) ExitRule(listener antlr.ParseTreeListener)
func (*RowContext) GetParser ¶
func (s *RowContext) GetParser() antlr.Parser
func (*RowContext) GetRuleContext ¶
func (s *RowContext) GetRuleContext() antlr.RuleContext
func (*RowContext) IsRowContext ¶
func (*RowContext) IsRowContext()
func (*RowContext) ToStringTree ¶
func (s *RowContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type ValueContext ¶
type ValueContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyValueContext ¶
func NewEmptyValueContext() *ValueContext
func NewValueContext ¶
func NewValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueContext
func (*ValueContext) EnterRule ¶
func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener)
func (*ValueContext) ExitRule ¶
func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener)
func (*ValueContext) GetParser ¶
func (s *ValueContext) GetParser() antlr.Parser
func (*ValueContext) GetRuleContext ¶
func (s *ValueContext) GetRuleContext() antlr.RuleContext
func (*ValueContext) IsValueContext ¶
func (*ValueContext) IsValueContext()
func (*ValueContext) STRING ¶
func (s *ValueContext) STRING() antlr.TerminalNode
func (*ValueContext) TEXT ¶
func (s *ValueContext) TEXT() antlr.TerminalNode
func (*ValueContext) ToStringTree ¶
func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string