Documentation
¶
Index ¶
- Constants
- Variables
- func PostExclude[T Node](node Node) (Node, *DetailedError)
- func PostNoShebang(node Node) (Node, *DetailedError)
- type CallNode
- type CommentNode
- type DetailedError
- type DirectiveNode
- type ExecNode
- type LiteralNode
- type Locals
- type Node
- type NodeArgs
- type NodeChildren
- type NodeTree
- type Parser
- type PostProcessor
- type Segment
- type StringFormatter
- type StringModifier
- type StringNode
- type TraceItem
- type VariableSegment
Constants ¶
View Source
const ( ERROR_READING = "Reading Error" ERROR_SYNTAX = "Syntax Error" ERROR_INTERNAL = "Internal Error" ERROR_FORMATTING = "Formatting Error" )
Variables ¶
View Source
var EOF = &DetailedError{Name: "EOF"}
Functions ¶
func PostExclude ¶
func PostExclude[T Node](node Node) (Node, *DetailedError)
Discards nodes of type [T] from the tree
func PostNoShebang ¶
func PostNoShebang(node Node) (Node, *DetailedError)
Discards shebang (unix) comment
Types ¶
type CommentNode ¶
type CommentNode struct {
Contents string
}
Can be used for documentation
func (*CommentNode) Node ¶
func (node *CommentNode) Node() string
type DetailedError ¶
func (*DetailedError) BeautyPrint ¶
func (err *DetailedError) BeautyPrint(writer io.Writer)
func (*DetailedError) Error ¶
func (err *DetailedError) Error() string
func (*DetailedError) GetBeautyPrinted ¶
func (err *DetailedError) GetBeautyPrinted() string
type DirectiveNode ¶
type DirectiveNode struct {
Name string
NodeArgs
NodeChildren
}
func (*DirectiveNode) Node ¶
func (node *DirectiveNode) Node() string
type LiteralNode ¶
type LiteralNode struct {
Contents string
}
A literal string does not get modified in any way.
func (*LiteralNode) Node ¶
func (node *LiteralNode) Node() string
type NodeChildren ¶
type NodeChildren []Node
type NodeTree ¶
type NodeTree struct {
Tomes map[string]Node
NodeChildren
}
type Parser ¶
type Parser struct {
Name string
// contains filtered or unexported fields
}
func (*Parser) Parse ¶
func (parser *Parser) Parse() (*NodeTree, *DetailedError)
type PostProcessor ¶
type PostProcessor func(Node) (Node, *DetailedError)
type StringFormatter ¶
type StringFormatter struct {
// contains filtered or unexported fields
}
func NewStringFormatter ¶
func NewStringFormatter(reader *bufio.Reader) *StringFormatter
func (*StringFormatter) Format ¶
func (formatter *StringFormatter) Format() ([]Segment, *DetailedError)
type StringModifier ¶
func GetModifier ¶
func GetModifier(name string, args []string) StringModifier
type StringNode ¶
type StringNode struct {
Contents string
// Holds segments generated by [libparser.StringFormatter]
//
// WARN: Parse() does NOT set it by default.
// Used by other libraries such as `lib-validator` as part of post-processing
Segments []Segment
}
A string that can have variable expansions inside. Uses backticks (`) instead of quotes.
func (*StringNode) Node ¶
func (node *StringNode) Node() string
type VariableSegment ¶
type VariableSegment struct {
Name string
Modifier StringModifier
IsOptional bool
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.