ebnfparser

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 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

View Source
const (
	IdentCOMMENT = "COMMENT"
	IdentIDENT   = "IDENT"
	IdentSTRING  = "STRING"
	IdentAtom    = "atom"
	IdentOp      = "op"
	IdentProd    = "prod"
	IdentQuant   = "quant"
	IdentRule    = "rule"
	IdentStmt    = "stmt"
	IdentTerm    = "term"
)

Variables

This section is empty.

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) AllRule

func (c AtomNode) AllRule() []IdentNode

func (AtomNode) AllString

func (c AtomNode) AllString() []StringNode

func (AtomNode) AllTerm

func (c AtomNode) AllTerm() []TermNode

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

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

func (GrammarNode) OneStmt

func (c GrammarNode) OneStmt() StmtNode

type IdentNode

type IdentNode struct{ ast.Node }

func (IdentNode) String

func (c IdentNode) String() string

type ProdNode

type ProdNode struct{ ast.Node }

func (ProdNode) AllIdent

func (c ProdNode) AllIdent() []IdentNode

func (ProdNode) AllTerm

func (c ProdNode) AllTerm() []TermNode

func (ProdNode) OneIdent

func (c ProdNode) OneIdent() IdentNode

func (ProdNode) OneTerm

func (c ProdNode) OneTerm() TermNode

type StmtNode

type StmtNode struct{ ast.Node }

func (StmtNode) AllComment

func (c StmtNode) AllComment() []CommentNode

func (StmtNode) AllProd

func (c StmtNode) AllProd() []ProdNode

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
}

func WalkAtomNode

func WalkAtomNode(node AtomNode, ops WalkerOps) Stopper

func WalkCommentNode

func WalkCommentNode(node CommentNode, ops WalkerOps) Stopper

func WalkGrammarNode

func WalkGrammarNode(node GrammarNode, ops WalkerOps) Stopper

func WalkIdentNode

func WalkIdentNode(node IdentNode, ops WalkerOps) Stopper

func WalkProdNode

func WalkProdNode(node ProdNode, ops WalkerOps) Stopper

func WalkStmtNode

func WalkStmtNode(node StmtNode, ops WalkerOps) Stopper

func WalkStringNode

func WalkStringNode(node StringNode, ops WalkerOps) Stopper

func WalkTermNode

func WalkTermNode(node TermNode, ops WalkerOps) Stopper

func WalkWrapreNode

func WalkWrapreNode(node WrapreNode, ops WalkerOps) Stopper

type StringNode

type StringNode struct{ ast.Node }

func (StringNode) String

func (c StringNode) String() string

type TermNode

type TermNode struct{ ast.Node }

func (TermNode) AllAtom

func (c TermNode) AllAtom() []AtomNode

func (TermNode) AllOp

func (c TermNode) AllOp() []string

func (TermNode) AllQuant

func (c TermNode) AllQuant() []string

func (TermNode) AllTerm

func (c TermNode) AllTerm() []TermNode

func (TermNode) Choice

func (c TermNode) Choice() int

func (TermNode) OneAtom

func (c TermNode) OneAtom() AtomNode

func (TermNode) OneOp

func (c TermNode) OneOp() string

func (TermNode) OneQuant

func (c TermNode) OneQuant() string

func (TermNode) OneTerm

func (c TermNode) OneTerm() TermNode

type WalkerOps

type WalkerOps struct {
	EnterWrapreNode  func(WrapreNode) Stopper
	ExitWrapreNode   func(WrapreNode) Stopper
	EnterCommentNode func(CommentNode) Stopper
	ExitCommentNode  func(CommentNode) Stopper
	EnterIdentNode   func(IdentNode) Stopper
	ExitIdentNode    func(IdentNode) Stopper
	EnterStringNode  func(StringNode) Stopper
	ExitStringNode   func(StringNode) Stopper
	EnterAtomNode    func(AtomNode) Stopper
	ExitAtomNode     func(AtomNode) Stopper
	EnterGrammarNode func(GrammarNode) Stopper
	ExitGrammarNode  func(GrammarNode) Stopper
	EnterProdNode    func(ProdNode) Stopper
	ExitProdNode     func(ProdNode) Stopper
	EnterStmtNode    func(StmtNode) Stopper
	ExitStmtNode     func(StmtNode) Stopper
	EnterTermNode    func(TermNode) Stopper
	ExitTermNode     func(TermNode) Stopper
}

func (WalkerOps) Walk

func (w WalkerOps) Walk(tree GrammarNode)

type WrapreNode

type WrapreNode struct{ ast.Node }

func (WrapreNode) String

func (c WrapreNode) String() string

Jump to

Keyboard shortcuts

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