ast

package
v0.0.0-...-41221c5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  string
	Value string
}

type Document

type Document struct {
	Root *Element
}

func (*Document) VisitNode

func (n *Document) VisitNode(v NodeVisitor)

type Element

type Element struct {
	Name       string
	Attributes []*Attribute
	Children   []Node
}

func (*Element) Attribute

func (e *Element) Attribute(name string) *Attribute

func (*Element) Find

func (e *Element) Find(query Query) Iterator

func (*Element) IsVoid

func (e *Element) IsVoid() bool

func (*Element) Text

func (e *Element) Text() string

func (*Element) VisitNode

func (n *Element) VisitNode(v NodeVisitor)

func (*Element) Walk

func (e *Element) Walk() Iterator

type Iterator

type Iterator func() (*Element, bool)

func (Iterator) Next

func (i Iterator) Next() (*Element, bool)

type Node

type Node interface {
	VisitNode(NodeVisitor)
}

type NodeVisitor

type NodeVisitor struct {
	Document func(*Document)
	Element  func(*Element)
	Text     func(*Text)
}

type Query

type Query func(*Element) bool

func ByAttribute

func ByAttribute(name string, value string) Query

func ByName

func ByName(name string) Query

func (Query) And

func (q Query) And(p Query) Query

func (Query) Or

func (q Query) Or(p Query) Query

type Text

type Text struct {
	Data string
}

func (*Text) VisitNode

func (n *Text) VisitNode(v NodeVisitor)

Jump to

Keyboard shortcuts

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