Documentation
¶
Index ¶
- Constants
- func AssertEqualNodes(t *testing.T, v, u Node) bool
- func ForEach(iter Iter, fn func(node BaseNode))
- type BaseNode
- type Extra
- type Foo
- type Func
- type Iter
- type Node
- func (n Node) Count() int
- func (n Node) Format(state fmt.State, c rune)
- func (n Node) Get(path ...int) TreeElement
- func (n Node) GetNode(path ...int) Node
- func (n Node) GetScanner(path ...int) Scanner
- func (n Node) GetString(path ...int) string
- func (Node) IsTreeElement()
- func (n Node) Normalize() Node
- func (n Node) String() string
- type NodeDiff
- type NonTerminal
- func (t *NonTerminal) Add(child ...BaseNode)
- func (t *NonTerminal) AddAndCount(child BaseNode, dest *int)
- func (t *NonTerminal) AddAndSet(child BaseNode, dest *BaseNode)
- func (t *NonTerminal) AllChildren() []BaseNode
- func (t *NonTerminal) AtIndex(ofType reflect.Type, tag Tag, index int) BaseNode
- func (t *NonTerminal) Count() int
- func (t *NonTerminal) Iter(ofType reflect.Type, tag Tag) Iter
- func (t *NonTerminal) Tag() Tag
- type Parser
- type Scanner
- func (r Scanner) Context() string
- func (r *Scanner) Eat(i int, eaten *Scanner) *Scanner
- func (r *Scanner) EatRegexp(re *regexp.Regexp, match *Scanner, captures []Scanner) (n int, ok bool)
- func (r *Scanner) EatString(s string, eaten *Scanner) bool
- func (r Scanner) Format(state fmt.State, c rune)
- func (Scanner) IsTreeElement()
- func (r Scanner) Offset() int
- func (r Scanner) Skip(i int) *Scanner
- func (r Scanner) Slice(a, b int) *Scanner
- func (r Scanner) String() string
- func (r Scanner) StripSource() Scanner
- type Tag
- type Terminal
- type TreeElement
Constants ¶
View Source
const NoTag = Tag("")
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Func ¶
type Func func(input *Scanner, output *TreeElement) error
type Node ¶
type Node struct {
Tag string `json:"tag"`
Extra Extra `json:"extra"`
Children []TreeElement `json:"nodes"`
}
func (Node) Get ¶
func (n Node) Get(path ...int) TreeElement
func (Node) GetScanner ¶
func (Node) IsTreeElement ¶ added in v0.6.0
func (Node) IsTreeElement()
type NodeDiff ¶
func NewNodeDiff ¶
type NonTerminal ¶
type NonTerminal struct {
// contains filtered or unexported fields
}
func (*NonTerminal) Add ¶
func (t *NonTerminal) Add(child ...BaseNode)
func (*NonTerminal) AddAndCount ¶
func (t *NonTerminal) AddAndCount(child BaseNode, dest *int)
func (*NonTerminal) AddAndSet ¶
func (t *NonTerminal) AddAndSet(child BaseNode, dest *BaseNode)
func (*NonTerminal) AllChildren ¶
func (t *NonTerminal) AllChildren() []BaseNode
func (*NonTerminal) Count ¶
func (t *NonTerminal) Count() int
func (*NonTerminal) Tag ¶
func (t *NonTerminal) Tag() Tag
type Parser ¶
type Parser interface {
Parse(input *Scanner, output *TreeElement) error
}
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewBareScanner ¶ added in v0.2.0
func NewScanner ¶
func NewScannerAt ¶
func (*Scanner) EatRegexp ¶
EatRegexp eats the text matching a regexp, populating match (if != nil) with the whole match and captures (if != nil) with any captured groups. Returns n as the number of captures set and ok iff a match was found.
func (Scanner) IsTreeElement ¶ added in v0.6.0
func (Scanner) IsTreeElement()
func (Scanner) StripSource ¶ added in v0.4.0
type TreeElement ¶ added in v0.6.0
type TreeElement interface {
IsTreeElement()
}
Click to show internal directories.
Click to hide internal directories.