parser

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bounds added in v0.2.0

type Bounds struct {
	Low, High rune
}

func (*Bounds) Contains added in v0.2.0

func (b *Bounds) Contains(r rune) bool

type Node

type Node struct {
	Type     NodeType
	Value    string
	Children []*Node
	Leaf     bool
	Name     []string // Only valid on leaf nodes. List of names of patterns terminate that on this leaf node
	Range    *Range
}

func Merge

func Merge(root1, root2 *Node) *Node

func Parse

func Parse(name, input string) (*Node, error)

func (*Node) Index added in v0.2.0

func (n *Node) Index(s string) int

Index returns the first index of the Node's expression in the string.

func (*Node) LastIndex added in v0.2.0

func (n *Node) LastIndex(s string) int

LastIndex returns the last index of the Node's expression in the string. For ranges, it returns the beginning of the last blob

type NodeType

type NodeType int
const (
	TypeRoot NodeType = iota
	TypeAny
	TypeText
	TypeRange
)

func (NodeType) String

func (i NodeType) String() string

type Range added in v0.2.0

type Range struct {
	Repeated bool
	Inverse  bool
	Bounds   []*Bounds
	CharList string
}

func (*Range) Matches added in v0.2.0

func (r *Range) Matches(ru rune) bool

Matches returns true if the rune is matched by the Range.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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