ebnfparser

package
Version: v0.456.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Code generated by "ωBNF gen" DO NOT EDIT. $ wbnf gen --grammar ebnf.wbnf --start grammar --pkg ebnfparser --output ebnf.go

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeExiter = &nodeExiter{}
	Aborter    = &aborter{}
)

Functions

func GenerateOutput

func GenerateOutput(grammar *EbnfGrammar, value *sysl.Value, logger *logrus.Logger) (string, error)

func Grammar

func Grammar() parser.Parsers

Types

type AtomNode

type AtomNode struct{ ast.Node }

func (AtomNode) AllToken added in v0.7.0

func (c AtomNode) AllToken() []string

func (AtomNode) Choice

func (c AtomNode) Choice() int

func (AtomNode) OneRule

func (c AtomNode) OneRule() *IdentNode

func (AtomNode) OneString

func (c AtomNode) OneString() *StringNode

func (AtomNode) OneTerm

func (c AtomNode) OneTerm() *TermNode

func (AtomNode) OneToken added in v0.7.0

func (c AtomNode) OneToken() string

type CommentNode

type CommentNode struct{ ast.Node }

func (*CommentNode) String

func (c *CommentNode) String() string

type EbnfGrammar

type EbnfGrammar struct {
	Rules map[string][]TermNode
	Start string
}

func ReadGrammar

func ReadGrammar(fs afero.Fs, filename string, start string) (*EbnfGrammar, error)

type GrammarNode

type GrammarNode struct{ ast.Node }

func NewGrammarNode

func NewGrammarNode(from ast.Node) GrammarNode

func Parse

func Parse(input *parser.Scanner) (GrammarNode, error)

func ParseString

func ParseString(input string) (GrammarNode, error)

func (GrammarNode) AllStmt

func (c GrammarNode) AllStmt() []StmtNode

func (GrammarNode) GetAstNode

func (c GrammarNode) GetAstNode() ast.Node

type IdentNode

type IdentNode struct{ ast.Node }

func (*IdentNode) String

func (c *IdentNode) String() string

type ProdNode

type ProdNode struct{ ast.Node }

func (ProdNode) AllTerm

func (c ProdNode) AllTerm() []TermNode

func (ProdNode) AllToken added in v0.7.0

func (c ProdNode) AllToken() []string

func (ProdNode) OneIdent

func (c ProdNode) OneIdent() *IdentNode

func (ProdNode) OneToken added in v0.7.0

func (c ProdNode) OneToken() string

type StmtNode

type StmtNode struct{ ast.Node }

func (StmtNode) Choice

func (c StmtNode) Choice() int

func (StmtNode) OneComment

func (c StmtNode) OneComment() *CommentNode

func (StmtNode) OneProd

func (c StmtNode) OneProd() *ProdNode

type Stopper

type Stopper interface {
	ExitNode() bool
	Abort() bool
}

type StringNode

type StringNode struct{ ast.Node }

func (*StringNode) String

func (c *StringNode) String() string

type TermNode

type TermNode struct{ ast.Node }

func (TermNode) AllTerm

func (c TermNode) AllTerm() []TermNode

func (TermNode) OneAtom

func (c TermNode) OneAtom() *AtomNode

func (TermNode) OneOp

func (c TermNode) OneOp() string

func (TermNode) OneQuant

func (c TermNode) OneQuant() *TermQuantNode

type TermQuantNode added in v0.7.0

type TermQuantNode struct{ ast.Node }

func (TermQuantNode) Choice added in v0.7.0

func (c TermQuantNode) Choice() int

func (TermQuantNode) OneToken added in v0.7.0

func (c TermQuantNode) OneToken() string

type WalkerOps

type WalkerOps struct {
	EnterAtomNode      func(AtomNode) Stopper
	ExitAtomNode       func(AtomNode) Stopper
	EnterCommentNode   func(CommentNode) Stopper
	ExitCommentNode    func(CommentNode) Stopper
	EnterGrammarNode   func(GrammarNode) Stopper
	ExitGrammarNode    func(GrammarNode) Stopper
	EnterIdentNode     func(IdentNode) Stopper
	ExitIdentNode      func(IdentNode) Stopper
	EnterProdNode      func(ProdNode) Stopper
	ExitProdNode       func(ProdNode) Stopper
	EnterStmtNode      func(StmtNode) Stopper
	ExitStmtNode       func(StmtNode) Stopper
	EnterStringNode    func(StringNode) Stopper
	ExitStringNode     func(StringNode) Stopper
	EnterTermNode      func(TermNode) Stopper
	ExitTermNode       func(TermNode) Stopper
	EnterTermQuantNode func(TermQuantNode) Stopper
	ExitTermQuantNode  func(TermQuantNode) Stopper
	EnterWrapReNode    func(WrapReNode) Stopper
	ExitWrapReNode     func(WrapReNode) Stopper
}

func (WalkerOps) Walk

func (w WalkerOps) Walk(tree GrammarNode)

func (WalkerOps) WalkAtomNode added in v0.7.0

func (w WalkerOps) WalkAtomNode(node AtomNode) Stopper

func (WalkerOps) WalkGrammarNode added in v0.7.0

func (w WalkerOps) WalkGrammarNode(node GrammarNode) Stopper

func (WalkerOps) WalkProdNode added in v0.7.0

func (w WalkerOps) WalkProdNode(node ProdNode) Stopper

func (WalkerOps) WalkStmtNode added in v0.7.0

func (w WalkerOps) WalkStmtNode(node StmtNode) Stopper

func (WalkerOps) WalkTermNode added in v0.7.0

func (w WalkerOps) WalkTermNode(node TermNode) Stopper

func (WalkerOps) WalkTermQuantNode added in v0.7.0

func (w WalkerOps) WalkTermQuantNode(node TermQuantNode) Stopper

type WrapReNode added in v0.7.0

type WrapReNode struct{ ast.Node }

func (*WrapReNode) String added in v0.7.0

func (c *WrapReNode) String() string

Jump to

Keyboard shortcuts

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