Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/upnp" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *upnp.BaseUpnpListener } 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 := upnp.NewUpnpLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := upnp.NewUpnpParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.SearchCrit() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- Constants
- type BaseUpnpListener
- func (s *BaseUpnpListener) EnterEscapedQuote(ctx *EscapedQuoteContext)
- func (s *BaseUpnpListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseUpnpListener) EnterQuotedVal(ctx *QuotedValContext)
- func (s *BaseUpnpListener) EnterRelExp(ctx *RelExpContext)
- func (s *BaseUpnpListener) EnterSearchCrit(ctx *SearchCritContext)
- func (s *BaseUpnpListener) EnterSearchExp(ctx *SearchExpContext)
- func (s *BaseUpnpListener) ExitEscapedQuote(ctx *EscapedQuoteContext)
- func (s *BaseUpnpListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseUpnpListener) ExitQuotedVal(ctx *QuotedValContext)
- func (s *BaseUpnpListener) ExitRelExp(ctx *RelExpContext)
- func (s *BaseUpnpListener) ExitSearchCrit(ctx *SearchCritContext)
- func (s *BaseUpnpListener) ExitSearchExp(ctx *SearchExpContext)
- func (s *BaseUpnpListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BaseUpnpListener) VisitTerminal(node antlr.TerminalNode)
- type EscapedQuoteContext
- func (s *EscapedQuoteContext) AllSTRING_LITERAL() []antlr.TerminalNode
- func (s *EscapedQuoteContext) AllWCHAR() []antlr.TerminalNode
- func (s *EscapedQuoteContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *EscapedQuoteContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *EscapedQuoteContext) GetParser() antlr.Parser
- func (s *EscapedQuoteContext) GetRuleContext() antlr.RuleContext
- func (*EscapedQuoteContext) IsEscapedQuoteContext()
- func (s *EscapedQuoteContext) STRING_LITERAL(i int) antlr.TerminalNode
- func (s *EscapedQuoteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *EscapedQuoteContext) WCHAR(i int) antlr.TerminalNode
- type IEscapedQuoteContext
- type IQuotedValContext
- type IRelExpContext
- type ISearchCritContext
- type ISearchExpContext
- type QuotedValContext
- func (s *QuotedValContext) AllDQUOTE() []antlr.TerminalNode
- func (s *QuotedValContext) DQUOTE(i int) antlr.TerminalNode
- func (s *QuotedValContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *QuotedValContext) EscapedQuote() IEscapedQuoteContext
- func (s *QuotedValContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *QuotedValContext) GetParser() antlr.Parser
- func (s *QuotedValContext) GetRuleContext() antlr.RuleContext
- func (*QuotedValContext) IsQuotedValContext()
- func (s *QuotedValContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type RelExpContext
- func (s *RelExpContext) AllWCHAR() []antlr.TerminalNode
- func (s *RelExpContext) BINOP() antlr.TerminalNode
- func (s *RelExpContext) BOOLVAL() antlr.TerminalNode
- func (s *RelExpContext) EXISTSOP() antlr.TerminalNode
- func (s *RelExpContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *RelExpContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *RelExpContext) GetParser() antlr.Parser
- func (s *RelExpContext) GetRuleContext() antlr.RuleContext
- func (*RelExpContext) IsRelExpContext()
- func (s *RelExpContext) PROPERTY() antlr.TerminalNode
- func (s *RelExpContext) QuotedVal() IQuotedValContext
- func (s *RelExpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *RelExpContext) WCHAR(i int) antlr.TerminalNode
- type SearchCritContext
- func (s *SearchCritContext) ASTERISK() antlr.TerminalNode
- func (s *SearchCritContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *SearchCritContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *SearchCritContext) GetParser() antlr.Parser
- func (s *SearchCritContext) GetRuleContext() antlr.RuleContext
- func (*SearchCritContext) IsSearchCritContext()
- func (s *SearchCritContext) SearchExp() ISearchExpContext
- func (s *SearchCritContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type SearchExpContext
- func (s *SearchExpContext) AllSearchExp() []ISearchExpContext
- func (s *SearchExpContext) AllWCHAR() []antlr.TerminalNode
- func (s *SearchExpContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *SearchExpContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *SearchExpContext) GetParser() antlr.Parser
- func (s *SearchExpContext) GetRuleContext() antlr.RuleContext
- func (*SearchExpContext) IsSearchExpContext()
- func (s *SearchExpContext) LOGOP() antlr.TerminalNode
- func (s *SearchExpContext) RelExp() IRelExpContext
- func (s *SearchExpContext) SearchExp(i int) ISearchExpContext
- func (s *SearchExpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *SearchExpContext) WCHAR(i int) antlr.TerminalNode
- type UpnpLexer
- type UpnpListener
- type UpnpParser
- func (p *UpnpParser) EscapedQuote() (localctx IEscapedQuoteContext)
- func (p *UpnpParser) QuotedVal() (localctx IQuotedValContext)
- func (p *UpnpParser) RelExp() (localctx IRelExpContext)
- func (p *UpnpParser) SearchCrit() (localctx ISearchCritContext)
- func (p *UpnpParser) SearchExp() (localctx ISearchExpContext)
- func (p *UpnpParser) SearchExp_Sempred(localctx antlr.RuleContext, predIndex int) bool
- func (p *UpnpParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool
Examples ¶
Constants ¶
const ( UpnpLexerT__0 = 1 UpnpLexerT__1 = 2 UpnpLexerNUMBER = 3 UpnpLexerWHITESPACE = 4 UpnpLexerLOGOP = 5 UpnpLexerBINOP = 6 UpnpLexerRELOP = 7 UpnpLexerSTRINGOP = 8 UpnpLexerEXISTSOP = 9 UpnpLexerBOOLVAL = 10 UpnpLexerWCHAR = 11 UpnpLexerPROPERTY = 12 UpnpLexerHTAB = 13 UpnpLexerSPACE = 14 UpnpLexerDQUOTE = 15 UpnpLexerASTERISK = 16 UpnpLexerSTRING_LITERAL = 17 )
UpnpLexer tokens.
const ( UpnpParserEOF = antlr.TokenEOF UpnpParserT__0 = 1 UpnpParserT__1 = 2 UpnpParserNUMBER = 3 UpnpParserWHITESPACE = 4 UpnpParserLOGOP = 5 UpnpParserBINOP = 6 UpnpParserRELOP = 7 UpnpParserSTRINGOP = 8 UpnpParserEXISTSOP = 9 UpnpParserBOOLVAL = 10 UpnpParserWCHAR = 11 UpnpParserPROPERTY = 12 UpnpParserHTAB = 13 UpnpParserSPACE = 14 UpnpParserDQUOTE = 15 UpnpParserASTERISK = 16 UpnpParserSTRING_LITERAL = 17 )
UpnpParser tokens.
const ( UpnpParserRULE_searchCrit = 0 UpnpParserRULE_searchExp = 1 UpnpParserRULE_relExp = 2 UpnpParserRULE_quotedVal = 3 UpnpParserRULE_escapedQuote = 4 )
UpnpParser rules.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseUpnpListener ¶
type BaseUpnpListener struct{}
BaseUpnpListener is a complete listener for a parse tree produced by UpnpParser.
func (*BaseUpnpListener) EnterEscapedQuote ¶
func (s *BaseUpnpListener) EnterEscapedQuote(ctx *EscapedQuoteContext)
EnterEscapedQuote is called when production escapedQuote is entered.
func (*BaseUpnpListener) EnterEveryRule ¶
func (s *BaseUpnpListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BaseUpnpListener) EnterQuotedVal ¶
func (s *BaseUpnpListener) EnterQuotedVal(ctx *QuotedValContext)
EnterQuotedVal is called when production quotedVal is entered.
func (*BaseUpnpListener) EnterRelExp ¶
func (s *BaseUpnpListener) EnterRelExp(ctx *RelExpContext)
EnterRelExp is called when production relExp is entered.
func (*BaseUpnpListener) EnterSearchCrit ¶
func (s *BaseUpnpListener) EnterSearchCrit(ctx *SearchCritContext)
EnterSearchCrit is called when production searchCrit is entered.
func (*BaseUpnpListener) EnterSearchExp ¶
func (s *BaseUpnpListener) EnterSearchExp(ctx *SearchExpContext)
EnterSearchExp is called when production searchExp is entered.
func (*BaseUpnpListener) ExitEscapedQuote ¶
func (s *BaseUpnpListener) ExitEscapedQuote(ctx *EscapedQuoteContext)
ExitEscapedQuote is called when production escapedQuote is exited.
func (*BaseUpnpListener) ExitEveryRule ¶
func (s *BaseUpnpListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BaseUpnpListener) ExitQuotedVal ¶
func (s *BaseUpnpListener) ExitQuotedVal(ctx *QuotedValContext)
ExitQuotedVal is called when production quotedVal is exited.
func (*BaseUpnpListener) ExitRelExp ¶
func (s *BaseUpnpListener) ExitRelExp(ctx *RelExpContext)
ExitRelExp is called when production relExp is exited.
func (*BaseUpnpListener) ExitSearchCrit ¶
func (s *BaseUpnpListener) ExitSearchCrit(ctx *SearchCritContext)
ExitSearchCrit is called when production searchCrit is exited.
func (*BaseUpnpListener) ExitSearchExp ¶
func (s *BaseUpnpListener) ExitSearchExp(ctx *SearchExpContext)
ExitSearchExp is called when production searchExp is exited.
func (*BaseUpnpListener) VisitErrorNode ¶
func (s *BaseUpnpListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BaseUpnpListener) VisitTerminal ¶
func (s *BaseUpnpListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
type EscapedQuoteContext ¶
type EscapedQuoteContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyEscapedQuoteContext ¶
func NewEmptyEscapedQuoteContext() *EscapedQuoteContext
func NewEscapedQuoteContext ¶
func NewEscapedQuoteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EscapedQuoteContext
func (*EscapedQuoteContext) AllSTRING_LITERAL ¶
func (s *EscapedQuoteContext) AllSTRING_LITERAL() []antlr.TerminalNode
func (*EscapedQuoteContext) AllWCHAR ¶
func (s *EscapedQuoteContext) AllWCHAR() []antlr.TerminalNode
func (*EscapedQuoteContext) EnterRule ¶
func (s *EscapedQuoteContext) EnterRule(listener antlr.ParseTreeListener)
func (*EscapedQuoteContext) ExitRule ¶
func (s *EscapedQuoteContext) ExitRule(listener antlr.ParseTreeListener)
func (*EscapedQuoteContext) GetParser ¶
func (s *EscapedQuoteContext) GetParser() antlr.Parser
func (*EscapedQuoteContext) GetRuleContext ¶
func (s *EscapedQuoteContext) GetRuleContext() antlr.RuleContext
func (*EscapedQuoteContext) IsEscapedQuoteContext ¶
func (*EscapedQuoteContext) IsEscapedQuoteContext()
func (*EscapedQuoteContext) STRING_LITERAL ¶
func (s *EscapedQuoteContext) STRING_LITERAL(i int) antlr.TerminalNode
func (*EscapedQuoteContext) ToStringTree ¶
func (s *EscapedQuoteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*EscapedQuoteContext) WCHAR ¶
func (s *EscapedQuoteContext) WCHAR(i int) antlr.TerminalNode
type IEscapedQuoteContext ¶
type IEscapedQuoteContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsEscapedQuoteContext differentiates from other interfaces. IsEscapedQuoteContext() }
IEscapedQuoteContext is an interface to support dynamic dispatch.
type IQuotedValContext ¶
type IQuotedValContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsQuotedValContext differentiates from other interfaces. IsQuotedValContext() }
IQuotedValContext is an interface to support dynamic dispatch.
type IRelExpContext ¶
type IRelExpContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsRelExpContext differentiates from other interfaces. IsRelExpContext() }
IRelExpContext is an interface to support dynamic dispatch.
type ISearchCritContext ¶
type ISearchCritContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsSearchCritContext differentiates from other interfaces. IsSearchCritContext() }
ISearchCritContext is an interface to support dynamic dispatch.
type ISearchExpContext ¶
type ISearchExpContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsSearchExpContext differentiates from other interfaces. IsSearchExpContext() }
ISearchExpContext is an interface to support dynamic dispatch.
type QuotedValContext ¶
type QuotedValContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyQuotedValContext ¶
func NewEmptyQuotedValContext() *QuotedValContext
func NewQuotedValContext ¶
func NewQuotedValContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QuotedValContext
func (*QuotedValContext) AllDQUOTE ¶
func (s *QuotedValContext) AllDQUOTE() []antlr.TerminalNode
func (*QuotedValContext) DQUOTE ¶
func (s *QuotedValContext) DQUOTE(i int) antlr.TerminalNode
func (*QuotedValContext) EnterRule ¶
func (s *QuotedValContext) EnterRule(listener antlr.ParseTreeListener)
func (*QuotedValContext) EscapedQuote ¶
func (s *QuotedValContext) EscapedQuote() IEscapedQuoteContext
func (*QuotedValContext) ExitRule ¶
func (s *QuotedValContext) ExitRule(listener antlr.ParseTreeListener)
func (*QuotedValContext) GetParser ¶
func (s *QuotedValContext) GetParser() antlr.Parser
func (*QuotedValContext) GetRuleContext ¶
func (s *QuotedValContext) GetRuleContext() antlr.RuleContext
func (*QuotedValContext) IsQuotedValContext ¶
func (*QuotedValContext) IsQuotedValContext()
func (*QuotedValContext) ToStringTree ¶
func (s *QuotedValContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type RelExpContext ¶
type RelExpContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyRelExpContext ¶
func NewEmptyRelExpContext() *RelExpContext
func NewRelExpContext ¶
func NewRelExpContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelExpContext
func (*RelExpContext) AllWCHAR ¶
func (s *RelExpContext) AllWCHAR() []antlr.TerminalNode
func (*RelExpContext) BINOP ¶
func (s *RelExpContext) BINOP() antlr.TerminalNode
func (*RelExpContext) BOOLVAL ¶
func (s *RelExpContext) BOOLVAL() antlr.TerminalNode
func (*RelExpContext) EXISTSOP ¶
func (s *RelExpContext) EXISTSOP() antlr.TerminalNode
func (*RelExpContext) EnterRule ¶
func (s *RelExpContext) EnterRule(listener antlr.ParseTreeListener)
func (*RelExpContext) ExitRule ¶
func (s *RelExpContext) ExitRule(listener antlr.ParseTreeListener)
func (*RelExpContext) GetParser ¶
func (s *RelExpContext) GetParser() antlr.Parser
func (*RelExpContext) GetRuleContext ¶
func (s *RelExpContext) GetRuleContext() antlr.RuleContext
func (*RelExpContext) IsRelExpContext ¶
func (*RelExpContext) IsRelExpContext()
func (*RelExpContext) PROPERTY ¶
func (s *RelExpContext) PROPERTY() antlr.TerminalNode
func (*RelExpContext) QuotedVal ¶
func (s *RelExpContext) QuotedVal() IQuotedValContext
func (*RelExpContext) ToStringTree ¶
func (s *RelExpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*RelExpContext) WCHAR ¶
func (s *RelExpContext) WCHAR(i int) antlr.TerminalNode
type SearchCritContext ¶
type SearchCritContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptySearchCritContext ¶
func NewEmptySearchCritContext() *SearchCritContext
func NewSearchCritContext ¶
func NewSearchCritContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SearchCritContext
func (*SearchCritContext) ASTERISK ¶
func (s *SearchCritContext) ASTERISK() antlr.TerminalNode
func (*SearchCritContext) EnterRule ¶
func (s *SearchCritContext) EnterRule(listener antlr.ParseTreeListener)
func (*SearchCritContext) ExitRule ¶
func (s *SearchCritContext) ExitRule(listener antlr.ParseTreeListener)
func (*SearchCritContext) GetParser ¶
func (s *SearchCritContext) GetParser() antlr.Parser
func (*SearchCritContext) GetRuleContext ¶
func (s *SearchCritContext) GetRuleContext() antlr.RuleContext
func (*SearchCritContext) IsSearchCritContext ¶
func (*SearchCritContext) IsSearchCritContext()
func (*SearchCritContext) SearchExp ¶
func (s *SearchCritContext) SearchExp() ISearchExpContext
func (*SearchCritContext) ToStringTree ¶
func (s *SearchCritContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type SearchExpContext ¶
type SearchExpContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptySearchExpContext ¶
func NewEmptySearchExpContext() *SearchExpContext
func NewSearchExpContext ¶
func NewSearchExpContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SearchExpContext
func (*SearchExpContext) AllSearchExp ¶
func (s *SearchExpContext) AllSearchExp() []ISearchExpContext
func (*SearchExpContext) AllWCHAR ¶
func (s *SearchExpContext) AllWCHAR() []antlr.TerminalNode
func (*SearchExpContext) EnterRule ¶
func (s *SearchExpContext) EnterRule(listener antlr.ParseTreeListener)
func (*SearchExpContext) ExitRule ¶
func (s *SearchExpContext) ExitRule(listener antlr.ParseTreeListener)
func (*SearchExpContext) GetParser ¶
func (s *SearchExpContext) GetParser() antlr.Parser
func (*SearchExpContext) GetRuleContext ¶
func (s *SearchExpContext) GetRuleContext() antlr.RuleContext
func (*SearchExpContext) IsSearchExpContext ¶
func (*SearchExpContext) IsSearchExpContext()
func (*SearchExpContext) LOGOP ¶
func (s *SearchExpContext) LOGOP() antlr.TerminalNode
func (*SearchExpContext) RelExp ¶
func (s *SearchExpContext) RelExp() IRelExpContext
func (*SearchExpContext) SearchExp ¶
func (s *SearchExpContext) SearchExp(i int) ISearchExpContext
func (*SearchExpContext) ToStringTree ¶
func (s *SearchExpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*SearchExpContext) WCHAR ¶
func (s *SearchExpContext) WCHAR(i int) antlr.TerminalNode
type UpnpLexer ¶
func NewUpnpLexer ¶
func NewUpnpLexer(input antlr.CharStream) *UpnpLexer
type UpnpListener ¶
type UpnpListener interface { antlr.ParseTreeListener // EnterSearchCrit is called when entering the searchCrit production. EnterSearchCrit(c *SearchCritContext) // EnterSearchExp is called when entering the searchExp production. EnterSearchExp(c *SearchExpContext) // EnterRelExp is called when entering the relExp production. EnterRelExp(c *RelExpContext) // EnterQuotedVal is called when entering the quotedVal production. EnterQuotedVal(c *QuotedValContext) // EnterEscapedQuote is called when entering the escapedQuote production. EnterEscapedQuote(c *EscapedQuoteContext) // ExitSearchCrit is called when exiting the searchCrit production. ExitSearchCrit(c *SearchCritContext) // ExitSearchExp is called when exiting the searchExp production. ExitSearchExp(c *SearchExpContext) // ExitRelExp is called when exiting the relExp production. ExitRelExp(c *RelExpContext) // ExitQuotedVal is called when exiting the quotedVal production. ExitQuotedVal(c *QuotedValContext) // ExitEscapedQuote is called when exiting the escapedQuote production. ExitEscapedQuote(c *EscapedQuoteContext) }
UpnpListener is a complete listener for a parse tree produced by UpnpParser.
type UpnpParser ¶
type UpnpParser struct {
*antlr.BaseParser
}
func NewUpnpParser ¶
func NewUpnpParser(input antlr.TokenStream) *UpnpParser
func (*UpnpParser) EscapedQuote ¶
func (p *UpnpParser) EscapedQuote() (localctx IEscapedQuoteContext)
func (*UpnpParser) QuotedVal ¶
func (p *UpnpParser) QuotedVal() (localctx IQuotedValContext)
func (*UpnpParser) RelExp ¶
func (p *UpnpParser) RelExp() (localctx IRelExpContext)
func (*UpnpParser) SearchCrit ¶
func (p *UpnpParser) SearchCrit() (localctx ISearchCritContext)
func (*UpnpParser) SearchExp ¶
func (p *UpnpParser) SearchExp() (localctx ISearchExpContext)
func (*UpnpParser) SearchExp_Sempred ¶
func (p *UpnpParser) SearchExp_Sempred(localctx antlr.RuleContext, predIndex int) bool
func (*UpnpParser) Sempred ¶
func (p *UpnpParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool