Documentation
¶
Overview ¶
Package ast ...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expr ¶
type Expr interface {
Accept(v Visitor)
}
Expr defines the expression interface for the visitor to operate on the contents of the expression node.
type Filter ¶
type Filter struct {
Kind Expr
}
Filter stands for a single tq filter. It the fundamental building block of the tq query.
type Identity ¶
type Identity struct{}
Identity specifies the identity data transformation that returns the filtered data argument unchanged.
type Integer ¶
type Integer struct {
Value string
}
Integer represents your everyday integer. It can be used, for example, as an index of a data point in a sequence or a start/stop index of a span.
type Iterator ¶
type Iterator struct{}
Iterator represents a sequeced iterator. The implementation of the iterator for TOML data types is to be provided by the visiting interpreter.
type Query ¶
type Query struct {
Filters []Expr
}
Query represents a single tq query that can be run against a de-serialized TOML data object. It potentially comprises of zero or more filters used to filter the TOML data. Although filters are stored in a slice implying a sequence, the order in not enforced neither by the expression nor the parser. It is the responsibility of the visiting interpreter run against the AST to provide the filtering mechanism.
type Root ¶
type Root struct {
Query Expr
}
Root stands for the top-level root node of the tq query. This version of the tq parser allows a single query, but extending the root to span multiple queries in always an option.
type Selector ¶
type Selector struct {
Value Expr
}
Selector represents a select-driven data filter.
type Span ¶
type Span struct {
Left, Right *Integer
}
Span represents a filter that takes a slice of a list-like sequence.
type String ¶
type String struct {
Value string
}
String represents the key selector that can be used, for instance, in a form of dictionary lookup.
type Visitor ¶
type Visitor interface { VisitRoot(Expr) VisitQuery(Expr) VisitFilter(Expr) VisitIdentity(Expr) VisitSelector(Expr) VisitIterator(Expr) VisitSpan(Expr) VisitString(Expr) VisitInteger(Expr) }
Visitor declares the interface for the AST visitor class. It declares signatures invoked by respective AST expression nodes.