parser

package
v0.0.0-...-aed1f37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RewriteLexerT__0 = 1
	RewriteLexerT__1 = 2
	RewriteLexerT__2 = 3
	RewriteLexerT__3 = 4
	RewriteLexerT__4 = 5
	RewriteLexerT__5 = 6
	RewriteLexerT__6 = 7
	RewriteLexerT__7 = 8
	RewriteLexerT__8 = 9
	RewriteLexerID   = 10
	RewriteLexerWS   = 11
)

RewriteLexer tokens.

View Source
const (
	RewriteParserEOF  = antlr.TokenEOF
	RewriteParserT__0 = 1
	RewriteParserT__1 = 2
	RewriteParserT__2 = 3
	RewriteParserT__3 = 4
	RewriteParserT__4 = 5
	RewriteParserT__5 = 6
	RewriteParserT__6 = 7
	RewriteParserT__7 = 8
	RewriteParserT__8 = 9
	RewriteParserID   = 10
	RewriteParserWS   = 11
)

RewriteParser tokens.

View Source
const (
	RewriteParserRULE_term    = 0
	RewriteParserRULE_rewrite = 1
)

RewriteParser rules.

Variables

View Source
var RewriteLexerLexerStaticData struct {
	ChannelNames           []string
	ModeNames              []string
	LiteralNames           []string
	SymbolicNames          []string
	RuleNames              []string
	PredictionContextCache *antlr.PredictionContextCache
	// contains filtered or unexported fields
}
View Source
var RewriteParserStaticData struct {
	LiteralNames           []string
	SymbolicNames          []string
	RuleNames              []string
	PredictionContextCache *antlr.PredictionContextCache
	// contains filtered or unexported fields
}

Functions

func InitEmptyRewriteContext

func InitEmptyRewriteContext(p *RewriteContext)

func InitEmptyTermContext

func InitEmptyTermContext(p *TermContext)

func RewriteLexerInit

func RewriteLexerInit()

RewriteLexerInit initializes any static state used to implement RewriteLexer. By default the static state used to implement the lexer is lazily initialized during the first call to NewRewriteLexer(). You can call this function if you wish to initialize the static state ahead of time.

func RewriteParserInit

func RewriteParserInit()

RewriteParserInit initializes any static state used to implement RewriteParser. By default the static state used to implement the parser is lazily initialized during the first call to NewRewriteParser(). You can call this function if you wish to initialize the static state ahead of time.

Types

type BaseRewriteListener

type BaseRewriteListener struct{}

BaseRewriteListener is a complete listener for a parse tree produced by RewriteParser.

func (*BaseRewriteListener) EnterEveryRule

