fen

package
v0.0.0-...-4c43aeb Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
package main

import (
	"bramp.net/antlr4/fen"

	"fmt"
	"github.com/antlr/antlr4/runtime/Go/antlr"
)

type exampleListener struct {
	*fen.BasefenListener
}

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 := fen.NewfenLexer(is)
	stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)

	// Create the Parser
	p := fen.NewfenParser(stream)
	p.BuildParseTrees = true
	p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))

	// Finally walk the tree
	tree := p.Fen()
	antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewfenLexer

func NewfenLexer(input antlr.CharStream) *fenLexer

func NewfenParser

func NewfenParser(input antlr.TokenStream) *fenParser

Types

type BasefenListener

type BasefenListener struct{}

BasefenListener is a complete listener for a parse tree produced by fenParser.

func (*BasefenListener) EnterCastling

func (s *BasefenListener) EnterCastling(ctx *CastlingContext)

EnterCastling is called when production castling is entered.

func (*BasefenListener) EnterColor

func (s *BasefenListener) EnterColor(ctx *ColorContext)

EnterColor is called when production color is entered.

func (*BasefenListener) EnterEnpassant

func (s *BasefenListener) EnterEnpassant(ctx *EnpassantContext)

EnterEnpassant is called when production enpassant is entered.

func (*BasefenListener) EnterEveryRule

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

EnterEveryRule is called when any rule is entered.

func (*BasefenListener) EnterFen

func (s *BasefenListener) EnterFen(ctx *FenContext)

EnterFen is called when production fen is entered.

func (*BasefenListener) EnterFullmoveclock

func (s *BasefenListener) EnterFullmoveclock(ctx *FullmoveclockContext)

EnterFullmoveclock is called when production fullmoveclock is entered.

func (*BasefenListener) EnterHalfmoveclock

func (s *BasefenListener) EnterHalfmoveclock(ctx *HalfmoveclockContext)

EnterHalfmoveclock is called when production halfmoveclock is entered.

func (*BasefenListener) EnterPiece

func (s *BasefenListener) EnterPiece(ctx *PieceContext)

EnterPiece is called when production piece is entered.

func (*BasefenListener) EnterPlacement

func (s *BasefenListener) EnterPlacement(ctx *PlacementContext)

EnterPlacement is called when production placement is entered.

func (*BasefenListener) EnterPosition

func (s *BasefenListener) EnterPosition(ctx *PositionContext)

EnterPosition is called when production position is entered.

func (*BasefenListener) EnterRank

func (s *BasefenListener) EnterRank(ctx *RankContext)

EnterRank is called when production rank is entered.

func (*BasefenListener) ExitCastling

func (s *BasefenListener) ExitCastling(ctx *CastlingContext)

ExitCastling is called when production castling is exited.

func (*BasefenListener) ExitColor

func (s *BasefenListener) ExitColor(ctx *ColorContext)

ExitColor is called when production color is exited.

func (*BasefenListener) ExitEnpassant

func (s *BasefenListener) ExitEnpassant(ctx *EnpassantContext)

ExitEnpassant is called when production enpassant is exited.

func (*BasefenListener) ExitEveryRule

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

ExitEveryRule is called when any rule is exited.

func (*BasefenListener) ExitFen

func (s *BasefenListener) ExitFen(ctx *FenContext)

ExitFen is called when production fen is exited.

func (*BasefenListener) ExitFullmoveclock

func (s *BasefenListener) ExitFullmoveclock(ctx *FullmoveclockContext)

ExitFullmoveclock is called when production fullmoveclock is exited.

func (*BasefenListener) ExitHalfmoveclock

func (s *BasefenListener) ExitHalfmoveclock(ctx *HalfmoveclockContext)

ExitHalfmoveclock is called when production halfmoveclock is exited.

func (*BasefenListener) ExitPiece

func (s *BasefenListener) ExitPiece(ctx *PieceContext)

ExitPiece is called when production piece is exited.

func (*BasefenListener) ExitPlacement

func (s *BasefenListener) ExitPlacement(ctx *PlacementContext)

ExitPlacement is called when production placement is exited.

func (*BasefenListener) ExitPosition

func (s *BasefenListener) ExitPosition(ctx *PositionContext)

ExitPosition is called when production position is exited.

