parser

package
v0.0.0-...-7dafa0e Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiceLexerD             = 1
	DiceLexerSIGN          = 2
	DiceLexerLPAREN        = 3
	DiceLexerRPAREN        = 4
	DiceLexerCOMMA         = 5
	DiceLexerSPACE         = 6
	DiceLexerWS            = 7
	DiceLexerInteger       = 8
	DiceLexerId            = 9
	DiceLexerStringLiteral = 10
)

DiceLexer tokens.

View Source
const (
	DiceParserEOF           = antlr.TokenEOF
	DiceParserD             = 1
	DiceParserSIGN          = 2
	DiceParserLPAREN        = 3
	DiceParserRPAREN        = 4
	DiceParserCOMMA         = 5
	DiceParserSPACE         = 6
	DiceParserWS            = 7
	DiceParserInteger       = 8
	DiceParserId            = 9
	DiceParserStringLiteral = 10
)

DiceParser tokens.

View Source
const (
	DiceParserRULE_notation = 0
	DiceParserRULE_count    = 1
	DiceParserRULE_sides    = 2
	DiceParserRULE_modifier = 3
)

DiceParser rules.

Variables

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

Functions

func DiceLexerInit

func DiceLexerInit()

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

func DiceParserInit

func DiceParserInit()

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

func InitEmptyCountContext

func InitEmptyCountContext(p *CountContext)

func InitEmptyModifierContext

func InitEmptyModifierContext(p *ModifierContext)

func InitEmptyNotationContext

func InitEmptyNotationContext(p *NotationContext)

func InitEmptySidesContext

func InitEmptySidesContext(p *SidesContext)

Types

type BaseDiceListener

type BaseDiceListener struct{}

BaseDiceListener is a complete listener for a parse tree produced by DiceParser.

func (*BaseDiceListener) EnterCount

func (s *BaseDiceListener) EnterCount(ctx *CountContext)

EnterCount is called when production count is entered.

func (*BaseDiceListener) EnterEveryRule

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

EnterEveryRule is called when any rule is entered.

func (*BaseDiceListener) EnterModifier

func (s *BaseDiceListener) EnterModifier(ctx *ModifierContext)

EnterModifier is called when production modifier is entered.

func (*BaseDiceListener) EnterNotation

func (s *BaseDiceListener) EnterNotation(ctx *NotationContext)

EnterNotation is called when production notation is entered.

func (*BaseDiceListener) EnterSides

func (s *BaseDiceListener) EnterSides(ctx *SidesContext)

EnterSides is called when production sides is entered.

func (*BaseDiceListener) ExitCount

func (s *BaseDiceListener) ExitCount(ctx *CountContext)

ExitCount is called when production count is exited.

func (*BaseDiceListener) ExitEveryRule

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

ExitEveryRule is called when any rule is exited.

func (*BaseDiceListener) ExitModifier

func (s *BaseDiceListener) ExitModifier(ctx *ModifierContext)

ExitModifier is called when production modifier is exited.

func (*BaseDiceListener) ExitNotation

func (s *BaseDiceListener) ExitNotation(ctx *NotationContext)

ExitNotation is called when production notation is exited.

func (*BaseDiceListener) ExitSides

func (s *BaseDiceListener) ExitSides(ctx *SidesContext)

ExitSides is called when production sides is exited.

func (*BaseDiceListener) VisitErrorNode

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

VisitErrorNode is called when an error node is visited.

func (*BaseDiceListener) VisitTerminal

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

VisitTerminal is called when a terminal node is visited.

type CountContext

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

func NewCountContext

func NewCountContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CountContext

func NewEmptyCountContext

func NewEmptyCountContext() *CountContext

func (*CountContext) EnterRule

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

func (*CountContext) ExitRule

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

func (*CountContext) GetParser

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

func (*CountContext) GetRuleContext

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

func (*CountContext) Integer

func (s *CountContext) Integer() antlr.TerminalNode

func (*CountContext) IsCountContext

func (*CountContext) IsCountContext()

func (*CountContext) ToStringTree

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

type DiceLexer

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

func NewDiceLexer

func NewDiceLexer(input antlr.CharStream) *DiceLexer

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

type DiceListener

