parse

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolNode

type BoolNode struct {
	*Pos

	Val bool
	// contains filtered or unexported fields
}

func (*BoolNode) Children

func (n *BoolNode) Children() []Node

func (*BoolNode) Parent added in v1.2.0

func (n *BoolNode) Parent() Node

func (*BoolNode) SetChildren

func (n *BoolNode) SetChildren([]Node)

func (*BoolNode) String

func (n *BoolNode) String() string

type CharacterNode

type CharacterNode struct {
	*Pos

	Val  rune
	Text string
	// contains filtered or unexported fields
}

func (*CharacterNode) Children

func (n *CharacterNode) Children() []Node

func (*CharacterNode) Parent added in v1.2.0

func (n *CharacterNode) Parent() Node

func (*CharacterNode) SetChildren

func (n *CharacterNode) SetChildren([]Node)

func (*CharacterNode) String

func (n *CharacterNode) String() string

type CommentNode

type CommentNode struct {
	*Pos

	Text string
	// contains filtered or unexported fields
}

func (*CommentNode) Children

func (n *CommentNode) Children() []Node

func (*CommentNode) Parent added in v1.2.0

func (n *CommentNode) Parent() Node

func (*CommentNode) SetChildren

func (n *CommentNode) SetChildren([]Node)

func (*CommentNode) String

func (n *CommentNode) String() string

type DerefNode

type DerefNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*DerefNode) Children

func (n *DerefNode) Children() []Node

func (*DerefNode) Parent added in v1.2.0

func (n *DerefNode) Parent() Node

func (*DerefNode) SetChildren

func (n *DerefNode) SetChildren(nodes []Node)

func (*DerefNode) String

func (n *DerefNode) String() string

type FnLiteralNode

type FnLiteralNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*FnLiteralNode) Children

func (n *FnLiteralNode) Children() []Node

func (*FnLiteralNode) Parent added in v1.2.0

func (n *FnLiteralNode) Parent() Node

func (*FnLiteralNode) SetChildren

func (n *FnLiteralNode) SetChildren(nodes []Node)

func (*FnLiteralNode) String

func (n *FnLiteralNode) String() string

type KeywordNode

type KeywordNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*KeywordNode) Children

func (n *KeywordNode) Children() []Node

func (*KeywordNode) Parent added in v1.2.0

func (n *KeywordNode) Parent() Node

func (*KeywordNode) SetChildren

func (n *KeywordNode) SetChildren([]Node)

func (*KeywordNode) String

func (n *KeywordNode) String() string

type ListNode

type ListNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*ListNode) Children

func (n *ListNode) Children() []Node

func (*ListNode) Parent added in v1.2.0

func (n *ListNode) Parent() Node

func (*ListNode) SetChildren

func (n *ListNode) SetChildren(nodes []Node)

func (*ListNode) String

func (n *ListNode) String() string

type MapNode

type MapNode struct {
	*Pos

	Namespace string // empty unless the map has a namespace: #:ns{:x 1}
	Nodes     []Node
	// contains filtered or unexported fields
}

func (*MapNode) Children

func (n *MapNode) Children() []Node

func (*MapNode) Parent added in v1.2.0

func (n *MapNode) Parent() Node

func (*MapNode) SetChildren

func (n *MapNode) SetChildren(nodes []Node)

func (*MapNode) String

func (n *MapNode) String() string

type MetadataNode

type MetadataNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*MetadataNode) Children

func (n *MetadataNode) Children() []Node

func (*MetadataNode) Parent added in v1.2.0

func (n *MetadataNode) Parent() Node

func (*MetadataNode) SetChildren

func (n *MetadataNode) SetChildren(nodes []Node)

func (*MetadataNode) String

func (n *MetadataNode) String() string

type NewlineNode

type NewlineNode struct {
	*Pos
	// contains filtered or unexported fields
}

func (*NewlineNode) Children

func (n *NewlineNode) Children() []Node

func (*NewlineNode) Parent added in v1.2.0

func (n *NewlineNode) Parent() Node

func (*NewlineNode) SetChildren

func (n *NewlineNode) SetChildren([]Node)

func (*NewlineNode) String

func (n *NewlineNode) String() string

type NilNode

type NilNode struct {
	*Pos
	// contains filtered or unexported fields
}

func (*NilNode) Children

func (n *NilNode) Children() []Node

func (*NilNode) Parent added in v1.2.0

func (n *NilNode) Parent() Node

func (*NilNode) SetChildren

func (n *NilNode) SetChildren([]Node)

func (*NilNode) String

func (n *NilNode) String() string

type Node

type Node interface {
	Position() *Pos
	String() string // A non-recursive string representation
	Children() []Node
	SetChildren([]Node)
	Parent() Node // nil if Node is a root node
	// contains filtered or unexported methods
}

type NumberNode

type NumberNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*NumberNode) Children

func (n *NumberNode) Children() []Node

func (*NumberNode) Parent added in v1.2.0

func (n *NumberNode) Parent() Node

func (*NumberNode) SetChildren

func (n *NumberNode) SetChildren([]Node)

func (*NumberNode) String

func (n *NumberNode) String() string

type ParseOpts

type ParseOpts uint

ParseOpts is a bitset of parsing options for Reader and File.

const (
	// IncludeNonSemantic makes the parser include non-semantic nodes:
	// CommentNodes and NewlineNodes.
	IncludeNonSemantic ParseOpts = 1 << iota
	// IgnoreCommentForm makes the parser ignore (comment ...) forms.
	// This only applies to forms that are semantic comments; a quoted node
	// such as '(comment "foo") would not be ignored.
	IgnoreCommentForm
	// IgnoreReaderDiscard makes the parser ignore forms preceded by #_.
	IgnoreReaderDiscard
)

type Pos

type Pos struct {
	Name   string
	Offset int
	Line   int
	Col    int
}

Pos is a position in source text.

func (*Pos) Copy

func (p *Pos) Copy() *Pos

func (*Pos) FormatError

func (p *Pos) FormatError(tag string, msg string) error

func (*Pos) Position

func (p *Pos) Position() *Pos

func (*Pos) String

func (p *Pos) String() string

type QuoteNode

type QuoteNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*QuoteNode) Children

func (n *QuoteNode) Children() []Node

func (*QuoteNode) Parent added in v1.2.0

func (n *QuoteNode) Parent() Node

func (*QuoteNode) SetChildren

func (n *QuoteNode) SetChildren(nodes []Node)

func (*QuoteNode) String

func (n *QuoteNode) String() string

type ReaderCondNode added in v1.1.0

type ReaderCondNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*ReaderCondNode) Children added in v1.1.0

func (n *ReaderCondNode) Children() []Node

func (*ReaderCondNode) Parent added in v1.2.0

func (n *ReaderCondNode) Parent() Node

func (*ReaderCondNode) SetChildren added in v1.1.0

func (n *ReaderCondNode) SetChildren(nodes []Node)

func (*ReaderCondNode) String added in v1.1.0

func (n *ReaderCondNode) String() string

type ReaderCondSpliceNode added in v1.1.0

type ReaderCondSpliceNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*ReaderCondSpliceNode) Children added in v1.1.0

func (n *ReaderCondSpliceNode) Children() []Node

func (*ReaderCondSpliceNode) Parent added in v1.2.0

func (n *ReaderCondSpliceNode) Parent() Node

func (*ReaderCondSpliceNode) SetChildren added in v1.1.0

func (n *ReaderCondSpliceNode) SetChildren(nodes []Node)

func (*ReaderCondSpliceNode) String added in v1.1.0

func (n *ReaderCondSpliceNode) String() string

type ReaderDiscardNode

type ReaderDiscardNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*ReaderDiscardNode) Children

func (n *ReaderDiscardNode) Children() []Node

func (*ReaderDiscardNode) Parent added in v1.2.0

func (n *ReaderDiscardNode) Parent() Node

func (*ReaderDiscardNode) SetChildren

func (n *ReaderDiscardNode) SetChildren(nodes []Node)

func (*ReaderDiscardNode) String

func (n *ReaderDiscardNode) String() string

type ReaderEvalNode

type ReaderEvalNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*ReaderEvalNode) Children

func (n *ReaderEvalNode) Children() []Node

func (*ReaderEvalNode) Parent added in v1.2.0

func (n *ReaderEvalNode) Parent() Node

func (*ReaderEvalNode) SetChildren

func (n *ReaderEvalNode) SetChildren(nodes []Node)

func (*ReaderEvalNode) String

func (n *ReaderEvalNode) String() string

type RegexNode

type RegexNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*RegexNode) Children

func (n *RegexNode) Children() []Node

func (*RegexNode) Parent added in v1.2.0