func (s *BaseRewriteListener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule is called when any rule is entered.

func (*BaseRewriteListener) EnterRewrite

func (s *BaseRewriteListener) EnterRewrite(ctx *RewriteContext)

EnterRewrite is called when production rewrite is entered.

func (*BaseRewriteListener) EnterTerm

func (s *BaseRewriteListener) EnterTerm(ctx *TermContext)

EnterTerm is called when production term is entered.

func (*BaseRewriteListener) ExitEveryRule

func (s *BaseRewriteListener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule is called when any rule is exited.

func (*BaseRewriteListener) ExitRewrite

func (s *BaseRewriteListener) ExitRewrite(ctx *RewriteContext)

ExitRewrite is called when production rewrite is exited.

func (*BaseRewriteListener) ExitTerm

func (s *BaseRewriteListener) ExitTerm(ctx *TermContext)

ExitTerm is called when production term is exited.

func (*BaseRewriteListener) VisitErrorNode

func (s *BaseRewriteListener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode is called when an error node is visited.

func (*BaseRewriteListener) VisitTerminal

func (s *BaseRewriteListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type IRewriteContext

type IRewriteContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	AllID() []antlr.TerminalNode
	ID(i int) antlr.TerminalNode
	AllRewrite() []IRewriteContext
	Rewrite(i int) IRewriteContext

	// IsRewriteContext differentiates from other interfaces.
	IsRewriteContext()
}

IRewriteContext is an interface to support dynamic dispatch.

type ITermContext

type ITermContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Rewrite() IRewriteContext
	EOF() antlr.TerminalNode

	// IsTermContext differentiates from other interfaces.
	IsTermContext()
}

ITermContext is an interface to support dynamic dispatch.

type RewriteContext

type RewriteContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRewriteContext

func NewEmptyRewriteContext() *RewriteContext

func NewRewriteContext

func NewRewriteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RewriteContext

func (*RewriteContext) AllID

func (s *RewriteContext) AllID() []antlr.TerminalNode

func (*RewriteContext) AllRewrite

func (s *RewriteContext) AllRewrite() []IRewriteContext

func (*RewriteContext) EnterRule

func (s *RewriteContext) EnterRule(listener antlr.ParseTreeListener)

func (*RewriteContext) ExitRule

func (s *RewriteContext) ExitRule(listener antlr.ParseTreeListener)

func (*RewriteContext) GetParser

func (s *RewriteContext) GetParser() antlr.Parser

func (*RewriteContext) GetRuleContext

func (s *RewriteContext) GetRuleContext() antlr.RuleContext

func (*RewriteContext) ID

func (s *RewriteContext) ID(i int) antlr.TerminalNode

func (*RewriteContext) IsRewriteContext

func (*RewriteContext) IsRewriteContext()

func (*RewriteContext) Rewrite

func (s *RewriteContext) Rewrite(i int) IRewriteContext

func (*RewriteContext) ToStringTree

func (s *RewriteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type RewriteLexer

type RewriteLexer struct {
	*antlr.BaseLexer
	// contains filtered or unexported fields
}

func NewRewriteLexer

func NewRewriteLexer(input antlr.CharStream) *RewriteLexer

NewRewriteLexer produces a new lexer instance for the optional input antlr.CharStream.

type RewriteListener

type RewriteListener interface {
	antlr.ParseTreeListener

	// EnterTerm is called when entering the term production.
	EnterTerm(c *TermContext)

	// EnterRewrite is called when entering the rewrite production.
	EnterRewrite(c *RewriteContext)

	// ExitTerm is called when exiting the term production.
	ExitTerm(c *TermContext)

	// ExitRewrite is called when exiting the rewrite production.
	ExitRewrite(c *RewriteContext)
}

RewriteListener is a complete listener for a parse tree produced by RewriteParser.

type RewriteParser

type RewriteParser struct {
	*antlr.BaseParser
}

func NewRewriteParser

func NewRewriteParser(input antlr.TokenStream) *RewriteParser

NewRewriteParser produces a new parser instance for the optional input antlr.TokenStream.

func (*RewriteParser) Rewrite

func (p *RewriteParser) Rewrite() (localctx IRewriteContext)

func (*RewriteParser) Term

func (p *RewriteParser) Term() (localctx ITermContext)

type TermContext

type TermContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyTermContext

func NewEmptyTermContext() *TermContext

func NewTermContext

func NewTermContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TermContext

func (*TermContext) EOF

func (s *TermContext) EOF() antlr.TerminalNode

func (*TermContext) EnterRule

func (s *TermContext) EnterRule(listener antlr.ParseTreeListener)

func (*TermContext) ExitRule

func (s *TermContext) ExitRule(listener antlr.ParseTreeListener)

func (*TermContext) GetParser

func (s *TermContext) GetParser() antlr.Parser

func (*TermContext) GetRuleContext

func (s *TermContext) GetRuleContext() antlr.RuleContext

func (*TermContext) IsTermContext

func (*TermContext) IsTermContext()

func (*TermContext) Rewrite

func (s *TermContext) Rewrite() IRewriteContext

func (*TermContext) ToStringTree

func (s *TermContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL