Documentation ¶
Index ¶
- func AddStringToList(list *List, s string) (modified bool)
- func ExpressionsAreSame(a Expression, b Expression) (equal bool, err error)
- func ListIsSorted(list *List) bool
- func Print(file *File) ([]byte, error)
- func PrintExpression(expression Expression) ([]byte, error)
- func RemoveStringFromList(list *List, s string) (modified bool)
- func SortList(file *File, list *List)
- func SortLists(file *File)
- type Assignment
- type Bool
- type Comment
- type CommentGroup
- type Definition
- type Expression
- type File
- type Int64
- type List
- type Map
- func (x *Map) Copy() Expression
- func (x *Map) End() scanner.Position
- func (x *Map) Eval() Expression
- func (x *Map) GetProperty(name string) (Property *Property, found bool)
- func (x *Map) Pos() scanner.Position
- func (x *Map) RemoveProperty(propertyName string) (removed bool)
- func (x *Map) String() string
- func (x *Map) Type() Type
- type Module
- type Node
- type NotEvaluated
- type Operator
- type ParseError
- type Patch
- type PatchList
- type PatchOverlapError
- type Property
- type Scope
- type String
- type Type
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStringToList ¶
func ExpressionsAreSame ¶
func ExpressionsAreSame(a Expression, b Expression) (equal bool, err error)
ExpressionsAreSame tells whether the two values are the same Expression. This includes the symbolic representation of each Expression but not their positions in the original source tree. This does not apply any simplification to the expressions before comparing them (for example, "!!a" wouldn't be deemed equal to "a")
func ListIsSorted ¶
func PrintExpression ¶
func PrintExpression(expression Expression) ([]byte, error)
func RemoveStringFromList ¶
Types ¶
type Assignment ¶
type Assignment struct { Name string NamePos scanner.Position Value Expression OrigValue Expression EqualsPos scanner.Position Assigner string Referenced bool }
An Assignment is a variable assignment at the top level of a Blueprints file, scoped to the file and and subdirs.
func (*Assignment) End ¶
func (a *Assignment) End() scanner.Position
func (*Assignment) Pos ¶
func (a *Assignment) Pos() scanner.Position
func (*Assignment) String ¶
func (a *Assignment) String() string
type Bool ¶
func (*Bool) Copy ¶
func (x *Bool) Copy() Expression
func (*Bool) Eval ¶
func (x *Bool) Eval() Expression
type CommentGroup ¶
type CommentGroup struct {
Comments []*Comment
}
func (*CommentGroup) End ¶
func (x *CommentGroup) End() scanner.Position
func (*CommentGroup) Pos ¶
func (x *CommentGroup) Pos() scanner.Position
type Definition ¶
Definition is an Assignment or a Module at the top level of a Blueprints file
type Expression ¶
type Expression interface { Node // Copy returns a copy of the Expression that will not affect the original if mutated Copy() Expression String() string // Type returns the underlying Type enum of the Expression if it were to be evalutated Type() Type // Eval returns an expression that is fully evaluated to a simple type (List, Map, String, or // Bool). It will return the same object for every call to Eval(). Eval() Expression }
An Expression is a Value in a Property or Assignment. It can be a literal (String or Bool), a Map, a List, an Operator that combines two expressions of the same type, or a Variable that references and Assignment.
type File ¶
type File struct { Name string Defs []Definition Comments []*CommentGroup }
func ParseAndEval ¶
type Int64 ¶
func (*Int64) Copy ¶
func (x *Int64) Copy() Expression
func (*Int64) Eval ¶
func (x *Int64) Eval() Expression
type List ¶
type List struct { LBracePos scanner.Position RBracePos scanner.Position Values []Expression }
func (*List) Copy ¶
func (x *List) Copy() Expression
func (*List) Eval ¶
func (x *List) Eval() Expression
type Map ¶
func (*Map) Copy ¶
func (x *Map) Copy() Expression
func (*Map) Eval ¶
func (x *Map) Eval() Expression
func (*Map) GetProperty ¶
GetProperty looks for a property with the given name. It resembles the bracket operator of a built-in Golang map.
func (*Map) RemoveProperty ¶
GetProperty removes the property with the given name, if it exists.
type NotEvaluated ¶
func (NotEvaluated) Copy ¶
func (n NotEvaluated) Copy() Expression
func (NotEvaluated) End ¶
func (n NotEvaluated) End() scanner.Position
func (NotEvaluated) Eval ¶
func (n NotEvaluated) Eval() Expression
func (NotEvaluated) Pos ¶
func (n NotEvaluated) Pos() scanner.Position
func (NotEvaluated) String ¶
func (n NotEvaluated) String() string
func (NotEvaluated) Type ¶
func (n NotEvaluated) Type() Type
type Operator ¶
type Operator struct { Args [2]Expression Operator rune OperatorPos scanner.Position Value Expression }
func (*Operator) Copy ¶
func (x *Operator) Copy() Expression
func (*Operator) Eval ¶
func (x *Operator) Eval() Expression
type ParseError ¶
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type Patch ¶
A Patch represents a region of a text buffer to be replaced [Start, End) and its Replacement
type PatchList ¶
type PatchList []Patch
A PatchList is a list of sorted, non-overlapping Patch objects
type PatchOverlapError ¶
type PatchOverlapError error
type Property ¶
type Property struct { Name string NamePos scanner.Position ColonPos scanner.Position Value Expression }
A Property is a name: value pair within a Map, which may be a top level Module.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
func (*Scope) Add ¶
func (s *Scope) Add(assignment *Assignment) error
type String ¶
func (*String) Copy ¶
func (x *String) Copy() Expression
func (*String) Eval ¶
func (x *String) Eval() Expression
type Variable ¶
type Variable struct { Name string NamePos scanner.Position Value Expression }
func (*Variable) Copy ¶
func (x *Variable) Copy() Expression
func (*Variable) Eval ¶
func (x *Variable) Eval() Expression