func (*BasefenListener) ExitRank

func (s *BasefenListener) ExitRank(ctx *RankContext)

ExitRank is called when production rank is exited.

func (*BasefenListener) VisitErrorNode

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

VisitErrorNode is called when an error node is visited.

func (*BasefenListener) VisitTerminal

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

VisitTerminal is called when a terminal node is visited.

type CastlingContext

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

func NewCastlingContext

func NewCastlingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CastlingContext

func NewEmptyCastlingContext

func NewEmptyCastlingContext() *CastlingContext

func (*CastlingContext) EnterRule

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

func (*CastlingContext) ExitRule

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

func (*CastlingContext) GetParser

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

func (*CastlingContext) GetRuleContext

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

func (*CastlingContext) IsCastlingContext

func (*CastlingContext) IsCastlingContext()

func (*CastlingContext) ToStringTree

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

type ColorContext

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

func NewColorContext

func NewColorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColorContext

func NewEmptyColorContext

func NewEmptyColorContext() *ColorContext

func (*ColorContext) EnterRule

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

func (*ColorContext) ExitRule

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

func (*ColorContext) GetParser

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

func (*ColorContext) GetRuleContext

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

func (*ColorContext) IsColorContext

func (*ColorContext) IsColorContext()

func (*ColorContext) ToStringTree

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

type EnpassantContext

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

func NewEmptyEnpassantContext

func NewEmptyEnpassantContext() *EnpassantContext

func NewEnpassantContext

func NewEnpassantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EnpassantContext

func (*EnpassantContext) EnterRule

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

func (*EnpassantContext) ExitRule

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

func (*EnpassantContext) GetParser

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

func (*EnpassantContext) GetRuleContext

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

func (*EnpassantContext) IsEnpassantContext

func (*EnpassantContext) IsEnpassantContext()

func (*EnpassantContext) Position

func (s *EnpassantContext) Position() IPositionContext

func (*EnpassantContext) ToStringTree

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

type FenContext

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

func NewEmptyFenContext

func NewEmptyFenContext() *FenContext

func NewFenContext

func NewFenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FenContext

func (*FenContext) Castling

func (s *FenContext) Castling() ICastlingContext

func (*FenContext) Color

func (s *FenContext) Color() IColorContext

func (*FenContext) Enpassant

func (s *FenContext) Enpassant() IEnpassantContext

func (*FenContext) EnterRule

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

func (*FenContext) ExitRule

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

func (*FenContext) Fullmoveclock

func (s *FenContext) Fullmoveclock() IFullmoveclockContext

func (*FenContext) GetParser

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

func (*FenContext) GetRuleContext

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

func (*FenContext) Halfmoveclock

func (s *FenContext) Halfmoveclock() IHalfmoveclockContext

func (*FenContext) IsFenContext

func (*FenContext) IsFenContext()

func (*FenContext) Placement

func (s *FenContext) Placement() IPlacementContext

func (*FenContext) ToStringTree

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

type FullmoveclockContext

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

func NewEmptyFullmoveclockContext

func NewEmptyFullmoveclockContext() *FullmoveclockContext

func NewFullmoveclockContext

func NewFullmoveclockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FullmoveclockContext

func (*FullmoveclockContext) EnterRule

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

func (*FullmoveclockContext) ExitRule

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

func (*FullmoveclockContext) GetParser

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

func (*FullmoveclockContext) GetRuleContext

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

func (*FullmoveclockContext) IsFullmoveclockContext

func (*FullmoveclockContext) IsFullmoveclockContext()

func (*FullmoveclockContext) NUMBER

func (*FullmoveclockContext) ToStringTree

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

type HalfmoveclockContext

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

func NewEmptyHalfmoveclockContext

func NewEmptyHalfmoveclockContext() *HalfmoveclockContext

func NewHalfmoveclockContext

func NewHalfmoveclockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *HalfmoveclockContext

func (*HalfmoveclockContext) EnterRule

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

func (*HalfmoveclockContext) ExitRule

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

func (*HalfmoveclockContext) GetParser

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

func (*HalfmoveclockContext) GetRuleContext

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

func (*HalfmoveclockContext) IsHalfmoveclockContext

func (*HalfmoveclockContext) IsHalfmoveclockContext()

