Documentation ¶
Overview ¶
Example ¶
package main import ( "bramp.net/antlr4/graphemes" "fmt" "github.com/antlr/antlr4/runtime/Go/antlr" ) type exampleListener struct { *graphemes.BaseGraphemesListener } 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 := graphemes.NewGraphemesLexer(is) stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) // Create the Parser p := graphemes.NewGraphemesParser(stream) p.BuildParseTrees = true p.AddErrorListener(antlr.NewDiagnosticErrorListener(true)) // Finally walk the tree tree := p.Graphemes() antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree) }
Output:
Index ¶
- Constants
- type BaseGraphemesListener
- func (s *BaseGraphemesListener) EnterEmoji_sequence(ctx *Emoji_sequenceContext)
- func (s *BaseGraphemesListener) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseGraphemesListener) EnterGrapheme_cluster(ctx *Grapheme_clusterContext)
- func (s *BaseGraphemesListener) EnterGraphemes(ctx *GraphemesContext)
- func (s *BaseGraphemesListener) ExitEmoji_sequence(ctx *Emoji_sequenceContext)
- func (s *BaseGraphemesListener) ExitEveryRule(ctx antlr.ParserRuleContext)
- func (s *BaseGraphemesListener) ExitGrapheme_cluster(ctx *Grapheme_clusterContext)
- func (s *BaseGraphemesListener) ExitGraphemes(ctx *GraphemesContext)
- func (s *BaseGraphemesListener) VisitErrorNode(node antlr.ErrorNode)
- func (s *BaseGraphemesListener) VisitTerminal(node antlr.TerminalNode)
- type Emoji_sequenceContext
- func (s *Emoji_sequenceContext) AllExtend() []antlr.TerminalNode
- func (s *Emoji_sequenceContext) AllSpacingMark() []antlr.TerminalNode
- func (s *Emoji_sequenceContext) AllZWJ() []antlr.TerminalNode
- func (s *Emoji_sequenceContext) EmojiCoreSequence() antlr.TerminalNode
- func (s *Emoji_sequenceContext) EmojiTagSequence() antlr.TerminalNode
- func (s *Emoji_sequenceContext) EmojiZWJSequence() antlr.TerminalNode
- func (s *Emoji_sequenceContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *Emoji_sequenceContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *Emoji_sequenceContext) Extend(i int) antlr.TerminalNode
- func (s *Emoji_sequenceContext) GetParser() antlr.Parser
- func (s *Emoji_sequenceContext) GetRuleContext() antlr.RuleContext
- func (*Emoji_sequenceContext) IsEmoji_sequenceContext()
- func (s *Emoji_sequenceContext) SpacingMark(i int) antlr.TerminalNode
- func (s *Emoji_sequenceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *Emoji_sequenceContext) ZWJ(i int) antlr.TerminalNode
- type Grapheme_clusterContext
- func (s *Grapheme_clusterContext) AllExtend() []antlr.TerminalNode
- func (s *Grapheme_clusterContext) AllPrepend() []antlr.TerminalNode
- func (s *Grapheme_clusterContext) AllSpacingMark() []antlr.TerminalNode
- func (s *Grapheme_clusterContext) AllZWJ() []antlr.TerminalNode
- func (s *Grapheme_clusterContext) CRLF() antlr.TerminalNode
- func (s *Grapheme_clusterContext) Emoji_sequence() IEmoji_sequenceContext
- func (s *Grapheme_clusterContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *Grapheme_clusterContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *Grapheme_clusterContext) Extend(i int) antlr.TerminalNode
- func (s *Grapheme_clusterContext) GetParser() antlr.Parser
- func (s *Grapheme_clusterContext) GetRuleContext() antlr.RuleContext
- func (s *Grapheme_clusterContext) HangulSyllable() antlr.TerminalNode
- func (*Grapheme_clusterContext) IsGrapheme_clusterContext()
- func (s *Grapheme_clusterContext) NonControl() antlr.TerminalNode
- func (s *Grapheme_clusterContext) Prepend(i int) antlr.TerminalNode
- func (s *Grapheme_clusterContext) SpacingMark(i int) antlr.TerminalNode
- func (s *Grapheme_clusterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- func (s *Grapheme_clusterContext) ZWJ(i int) antlr.TerminalNode
- type GraphemesContext
- func (s *GraphemesContext) AllGrapheme_cluster() []IGrapheme_clusterContext
- func (s *GraphemesContext) EOF() antlr.TerminalNode
- func (s *GraphemesContext) EnterRule(listener antlr.ParseTreeListener)
- func (s *GraphemesContext) ExitRule(listener antlr.ParseTreeListener)
- func (s *GraphemesContext) GetParser() antlr.Parser
- func (s *GraphemesContext) GetRuleContext() antlr.RuleContext
- func (s *GraphemesContext) Grapheme_cluster(i int) IGrapheme_clusterContext
- func (*GraphemesContext) IsGraphemesContext()
- func (s *GraphemesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
- type GraphemesLexer
- type GraphemesListener
- type GraphemesParser
- type IEmoji_sequenceContext
- type IGrapheme_clusterContext
- type IGraphemesContext
Examples ¶
Constants ¶
const ( GraphemesLexerExtend = 1 GraphemesLexerZWJ = 2 GraphemesLexerSpacingMark = 3 GraphemesLexerEmojiCoreSequence = 4 GraphemesLexerEmojiZWJSequence = 5 GraphemesLexerPrepend = 6 GraphemesLexerNonControl = 7 GraphemesLexerCRLF = 8 GraphemesLexerHangulSyllable = 9 )
GraphemesLexer tokens.
const ( GraphemesParserEOF = antlr.TokenEOF GraphemesParserExtend = 1 GraphemesParserZWJ = 2 GraphemesParserSpacingMark = 3 GraphemesParserEmojiCoreSequence = 4 GraphemesParserEmojiZWJSequence = 5 GraphemesParserPrepend = 6 GraphemesParserNonControl = 7 GraphemesParserCRLF = 8 GraphemesParserHangulSyllable = 9 GraphemesParserEmojiTagSequence = 10 )
GraphemesParser tokens.
const ( GraphemesParserRULE_emoji_sequence = 0 GraphemesParserRULE_grapheme_cluster = 1 GraphemesParserRULE_graphemes = 2 )
GraphemesParser rules.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseGraphemesListener ¶
type BaseGraphemesListener struct{}
BaseGraphemesListener is a complete listener for a parse tree produced by GraphemesParser.
func (*BaseGraphemesListener) EnterEmoji_sequence ¶
func (s *BaseGraphemesListener) EnterEmoji_sequence(ctx *Emoji_sequenceContext)
EnterEmoji_sequence is called when production emoji_sequence is entered.
func (*BaseGraphemesListener) EnterEveryRule ¶
func (s *BaseGraphemesListener) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when any rule is entered.
func (*BaseGraphemesListener) EnterGrapheme_cluster ¶
func (s *BaseGraphemesListener) EnterGrapheme_cluster(ctx *Grapheme_clusterContext)
EnterGrapheme_cluster is called when production grapheme_cluster is entered.
func (*BaseGraphemesListener) EnterGraphemes ¶
func (s *BaseGraphemesListener) EnterGraphemes(ctx *GraphemesContext)
EnterGraphemes is called when production graphemes is entered.
func (*BaseGraphemesListener) ExitEmoji_sequence ¶
func (s *BaseGraphemesListener) ExitEmoji_sequence(ctx *Emoji_sequenceContext)
ExitEmoji_sequence is called when production emoji_sequence is exited.
func (*BaseGraphemesListener) ExitEveryRule ¶
func (s *BaseGraphemesListener) ExitEveryRule(ctx antlr.ParserRuleContext)
ExitEveryRule is called when any rule is exited.
func (*BaseGraphemesListener) ExitGrapheme_cluster ¶
func (s *BaseGraphemesListener) ExitGrapheme_cluster(ctx *Grapheme_clusterContext)
ExitGrapheme_cluster is called when production grapheme_cluster is exited.
func (*BaseGraphemesListener) ExitGraphemes ¶
func (s *BaseGraphemesListener) ExitGraphemes(ctx *GraphemesContext)
ExitGraphemes is called when production graphemes is exited.
func (*BaseGraphemesListener) VisitErrorNode ¶
func (s *BaseGraphemesListener) VisitErrorNode(node antlr.ErrorNode)
VisitErrorNode is called when an error node is visited.
func (*BaseGraphemesListener) VisitTerminal ¶
func (s *BaseGraphemesListener) VisitTerminal(node antlr.TerminalNode)
VisitTerminal is called when a terminal node is visited.
type Emoji_sequenceContext ¶
type Emoji_sequenceContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmoji_sequenceContext ¶
func NewEmoji_sequenceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Emoji_sequenceContext
func NewEmptyEmoji_sequenceContext ¶
func NewEmptyEmoji_sequenceContext() *Emoji_sequenceContext
func (*Emoji_sequenceContext) AllExtend ¶
func (s *Emoji_sequenceContext) AllExtend() []antlr.TerminalNode
func (*Emoji_sequenceContext) AllSpacingMark ¶
func (s *Emoji_sequenceContext) AllSpacingMark() []antlr.TerminalNode
func (*Emoji_sequenceContext) AllZWJ ¶
func (s *Emoji_sequenceContext) AllZWJ() []antlr.TerminalNode
func (*Emoji_sequenceContext) EmojiCoreSequence ¶
func (s *Emoji_sequenceContext) EmojiCoreSequence() antlr.TerminalNode
func (*Emoji_sequenceContext) EmojiTagSequence ¶
func (s *Emoji_sequenceContext) EmojiTagSequence() antlr.TerminalNode
func (*Emoji_sequenceContext) EmojiZWJSequence ¶
func (s *Emoji_sequenceContext) EmojiZWJSequence() antlr.TerminalNode
func (*Emoji_sequenceContext) EnterRule ¶
func (s *Emoji_sequenceContext) EnterRule(listener antlr.ParseTreeListener)
func (*Emoji_sequenceContext) ExitRule ¶
func (s *Emoji_sequenceContext) ExitRule(listener antlr.ParseTreeListener)
func (*Emoji_sequenceContext) Extend ¶
func (s *Emoji_sequenceContext) Extend(i int) antlr.TerminalNode
func (*Emoji_sequenceContext) GetParser ¶
func (s *Emoji_sequenceContext) GetParser() antlr.Parser
func (*Emoji_sequenceContext) GetRuleContext ¶
func (s *Emoji_sequenceContext) GetRuleContext() antlr.RuleContext
func (*Emoji_sequenceContext) IsEmoji_sequenceContext ¶
func (*Emoji_sequenceContext) IsEmoji_sequenceContext()
func (*Emoji_sequenceContext) SpacingMark ¶
func (s *Emoji_sequenceContext) SpacingMark(i int) antlr.TerminalNode
func (*Emoji_sequenceContext) ToStringTree ¶
func (s *Emoji_sequenceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*Emoji_sequenceContext) ZWJ ¶
func (s *Emoji_sequenceContext) ZWJ(i int) antlr.TerminalNode
type Grapheme_clusterContext ¶
type Grapheme_clusterContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyGrapheme_clusterContext ¶
func NewEmptyGrapheme_clusterContext() *Grapheme_clusterContext
func NewGrapheme_clusterContext ¶
func NewGrapheme_clusterContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Grapheme_clusterContext
func (*Grapheme_clusterContext) AllExtend ¶
func (s *Grapheme_clusterContext) AllExtend() []antlr.TerminalNode
func (*Grapheme_clusterContext) AllPrepend ¶
func (s *Grapheme_clusterContext) AllPrepend() []antlr.TerminalNode
func (*Grapheme_clusterContext) AllSpacingMark ¶
func (s *Grapheme_clusterContext) AllSpacingMark() []antlr.TerminalNode
func (*Grapheme_clusterContext) AllZWJ ¶
func (s *Grapheme_clusterContext) AllZWJ() []antlr.TerminalNode
func (*Grapheme_clusterContext) CRLF ¶
func (s *Grapheme_clusterContext) CRLF() antlr.TerminalNode
func (*Grapheme_clusterContext) Emoji_sequence ¶
func (s *Grapheme_clusterContext) Emoji_sequence() IEmoji_sequenceContext
func (*Grapheme_clusterContext) EnterRule ¶
func (s *Grapheme_clusterContext) EnterRule(listener antlr.ParseTreeListener)
func (*Grapheme_clusterContext) ExitRule ¶
func (s *Grapheme_clusterContext) ExitRule(listener antlr.ParseTreeListener)
func (*Grapheme_clusterContext) Extend ¶
func (s *Grapheme_clusterContext) Extend(i int) antlr.TerminalNode
func (*Grapheme_clusterContext) GetParser ¶
func (s *Grapheme_clusterContext) GetParser() antlr.Parser
func (*Grapheme_clusterContext) GetRuleContext ¶
func (s *Grapheme_clusterContext) GetRuleContext() antlr.RuleContext
func (*Grapheme_clusterContext) HangulSyllable ¶
func (s *Grapheme_clusterContext) HangulSyllable() antlr.TerminalNode
func (*Grapheme_clusterContext) IsGrapheme_clusterContext ¶
func (*Grapheme_clusterContext) IsGrapheme_clusterContext()
func (*Grapheme_clusterContext) NonControl ¶
func (s *Grapheme_clusterContext) NonControl() antlr.TerminalNode
func (*Grapheme_clusterContext) Prepend ¶
func (s *Grapheme_clusterContext) Prepend(i int) antlr.TerminalNode
func (*Grapheme_clusterContext) SpacingMark ¶
func (s *Grapheme_clusterContext) SpacingMark(i int) antlr.TerminalNode
func (*Grapheme_clusterContext) ToStringTree ¶
func (s *Grapheme_clusterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
func (*Grapheme_clusterContext) ZWJ ¶
func (s *Grapheme_clusterContext) ZWJ(i int) antlr.TerminalNode
type GraphemesContext ¶
type GraphemesContext struct { *antlr.BaseParserRuleContext // contains filtered or unexported fields }
func NewEmptyGraphemesContext ¶
func NewEmptyGraphemesContext() *GraphemesContext
func NewGraphemesContext ¶
func NewGraphemesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GraphemesContext
func (*GraphemesContext) AllGrapheme_cluster ¶
func (s *GraphemesContext) AllGrapheme_cluster() []IGrapheme_clusterContext
func (*GraphemesContext) EOF ¶
func (s *GraphemesContext) EOF() antlr.TerminalNode
func (*GraphemesContext) EnterRule ¶
func (s *GraphemesContext) EnterRule(listener antlr.ParseTreeListener)
func (*GraphemesContext) ExitRule ¶
func (s *GraphemesContext) ExitRule(listener antlr.ParseTreeListener)
func (*GraphemesContext) GetParser ¶
func (s *GraphemesContext) GetParser() antlr.Parser
func (*GraphemesContext) GetRuleContext ¶
func (s *GraphemesContext) GetRuleContext() antlr.RuleContext
func (*GraphemesContext) Grapheme_cluster ¶
func (s *GraphemesContext) Grapheme_cluster(i int) IGrapheme_clusterContext
func (*GraphemesContext) IsGraphemesContext ¶
func (*GraphemesContext) IsGraphemesContext()
func (*GraphemesContext) ToStringTree ¶
func (s *GraphemesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string
type GraphemesLexer ¶
func NewGraphemesLexer ¶
func NewGraphemesLexer(input antlr.CharStream) *GraphemesLexer
type GraphemesListener ¶
type GraphemesListener interface { antlr.ParseTreeListener // EnterEmoji_sequence is called when entering the emoji_sequence production. EnterEmoji_sequence(c *Emoji_sequenceContext) // EnterGrapheme_cluster is called when entering the grapheme_cluster production. EnterGrapheme_cluster(c *Grapheme_clusterContext) // EnterGraphemes is called when entering the graphemes production. EnterGraphemes(c *GraphemesContext) // ExitEmoji_sequence is called when exiting the emoji_sequence production. ExitEmoji_sequence(c *Emoji_sequenceContext) // ExitGrapheme_cluster is called when exiting the grapheme_cluster production. ExitGrapheme_cluster(c *Grapheme_clusterContext) // ExitGraphemes is called when exiting the graphemes production. ExitGraphemes(c *GraphemesContext) }
GraphemesListener is a complete listener for a parse tree produced by GraphemesParser.
type GraphemesParser ¶
type GraphemesParser struct {
*antlr.BaseParser
}
func NewGraphemesParser ¶
func NewGraphemesParser(input antlr.TokenStream) *GraphemesParser
func (*GraphemesParser) Emoji_sequence ¶
func (p *GraphemesParser) Emoji_sequence() (localctx IEmoji_sequenceContext)
func (*GraphemesParser) Grapheme_cluster ¶
func (p *GraphemesParser) Grapheme_cluster() (localctx IGrapheme_clusterContext)
func (*GraphemesParser) Graphemes ¶
func (p *GraphemesParser) Graphemes() (localctx IGraphemesContext)
type IEmoji_sequenceContext ¶
type IEmoji_sequenceContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsEmoji_sequenceContext differentiates from other interfaces. IsEmoji_sequenceContext() }
IEmoji_sequenceContext is an interface to support dynamic dispatch.
type IGrapheme_clusterContext ¶
type IGrapheme_clusterContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsGrapheme_clusterContext differentiates from other interfaces. IsGrapheme_clusterContext() }
IGrapheme_clusterContext is an interface to support dynamic dispatch.
type IGraphemesContext ¶
type IGraphemesContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // IsGraphemesContext differentiates from other interfaces. IsGraphemesContext() }
IGraphemesContext is an interface to support dynamic dispatch.