tree

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeMap = [...]string{
	"TypeUnknown",
	"TypeRule",
	"TypeName",
	"TypeDot",
	"TypeCharacter",
	"TypeRange",
	"TypeString",
	"TypePredicate",
	"TypeStateChange",
	"TypeCommit",
	"TypeAction",
	"TypePackage",
	"TypeImport",
	"TypeState",
	"TypeAlternate",
	"TypeUnorderedAlternate",
	"TypeSequence",
	"TypePeekFor",
	"TypePeekNot",
	"TypeQuery",
	"TypeStar",
	"TypePlus",
	"TypePeg",
	"TypePush",
	"TypeImplicitPush",
	"TypeNil",
	"TypeLast"}

Functions

This section is empty.

Types

type Node

type Node interface {
	fmt.Stringer

	Escaped() string
	SetString(s string)

	GetType() Type
	SetType(t Type)

	GetId() int
	SetId(id int)

	Init()
	Front() *node
	Next() *node
	PushFront(value *node)
	PopFront() *node
	PushBack(value *node)
	Len() int
	Copy() *node
	Slice() []*node
	ParentDetect() bool
	SetParentDetect(detect bool)
	ParentMultipleKey() bool
	SetParentMultipleKey(detect bool)
	// contains filtered or unexported methods
}

type Tree

type Tree struct {
	Rules map[string]Node

	Ast    bool
	Strict bool

	Generator       string
	RuleNames       []Node
	PackageName     string
	Imports         []string
	EndSymbol       rune
	PegRuleType     string
	StructName      string
	StructVariables string
	RulesCount      int
	Bits            int
	HasActions      bool
	Actions         []Node
	HasPush         bool
	HasCommit       bool
	HasDot          bool
	HasCharacter    bool
	HasString       bool
	HasRange        bool
	// contains filtered or unexported fields
}

A tree data structure into which a PEG can be parsed.

func New

func New(inline, _switch, noast bool) *Tree

func (*Tree) AddAction

func (t *Tree) AddAction(text string)

func (*Tree) AddAlternate

func (t *Tree) AddAlternate()

func (*Tree) AddCharacter

func (t *Tree) AddCharacter(text string)

func (*Tree) AddDot

func (t *Tree) AddDot()

func (*Tree) AddDoubleCharacter

func (t *Tree) AddDoubleCharacter(text string)

func (*Tree) AddDoubleRange

func (t *Tree) AddDoubleRange()

func (*Tree) AddExpression

func (t *Tree) AddExpression()

func (*Tree) AddHexaCharacter

func (t *Tree) AddHexaCharacter(text string)

func (*Tree) AddImport

func (t *Tree) AddImport(text string)

func (*Tree) AddName

func (t *Tree) AddName(text string)

func (*Tree) AddNil

func (t *Tree) AddNil()

func (*Tree) AddOctalCharacter

func (t *Tree) AddOctalCharacter(text string)

func (*Tree) AddPackage

func (t *Tree) AddPackage(text string)

func (*Tree) AddPeekFor

func (t *Tree) AddPeekFor()

func (*Tree) AddPeekNot

func (t *Tree) AddPeekNot()

func (*Tree) AddPeg

func (t *Tree) AddPeg(text string)

func (*Tree) AddPlus

func (t *Tree) AddPlus()

func (*Tree) AddPredicate

func (t *Tree) AddPredicate(text string)

func (*Tree) AddPush

func (t *Tree) AddPush()

func (*Tree) AddQuery

func (t *Tree) AddQuery()

func (*Tree) AddRange

func (t *Tree) AddRange()

func (*Tree) AddRule

func (t *Tree) AddRule(name string)

func (*Tree) AddSequence

func (t *Tree) AddSequence()

func (*Tree) AddStar

func (t *Tree) AddStar()

func (*Tree) AddState

func (t *Tree) AddState(text string)

func (*Tree) AddStateChange

func (t *Tree) AddStateChange(text string)

func (*Tree) Compile

func (t *Tree) Compile(file string, args []string, out io.Writer) (err error)

func (*Tree) Copy

func (n *Tree) Copy() *node

func (*Tree) Escaped

func (n *Tree) Escaped() string

func (*Tree) Front

func (n *Tree) Front() *node

func (*Tree) GetId

func (n *Tree) GetId() int

func (*Tree) Init

func (n *Tree) Init()

func (*Tree) Len

func (n *Tree) Len() (c int)

func (*Tree) Next

func (n *Tree) Next() *node

func (*Tree) ParentDetect

func (n *Tree) ParentDetect() bool

func (*Tree) ParentMultipleKey

func (n *Tree) ParentMultipleKey() bool

func (*Tree) PopFront

func (n *Tree) PopFront() *node

func (*Tree) PushBack

func (n *Tree) PushBack(value *node)

func (*Tree) PushFront

func (n *Tree) PushFront(value *node)

func (*Tree) SetId

func (n *Tree) SetId(id int)

func (*Tree) SetParentDetect

func (n *Tree) SetParentDetect(detect bool)

func (*Tree) SetParentMultipleKey

func (n *Tree) SetParentMultipleKey(multipleKey bool)

func (*Tree) SetString

func (n *Tree) SetString(s string)

func (*Tree) SetType

func (n *Tree) SetType(t Type)

func (*Tree) Slice

func (n *Tree) Slice() []*node

func (*Tree) String

func (n *Tree) String() string

type Type

type Type uint8
const (
	TypeUnknown Type = iota
	TypeRule
	TypeName
	TypeDot
	TypeCharacter
	TypeRange
	TypeString
	TypePredicate
	TypeStateChange
	TypeCommit
	TypeAction
	TypePackage
	TypeImport
	TypeState
	TypeAlternate
	TypeUnorderedAlternate
	TypeSequence
	TypePeekFor
	TypePeekNot
	TypeQuery
	TypeStar
	TypePlus
	TypePeg
	TypePush
	TypeImplicitPush
	TypeNil
	TypeLast
)

func (Type) GetType

func (t Type) GetType() Type

Jump to

Keyboard shortcuts

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