func (*HalfmoveclockContext) NUMBER

func (*HalfmoveclockContext) ToStringTree

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

type ICastlingContext

type ICastlingContext interface {
	antlr.ParserRuleContext

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

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

ICastlingContext is an interface to support dynamic dispatch.

type IColorContext

type IColorContext interface {
	antlr.ParserRuleContext

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

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

IColorContext is an interface to support dynamic dispatch.

type IEnpassantContext

type IEnpassantContext interface {
	antlr.ParserRuleContext

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

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

IEnpassantContext is an interface to support dynamic dispatch.

type IFenContext

type IFenContext interface {
	antlr.ParserRuleContext

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

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

IFenContext is an interface to support dynamic dispatch.

type IFullmoveclockContext

type IFullmoveclockContext interface {
	antlr.ParserRuleContext

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

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

IFullmoveclockContext is an interface to support dynamic dispatch.

type IHalfmoveclockContext

type IHalfmoveclockContext interface {
	antlr.ParserRuleContext

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

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

IHalfmoveclockContext is an interface to support dynamic dispatch.

type IPieceContext

type IPieceContext interface {
	antlr.ParserRuleContext

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

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

IPieceContext is an interface to support dynamic dispatch.

type IPlacementContext

type IPlacementContext interface {
	antlr.ParserRuleContext

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

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

IPlacementContext is an interface to support dynamic dispatch.

type IPositionContext

type IPositionContext interface {
	antlr.ParserRuleContext

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

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

IPositionContext is an interface to support dynamic dispatch.

type IRankContext

type IRankContext interface {
	antlr.ParserRuleContext

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

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

IRankContext is an interface to support dynamic dispatch.

type PieceContext

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

func NewEmptyPieceContext

func NewEmptyPieceContext() *PieceContext

func NewPieceContext

func NewPieceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PieceContext

func (*PieceContext) EnterRule

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

func (*PieceContext) ExitRule

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

func (*PieceContext) GetParser

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

func (*PieceContext) GetRuleContext

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

func (*PieceContext) IsPieceContext

func (*PieceContext) IsPieceContext()

func (*PieceContext) ToStringTree

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

type PlacementContext

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

func NewEmptyPlacementContext

func NewEmptyPlacementContext() *PlacementContext

func NewPlacementContext

func NewPlacementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlacementContext

func (*PlacementContext) AllRank

func (s *PlacementContext) AllRank() []IRankContext

func (*PlacementContext) EnterRule

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

func (*PlacementContext) ExitRule

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

func (*PlacementContext) GetParser

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

func (*PlacementContext) GetRuleContext

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

func (*PlacementContext) IsPlacementContext

func (*PlacementContext) IsPlacementContext()

func (*PlacementContext) Rank

func (s *PlacementContext) Rank(i int) IRankContext

func (*PlacementContext) ToStringTree

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

type PositionContext

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

func NewEmptyPositionContext

func NewEmptyPositionContext() *PositionContext

func NewPositionContext

func NewPositionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PositionContext

func (*PositionContext) EnterRule

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

func (*PositionContext) ExitRule

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

func (*PositionContext) GetParser

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

func (*PositionContext) GetRuleContext

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

func (*PositionContext) IsPositionContext

func (*PositionContext) IsPositionContext()

func (*PositionContext) NUMBER

func (s *PositionContext) NUMBER() antlr.TerminalNode

func (*PositionContext) ToStringTree

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

type RankContext

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

func NewEmptyRankContext

func NewEmptyRankContext() *RankContext

func NewRankContext

func NewRankContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RankContext

func (*RankContext) AllNUMBER

func (s *RankContext) AllNUMBER() []antlr.TerminalNode

func (*RankContext) AllPiece

func (s *RankContext) AllPiece() []IPieceContext

func (*RankContext) EnterRule

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

func (*RankContext) ExitRule

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

func (*RankContext) GetParser

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

func (*RankContext) GetRuleContext

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

func (*RankContext) IsRankContext

func (*RankContext) IsRankContext()

func (*RankContext) NUMBER

func (s *RankContext) NUMBER(i int) antlr.TerminalNode

func (*RankContext) Piece

func (s *RankContext) Piece(i int) IPieceContext

func (*RankContext) ToStringTree

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