type DiceListener interface {
	antlr.ParseTreeListener

	// EnterNotation is called when entering the notation production.
	EnterNotation(c *NotationContext)

	// EnterCount is called when entering the count production.
	EnterCount(c *CountContext)

	// EnterSides is called when entering the sides production.
	EnterSides(c *SidesContext)

	// EnterModifier is called when entering the modifier production.
	EnterModifier(c *ModifierContext)

	// ExitNotation is called when exiting the notation production.
	ExitNotation(c *NotationContext)

	// ExitCount is called when exiting the count production.
	ExitCount(c *CountContext)

	// ExitSides is called when exiting the sides production.
	ExitSides(c *SidesContext)

	// ExitModifier is called when exiting the modifier production.
	ExitModifier(c *ModifierContext)
}

DiceListener is a complete listener for a parse tree produced by DiceParser.

type DiceParser

type DiceParser struct {
	*antlr.BaseParser
}

func NewDiceParser

func NewDiceParser(input antlr.TokenStream) *DiceParser

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

func (*DiceParser) Count

func (p *DiceParser) Count() (localctx ICountContext)

func (*DiceParser) Modifier

func (p *DiceParser) Modifier() (localctx IModifierContext)

func (*DiceParser) Notation

func (p *DiceParser) Notation() (localctx INotationContext)

func (*DiceParser) Sides

func (p *DiceParser) Sides() (localctx ISidesContext)

type ICountContext

type ICountContext interface {
	antlr.ParserRuleContext

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

	// Getter signatures
	Integer() antlr.TerminalNode

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

ICountContext is an interface to support dynamic dispatch.

type IModifierContext

type IModifierContext interface {
	antlr.ParserRuleContext

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

	// Getter signatures
	SIGN() antlr.TerminalNode
	Integer() antlr.TerminalNode

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

IModifierContext is an interface to support dynamic dispatch.

type INotationContext

type INotationContext interface {
	antlr.ParserRuleContext

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

	// Getter signatures
	Sides() ISidesContext
	Count() ICountContext
	Modifier() IModifierContext

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

INotationContext is an interface to support dynamic dispatch.

type ISidesContext

type ISidesContext interface {
	antlr.ParserRuleContext

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

	// Getter signatures
	Id() antlr.TerminalNode

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

ISidesContext is an interface to support dynamic dispatch.

type ModifierContext

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

func NewEmptyModifierContext

func NewEmptyModifierContext() *ModifierContext

func NewModifierContext

func NewModifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ModifierContext

func (*ModifierContext) EnterRule

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

func (*ModifierContext) ExitRule

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

func (*ModifierContext) GetParser

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

func (*ModifierContext) GetRuleContext

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

func (*ModifierContext) Integer

func (s *ModifierContext) Integer() antlr.TerminalNode

func (*ModifierContext) IsModifierContext

func (*ModifierContext) IsModifierContext()

func (*ModifierContext) SIGN

func (*ModifierContext) ToStringTree

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

type NotationContext

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

func NewEmptyNotationContext

func NewEmptyNotationContext() *NotationContext

func NewNotationContext

func NewNotationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NotationContext

func (*NotationContext) Count

func (s *NotationContext) Count() ICountContext

func (*NotationContext) EnterRule

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

func (*NotationContext) ExitRule

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

func (*NotationContext) GetParser

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

func (*NotationContext) GetRuleContext

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

func (*NotationContext) IsNotationContext

func (*NotationContext) IsNotationContext()

func (*NotationContext) Modifier

func (s *NotationContext) Modifier() IModifierContext

func (*NotationContext) Sides

func (s *NotationContext) Sides() ISidesContext

func (*NotationContext) ToStringTree

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

type SidesContext

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

func NewEmptySidesContext

func NewEmptySidesContext() *SidesContext

func NewSidesContext

func NewSidesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SidesContext

func (*SidesContext) EnterRule

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

func (*SidesContext) ExitRule

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

func (*SidesContext) GetParser

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

func (*SidesContext) GetRuleContext

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

func (*SidesContext) Id

func (*SidesContext) IsSidesContext

func (*SidesContext) IsSidesContext()

func (*SidesContext) ToStringTree

func (s *SidesContext) 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