Documentation ¶
Index ¶
- func ParseNothing(s Scanner) (Node, Scanner)
- func Walk(root Node) chan Node
- type Cursor
- type Identifier
- type Node
- func NewNonTerminal() Node
- func NewTerminal(name string, value string, source Source) Node
- func QueryFilter(root Node, predicate NodePredicate) []Node
- func QueryMany(root Node, query QueryString) []Node
- func QueryOne(root Node, query QueryString) Node
- func QueryTerminals(root Node) []Node
- func TransformAll(root Node, transform NodeTransformer) Node
- func TransformMatch(root Node, predicate NodePredicate, transform NodeTransformer) Node
- func TransformMatches(root Node, matchers []struct{ ... }) Node
- type NodeGenerator
- type NodePredicate
- type NodeTransformer
- type Output
- type Parser
- func And(name Identifier, parsers ...interface{}) Parser
- func Atom(name Identifier, atom string) Parser
- func AtomExact(name Identifier, atom string) Parser
- func Char(name Identifier) Parser
- func End() Parser
- func Hex(name Identifier) Parser
- func Ident(name Identifier) Parser
- func Int(name Identifier) Parser
- func Kleen(name Identifier, parser interface{}) Parser
- func Many(name Identifier, parser interface{}) Parser
- func ManyUntil(name Identifier, itemParser interface{}, stopParser interface{}) Parser
- func Maybe(name Identifier, parser interface{}) Parser
- func NotEnd() Parser
- func Oct(name Identifier) Parser
- func Or(name Identifier, parsers ...interface{}) Parser
- func OrToken(name Identifier, r Regex) Parser
- func ShortCircuit(parser Parser, callback ShortCircuitCallback) Parser
- func String(name Identifier) Parser
- func Token(name string, pattern Regex) Parser
- func TokenExact(name Identifier, r Regex) Parser
- type QueryString
- type Regex
- type Scanner
- type ShortCircuitCallback
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseNothing ¶
ParseNothing is a parser that will reject all input as invalid. It will not create a node for any input and return the scanner unchanged.
Types ¶
type Identifier ¶
type Identifier string
type Node ¶
type Node interface { Name() string Children() []Node Value() string Source() Source IsTerminal() bool }
func NewNonTerminal ¶
func NewNonTerminal() Node
func NewTerminal ¶
NewTerminal will create and return a new terminal node.
func QueryFilter ¶
func QueryFilter(root Node, predicate NodePredicate) []Node
func QueryMany ¶
func QueryMany(root Node, query QueryString) []Node
func QueryOne ¶
func QueryOne(root Node, query QueryString) Node
func QueryTerminals ¶
func TransformAll ¶
func TransformAll(root Node, transform NodeTransformer) Node
func TransformMatch ¶
func TransformMatch(root Node, predicate NodePredicate, transform NodeTransformer) Node
func TransformMatches ¶
func TransformMatches(root Node, matchers []struct { NodePredicate NodeTransformer }) Node
type NodeGenerator ¶
type NodePredicate ¶
func IsA ¶
func IsA(name string) NodePredicate
type NodeTransformer ¶
type Output ¶
type Output interface{}
func FoldUp ¶
func FoldUp(root Node, generators []struct { NodePredicate NodeGenerator }) Output
func GenerateAll ¶
func GenerateAll(root Node, generator NodeGenerator) Output
func Map ¶
func Map(nodes []Node, generator NodeGenerator) []Output
type Parser ¶
Parser function parses input text encapsulated by Scanner, higher order parsers are constructed using combinators.
func And ¶
func And(name Identifier, parsers ...interface{}) Parser
func Atom ¶
func Atom(name Identifier, atom string) Parser
func AtomExact ¶
func AtomExact(name Identifier, atom string) Parser
func Char ¶
func Char(name Identifier) Parser
func Hex ¶
func Hex(name Identifier) Parser
func Ident ¶
func Ident(name Identifier) Parser
func Int ¶
func Int(name Identifier) Parser
func Kleen ¶
func Kleen(name Identifier, parser interface{}) Parser
func Many ¶
func Many(name Identifier, parser interface{}) Parser
func ManyUntil ¶
func ManyUntil(name Identifier, itemParser interface{}, stopParser interface{}) Parser
func Maybe ¶
func Maybe(name Identifier, parser interface{}) Parser
func Oct ¶
func Oct(name Identifier) Parser
func Or ¶
func Or(name Identifier, parsers ...interface{}) Parser
func OrToken ¶
func OrToken(name Identifier, r Regex) Parser
func ShortCircuit ¶
func ShortCircuit(parser Parser, callback ShortCircuitCallback) Parser
func String ¶
func String(name Identifier) Parser
func TokenExact ¶
func TokenExact(name Identifier, r Regex) Parser
type QueryString ¶
type QueryString string
Click to show internal directories.
Click to hide internal directories.