func (n *RegexNode) Parent() Node

func (*RegexNode) SetChildren

func (n *RegexNode) SetChildren([]Node)

func (*RegexNode) String

func (n *RegexNode) String() string

type SetNode

type SetNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*SetNode) Children

func (n *SetNode) Children() []Node

func (*SetNode) Parent added in v1.2.0

func (n *SetNode) Parent() Node

func (*SetNode) SetChildren

func (n *SetNode) SetChildren(nodes []Node)

func (*SetNode) String

func (n *SetNode) String() string

type StringNode

type StringNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*StringNode) Children

func (n *StringNode) Children() []Node

func (*StringNode) Parent added in v1.2.0

func (n *StringNode) Parent() Node

func (*StringNode) SetChildren

func (n *StringNode) SetChildren([]Node)

func (*StringNode) String

func (n *StringNode) String() string

type SymbolNode

type SymbolNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*SymbolNode) Children

func (n *SymbolNode) Children() []Node

func (*SymbolNode) Parent added in v1.2.0

func (n *SymbolNode) Parent() Node

func (*SymbolNode) SetChildren

func (n *SymbolNode) SetChildren([]Node)

func (*SymbolNode) String

func (n *SymbolNode) String() string

type SyntaxQuoteNode

type SyntaxQuoteNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*SyntaxQuoteNode) Children

func (n *SyntaxQuoteNode) Children() []Node

func (*SyntaxQuoteNode) Parent added in v1.2.0

func (n *SyntaxQuoteNode) Parent() Node

func (*SyntaxQuoteNode) SetChildren

func (n *SyntaxQuoteNode) SetChildren(nodes []Node)

func (*SyntaxQuoteNode) String

func (n *SyntaxQuoteNode) String() string

type TagNode

type TagNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*TagNode) Children

func (n *TagNode) Children() []Node

func (*TagNode) Parent added in v1.2.0

func (n *TagNode) Parent() Node

func (*TagNode) SetChildren

func (n *TagNode) SetChildren([]Node)

func (*TagNode) String

func (n *TagNode) String() string

type Tree

type Tree struct {
	Roots []Node
	// contains filtered or unexported fields
}

func File

func File(filename string, opts ParseOpts) (*Tree, error)

func Reader

func Reader(r io.Reader, filename string, opts ParseOpts) (*Tree, error)

func (*Tree) String

func (t *Tree) String() string

String pretty-prints the tree recursively using each Node's String().

type UnquoteNode

type UnquoteNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*UnquoteNode) Children

func (n *UnquoteNode) Children() []Node

func (*UnquoteNode) Parent added in v1.2.0

func (n *UnquoteNode) Parent() Node

func (*UnquoteNode) SetChildren

func (n *UnquoteNode) SetChildren(nodes []Node)

func (*UnquoteNode) String

func (n *UnquoteNode) String() string

type UnquoteSpliceNode

type UnquoteSpliceNode struct {
	*Pos

	Node Node
	// contains filtered or unexported fields
}

func (*UnquoteSpliceNode) Children

func (n *UnquoteSpliceNode) Children() []Node

func (*UnquoteSpliceNode) Parent added in v1.2.0

func (n *UnquoteSpliceNode) Parent() Node

func (*UnquoteSpliceNode) SetChildren

func (n *UnquoteSpliceNode) SetChildren(nodes []Node)

func (*UnquoteSpliceNode) String

func (n *UnquoteSpliceNode) String() string

type VarQuoteNode

type VarQuoteNode struct {
	*Pos

	Val string
	// contains filtered or unexported fields
}

func (*VarQuoteNode) Children

func (n *VarQuoteNode) Children() []Node

func (*VarQuoteNode) Parent added in v1.2.0

func (n *VarQuoteNode) Parent() Node

func (*VarQuoteNode) SetChildren

func (n *VarQuoteNode) SetChildren([]Node)

func (*VarQuoteNode) String

func (n *VarQuoteNode) String() string

type VectorNode

type VectorNode struct {
	*Pos

	Nodes []Node
	// contains filtered or unexported fields
}

func (*VectorNode) Children

func (n *VectorNode) Children() []Node

func (*VectorNode) Parent added in v1.2.0

func (n *VectorNode) Parent() Node

func (*VectorNode) SetChildren

func (n *VectorNode) SetChildren(nodes []Node)

func (*VectorNode) String

func (n *VectorNode) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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