Documentation ¶
Index ¶
- Constants
- func InterpolateStr(str string, pos *Pos) (interfaces.Expr, error)
- func LexParse(input io.Reader) (interfaces.Stmt, error)
- type ExprBool
- func (obj *ExprBool) Func() (interfaces.Func, error)
- func (obj *ExprBool) Graph() (*pgraph.Graph, error)
- func (obj *ExprBool) Interpolate() (interfaces.Expr, error)
- func (obj *ExprBool) SetScope(*interfaces.Scope) error
- func (obj *ExprBool) SetType(typ *types.Type) error
- func (obj *ExprBool) SetValue(value types.Value) error
- func (obj *ExprBool) String() string
- func (obj *ExprBool) Type() (*types.Type, error)
- func (obj *ExprBool) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprBool) Value() (types.Value, error)
- type ExprCall
- func (obj *ExprCall) Func() (interfaces.Func, error)
- func (obj *ExprCall) Graph() (*pgraph.Graph, error)
- func (obj *ExprCall) Interpolate() (interfaces.Expr, error)
- func (obj *ExprCall) SetScope(scope *interfaces.Scope) error
- func (obj *ExprCall) SetType(typ *types.Type) error
- func (obj *ExprCall) SetValue(value types.Value) error
- func (obj *ExprCall) String() string
- func (obj *ExprCall) Type() (*types.Type, error)
- func (obj *ExprCall) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprCall) Value() (types.Value, error)
- type ExprFloat
- func (obj *ExprFloat) Func() (interfaces.Func, error)
- func (obj *ExprFloat) Graph() (*pgraph.Graph, error)
- func (obj *ExprFloat) Interpolate() (interfaces.Expr, error)
- func (obj *ExprFloat) SetScope(*interfaces.Scope) error
- func (obj *ExprFloat) SetType(typ *types.Type) error
- func (obj *ExprFloat) SetValue(value types.Value) error
- func (obj *ExprFloat) String() string
- func (obj *ExprFloat) Type() (*types.Type, error)
- func (obj *ExprFloat) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprFloat) Value() (types.Value, error)
- type ExprFunc
- func (obj *ExprFunc) Func() (interfaces.Func, error)
- func (obj *ExprFunc) Graph() (*pgraph.Graph, error)
- func (obj *ExprFunc) Interpolate() (interfaces.Expr, error)
- func (obj *ExprFunc) SetScope(*interfaces.Scope) error
- func (obj *ExprFunc) SetType(typ *types.Type) error
- func (obj *ExprFunc) SetValue(value types.Value) error
- func (obj *ExprFunc) String() string
- func (obj *ExprFunc) Type() (*types.Type, error)
- func (obj *ExprFunc) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprFunc) Value() (types.Value, error)
- type ExprIf
- func (obj *ExprIf) Func() (interfaces.Func, error)
- func (obj *ExprIf) Graph() (*pgraph.Graph, error)
- func (obj *ExprIf) Interpolate() (interfaces.Expr, error)
- func (obj *ExprIf) SetScope(scope *interfaces.Scope) error
- func (obj *ExprIf) SetType(typ *types.Type) error
- func (obj *ExprIf) SetValue(value types.Value) error
- func (obj *ExprIf) String() string
- func (obj *ExprIf) Type() (*types.Type, error)
- func (obj *ExprIf) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprIf) Value() (types.Value, error)
- type ExprInt
- func (obj *ExprInt) Func() (interfaces.Func, error)
- func (obj *ExprInt) Graph() (*pgraph.Graph, error)
- func (obj *ExprInt) Interpolate() (interfaces.Expr, error)
- func (obj *ExprInt) SetScope(*interfaces.Scope) error
- func (obj *ExprInt) SetType(typ *types.Type) error
- func (obj *ExprInt) SetValue(value types.Value) error
- func (obj *ExprInt) String() string
- func (obj *ExprInt) Type() (*types.Type, error)
- func (obj *ExprInt) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprInt) Value() (types.Value, error)
- type ExprList
- func (obj *ExprList) Func() (interfaces.Func, error)
- func (obj *ExprList) Graph() (*pgraph.Graph, error)
- func (obj *ExprList) Interpolate() (interfaces.Expr, error)
- func (obj *ExprList) SetScope(scope *interfaces.Scope) error
- func (obj *ExprList) SetType(typ *types.Type) error
- func (obj *ExprList) SetValue(value types.Value) error
- func (obj *ExprList) String() string
- func (obj *ExprList) Type() (*types.Type, error)
- func (obj *ExprList) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprList) Value() (types.Value, error)
- type ExprMap
- func (obj *ExprMap) Func() (interfaces.Func, error)
- func (obj *ExprMap) Graph() (*pgraph.Graph, error)
- func (obj *ExprMap) Interpolate() (interfaces.Expr, error)
- func (obj *ExprMap) SetScope(scope *interfaces.Scope) error
- func (obj *ExprMap) SetType(typ *types.Type) error
- func (obj *ExprMap) SetValue(value types.Value) error
- func (obj *ExprMap) String() string
- func (obj *ExprMap) Type() (*types.Type, error)
- func (obj *ExprMap) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprMap) Value() (types.Value, error)
- type ExprMapKV
- type ExprStr
- func (obj *ExprStr) Func() (interfaces.Func, error)
- func (obj *ExprStr) Graph() (*pgraph.Graph, error)
- func (obj *ExprStr) Interpolate() (interfaces.Expr, error)
- func (obj *ExprStr) SetScope(*interfaces.Scope) error
- func (obj *ExprStr) SetType(typ *types.Type) error
- func (obj *ExprStr) SetValue(value types.Value) error
- func (obj *ExprStr) String() string
- func (obj *ExprStr) Type() (*types.Type, error)
- func (obj *ExprStr) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprStr) Value() (types.Value, error)
- type ExprStruct
- func (obj *ExprStruct) Func() (interfaces.Func, error)
- func (obj *ExprStruct) Graph() (*pgraph.Graph, error)
- func (obj *ExprStruct) Interpolate() (interfaces.Expr, error)
- func (obj *ExprStruct) SetScope(scope *interfaces.Scope) error
- func (obj *ExprStruct) SetType(typ *types.Type) error
- func (obj *ExprStruct) SetValue(value types.Value) error
- func (obj *ExprStruct) String() string
- func (obj *ExprStruct) Type() (*types.Type, error)
- func (obj *ExprStruct) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprStruct) Value() (types.Value, error)
- type ExprStructField
- type ExprVar
- func (obj *ExprVar) Func() (interfaces.Func, error)
- func (obj *ExprVar) Graph() (*pgraph.Graph, error)
- func (obj *ExprVar) Interpolate() (interfaces.Expr, error)
- func (obj *ExprVar) SetScope(scope *interfaces.Scope) error
- func (obj *ExprVar) SetType(typ *types.Type) error
- func (obj *ExprVar) SetValue(value types.Value) error
- func (obj *ExprVar) String() string
- func (obj *ExprVar) Type() (*types.Type, error)
- func (obj *ExprVar) Unify() ([]interfaces.Invariant, error)
- func (obj *ExprVar) Value() (types.Value, error)
- type GAPI
- func (obj *GAPI) Cli(c *cli.Context, fs resources.Fs) (*gapi.Deploy, error)
- func (obj *GAPI) CliFlags() []cli.Flag
- func (obj *GAPI) Close() error
- func (obj *GAPI) Graph() (*pgraph.Graph, error)
- func (obj *GAPI) Init(data gapi.Data) error
- func (obj *GAPI) LangClose() error
- func (obj *GAPI) LangInit() error
- func (obj *GAPI) Next() chan gapi.Next
- type Lang
- type LexParseErr
- type Pos
- type StmtBind
- type StmtComment
- func (obj *StmtComment) Graph() (*pgraph.Graph, error)
- func (obj *StmtComment) Interpolate() (interfaces.Stmt, error)
- func (obj *StmtComment) Output() (*interfaces.Output, error)
- func (obj *StmtComment) SetScope(*interfaces.Scope) error
- func (obj *StmtComment) Unify() ([]interfaces.Invariant, error)
- type StmtEdge
- type StmtEdgeHalf
- type StmtIf
- type StmtProg
- type StmtRes
- type StmtResContents
- type StmtResEdge
- type StmtResField
Constants ¶
const ( // Name is the name of this frontend. Name = "lang" // Start is the entry point filename that we use. It is arbitrary. Start = "/start." + FileNameExtension // FIXME: replace with a proper code entry point schema (directory schema) )
const ( ErrLexerUnrecognized = interfaces.Error("unrecognized") ErrLexerStringBadEscaping = interfaces.Error("string: bad escaping") ErrLexerIntegerOverflow = interfaces.Error("integer: overflow") ErrLexerFloatOverflow = interfaces.Error("float: overflow") ErrParseError = interfaces.Error("parser") ErrParseAdditionalEquals = interfaces.Error(errstrParseAdditionalEquals) ErrParseExpectingComma = interfaces.Error(errstrParseExpectingComma) )
These constants represent the different possible lexer/parser errors.
const ( // EdgeNotify declares an edge a -> b, such that a notification occurs. // This is most similar to "notify" in Puppet. EdgeNotify = "notify" // EdgeBefore declares an edge a -> b, such that no notification occurs. // This is most similar to "before" in Puppet. EdgeBefore = "before" // EdgeListen declares an edge a <- b, such that a notification occurs. // This is most similar to "subscribe" in Puppet. EdgeListen = "listen" // EdgeDepend declares an edge a <- b, such that no notification occurs. // This is most similar to "require" in Puppet. EdgeDepend = "depend" )
const ( // FileNameExtension is the filename extension used for languages files. FileNameExtension = "mcl" // alternate suggestions welcome! )
Variables ¶
This section is empty.
Functions ¶
func InterpolateStr ¶
func InterpolateStr(str string, pos *Pos) (interfaces.Expr, error)
InterpolateStr interpolates a string and returns the representative AST. This particular implementation uses the hashicorp hil library and syntax to do so.
Types ¶
type ExprBool ¶
type ExprBool struct {
V bool
}
ExprBool is a representation of a boolean.
func (*ExprBool) Func ¶
func (obj *ExprBool) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprBool) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it.
func (*ExprBool) Interpolate ¶
func (obj *ExprBool) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it simply returns itself, as no interpolation is possible.
func (*ExprBool) SetScope ¶
func (obj *ExprBool) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope.
func (*ExprBool) SetType ¶
SetType will make no changes if called here. It will error if anything other than a Bool is passed in, and doesn't need to be called for this expr to work.
func (*ExprBool) SetValue ¶
SetValue for a bool expression is always populated statically, and does not ever receive any incoming values (no incoming edges) so this should never be called. It has been implemented for uniformity.
func (*ExprBool) Type ¶
Type returns the type of this expression. This method always returns Bool here.
func (*ExprBool) Unify ¶
func (obj *ExprBool) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprBool) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular value is always known since it is a constant.
type ExprCall ¶
type ExprCall struct { V types.Value // stored result (set with SetValue) Name string Args []interfaces.Expr // list of args in parsed order // contains filtered or unexported fields }
ExprCall is a representation of a function call. This does not represent the declaration or implementation of a new function value.
func (*ExprCall) Func ¶
func (obj *ExprCall) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprCall) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it, and the edges from all of the child graphs to this.
func (*ExprCall) Interpolate ¶
func (obj *ExprCall) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*ExprCall) SetScope ¶
func (obj *ExprCall) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*ExprCall) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error. Remember that for this function expression, the type is the *return type* of the function, not the full type of the function signature.
func (*ExprCall) SetValue ¶
SetValue here is used to store the result of the last computation of this expression node after it has received all the required input values. This value is cached and can be retrieved by calling Value.
func (*ExprCall) Type ¶
Type returns the type of this expression, which is the return type of the function call.
func (*ExprCall) Unify ¶
func (obj *ExprCall) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprCall) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. It is often unlikely that this kind of speculative execution finds something. This particular implementation of the function returns the previously stored and cached value as received by SetValue.
type ExprFloat ¶
type ExprFloat struct {
V float64
}
ExprFloat is a representation of a float.
func (*ExprFloat) Func ¶
func (obj *ExprFloat) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprFloat) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it.
func (*ExprFloat) Interpolate ¶
func (obj *ExprFloat) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it simply returns itself, as no interpolation is possible.
func (*ExprFloat) SetScope ¶
func (obj *ExprFloat) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope.
func (*ExprFloat) SetType ¶
SetType will make no changes if called here. It will error if anything other than a Float is passed in, and doesn't need to be called for this expr to work.
func (*ExprFloat) SetValue ¶
SetValue for a float expression is always populated statically, and does not ever receive any incoming values (no incoming edges) so this should never be called. It has been implemented for uniformity.
func (*ExprFloat) Type ¶
Type returns the type of this expression. This method always returns Float here.
func (*ExprFloat) Unify ¶
func (obj *ExprFloat) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprFloat) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular value is always known since it is a constant.
type ExprFunc ¶
type ExprFunc struct { V func([]types.Value) (types.Value, error) // contains filtered or unexported fields }
ExprFunc is a representation of a function value. This is not a function call, that is represented by ExprCall. XXX: this is currently not fully implemented, and parts may be incorrect.
func (*ExprFunc) Func ¶
func (obj *ExprFunc) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprFunc) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it.
func (*ExprFunc) Interpolate ¶
func (obj *ExprFunc) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it simply returns itself, as no interpolation is possible.
func (*ExprFunc) SetScope ¶
func (obj *ExprFunc) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope. XXX: this may not be true in the future...
func (*ExprFunc) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprFunc) SetValue ¶
SetValue for a func expression is always populated statically, and does not ever receive any incoming values (no incoming edges) so this should never be called. It has been implemented for uniformity.
func (*ExprFunc) String ¶
String returns a short representation of this expression. FIXME: fmt.Sprintf("func(%+v)", obj.V) fails `go vet` (bug?), so wait until we have a better printable function value and put that here instead.
func (*ExprFunc) Unify ¶
func (obj *ExprFunc) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprFunc) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular value is always known since it is a constant.
type ExprIf ¶
type ExprIf struct { Condition interfaces.Expr ThenBranch interfaces.Expr // could be an ExprBranch ElseBranch interfaces.Expr // could be an ExprBranch // contains filtered or unexported fields }
ExprIf represents an if expression which *must* have both branches, and which returns a value. As a result, it has a type. This is different from a StmtIf, which does not need to have both branches, and which does not return a value.
func (*ExprIf) Func ¶
func (obj *ExprIf) Func() (interfaces.Func, error)
Func returns a function which returns the correct branch based on the ever changing conditional boolean input.
func (*ExprIf) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This particular if expression doesn't do anything clever here other than adding in both branches of the graph. Since we're functional, this shouldn't have any ill effects. XXX: is this completely true if we're running technically impure, but safe built-in functions on both branches? Can we turn off half of this?
func (*ExprIf) Interpolate ¶
func (obj *ExprIf) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*ExprIf) SetScope ¶
func (obj *ExprIf) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*ExprIf) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprIf) SetValue ¶
SetValue here is a no-op, because algorithmically when this is called from the func engine, the child fields (the branches expr's) will have had this done to them first, and as such when we try and retrieve the set value from this expression by calling `Value`, it will build it from scratch!
func (*ExprIf) Unify ¶
func (obj *ExprIf) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprIf) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular expression evaluates the condition and returns the correct branch's value accordingly.
type ExprInt ¶
type ExprInt struct {
V int64
}
ExprInt is a representation of an int.
func (*ExprInt) Func ¶
func (obj *ExprInt) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprInt) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it.
func (*ExprInt) Interpolate ¶
func (obj *ExprInt) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it simply returns itself, as no interpolation is possible.
func (*ExprInt) SetScope ¶
func (obj *ExprInt) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope.
func (*ExprInt) SetType ¶
SetType will make no changes if called here. It will error if anything other than an Int is passed in, and doesn't need to be called for this expr to work.
func (*ExprInt) SetValue ¶
SetValue for an int expression is always populated statically, and does not ever receive any incoming values (no incoming edges) so this should never be called. It has been implemented for uniformity.
func (*ExprInt) Type ¶
Type returns the type of this expression. This method always returns Int here.
func (*ExprInt) Unify ¶
func (obj *ExprInt) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprInt) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular value is always known since it is a constant.
type ExprList ¶
type ExprList struct { //Elements []*ExprListElement Elements []interfaces.Expr // contains filtered or unexported fields }
ExprList is a representation of a list.
func (*ExprList) Func ¶
func (obj *ExprList) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprList) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it, and the edges from all of the child graphs to this.
func (*ExprList) Interpolate ¶
func (obj *ExprList) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*ExprList) SetScope ¶
func (obj *ExprList) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*ExprList) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprList) SetValue ¶
SetValue here is a no-op, because algorithmically when this is called from the func engine, the child elements (the list elements) will have had this done to them first, and as such when we try and retrieve the set value from this expression by calling `Value`, it will build it from scratch!
func (*ExprList) Unify ¶
func (obj *ExprList) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
type ExprMap ¶
type ExprMap struct { KVs []*ExprMapKV // contains filtered or unexported fields }
ExprMap is a representation of a (dictionary) map.
func (*ExprMap) Func ¶
func (obj *ExprMap) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprMap) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it, and the edges from all of the child graphs to this.
func (*ExprMap) Interpolate ¶
func (obj *ExprMap) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*ExprMap) SetScope ¶
func (obj *ExprMap) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*ExprMap) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprMap) SetValue ¶
SetValue here is a no-op, because algorithmically when this is called from the func engine, the child key/value's (the map elements) will have had this done to them first, and as such when we try and retrieve the set value from this expression by calling `Value`, it will build it from scratch!
func (*ExprMap) Unify ¶
func (obj *ExprMap) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
type ExprMapKV ¶
type ExprMapKV struct { Key interfaces.Expr // keys can be strings, int's, etc... Val interfaces.Expr }
ExprMapKV represents a key and value pair in a (dictionary) map. This does not satisfy the Expr interface.
type ExprStr ¶
type ExprStr struct {
V string // value of this string
}
ExprStr is a representation of a string.
func (*ExprStr) Func ¶
func (obj *ExprStr) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprStr) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it.
func (*ExprStr) Interpolate ¶
func (obj *ExprStr) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it attempts to expand the string if there are any internal variables which need interpolation. If any are found, it returns a larger AST which has a function which returns a string as its root. Otherwise it returns itself.
func (*ExprStr) SetScope ¶
func (obj *ExprStr) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope.
func (*ExprStr) SetType ¶
SetType will make no changes if called here. It will error if anything other than an Str is passed in, and doesn't need to be called for this expr to work.
func (*ExprStr) SetValue ¶
SetValue for an str expression is always populated statically, and does not ever receive any incoming values (no incoming edges) so this should never be called. It has been implemented for uniformity.
func (*ExprStr) Type ¶
Type returns the type of this expression. This method always returns Str here.
func (*ExprStr) Unify ¶
func (obj *ExprStr) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprStr) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This particular value is always known since it is a constant.
type ExprStruct ¶
type ExprStruct struct { Fields []*ExprStructField // the list (fields) are intentionally ordered! // contains filtered or unexported fields }
ExprStruct is a representation of a struct.
func (*ExprStruct) Func ¶
func (obj *ExprStruct) Func() (interfaces.Func, error)
Func returns the reactive stream of values that this expression produces.
func (*ExprStruct) Graph ¶
func (obj *ExprStruct) Graph() (*pgraph.Graph, error)
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it, and the edges from all of the child graphs to this.
func (*ExprStruct) Interpolate ¶
func (obj *ExprStruct) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*ExprStruct) SetScope ¶
func (obj *ExprStruct) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*ExprStruct) SetType ¶
func (obj *ExprStruct) SetType(typ *types.Type) error
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprStruct) SetValue ¶
func (obj *ExprStruct) SetValue(value types.Value) error
SetValue here is a no-op, because algorithmically when this is called from the func engine, the child fields (the struct elements) will have had this done to them first, and as such when we try and retrieve the set value from this expression by calling `Value`, it will build it from scratch!
func (*ExprStruct) String ¶
func (obj *ExprStruct) String() string
String returns a short representation of this expression.
func (*ExprStruct) Type ¶
func (obj *ExprStruct) Type() (*types.Type, error)
Type returns the type of this expression.
func (*ExprStruct) Unify ¶
func (obj *ExprStruct) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprStruct) Value ¶
func (obj *ExprStruct) Value() (types.Value, error)
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more.
type ExprStructField ¶
type ExprStructField struct { Name string Value interfaces.Expr }
ExprStructField represents a name value pair in a struct field. This does not satisfy the Expr interface.
type ExprVar ¶
type ExprVar struct { Name string // name of the variable // contains filtered or unexported fields }
ExprVar is a representation of a variable lookup. It returns the expression that that variable refers to.
func (*ExprVar) Func ¶
func (obj *ExprVar) Func() (interfaces.Func, error)
Func returns a "pass-through" function which receives the bound value, and passes it to the consumer. This is essential for satisfying the type checker of the function graph engine.
func (*ExprVar) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This returns a graph with a single vertex (itself) in it, and the edges from all of the child graphs to this. The child graph in this case is the graph which is obtained from the bound expression. The edge points from that expression to this vertex. The function used for this vertex is a simple placeholder which sucks incoming values in and passes them on. This is important for filling the logical requirements of the graph type checker, and to avoid duplicating production of the incoming input value from the bound expression.
func (*ExprVar) Interpolate ¶
func (obj *ExprVar) Interpolate() (interfaces.Expr, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it returns itself, since variable names cannot be interpolated. We don't support variable, variables or anything crazy like that.
func (*ExprVar) SetScope ¶
func (obj *ExprVar) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for use in this resource.
func (*ExprVar) SetType ¶
SetType is used to set the type of this expression once it is known. This usually happens during type unification, but it can also happen during parsing if a type is specified explicitly. Since types are static and don't change on expressions, if you attempt to set a different type than what has previously been set (when not initially known) this will error.
func (*ExprVar) SetValue ¶
SetValue here is a no-op, because algorithmically when this is called from the func engine, the child fields (the dest lookup expr) will have had this done to them first, and as such when we try and retrieve the set value from this expression by calling `Value`, it will build it from scratch!
func (*ExprVar) Unify ¶
func (obj *ExprVar) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
func (*ExprVar) Value ¶
Value returns the value of this expression in our type system. This will usually only be valid once the engine has run and values have been produced. This might get called speculatively (early) during unification to learn more. This returns the value this variable points to. It is able to do so because it can lookup in the previous set scope which expression this points to, and then it can call Value on that expression.
type GAPI ¶
type GAPI struct { InputURI string // input URI of code file system to run // contains filtered or unexported fields }
GAPI implements the main lang GAPI interface.
func (*GAPI) Cli ¶
Cli takes a cli.Context, and returns our GAPI if activated. All arguments should take the prefix of the registered name. On activation, if there are any validation problems, you should return an error. If this was not activated, then you should return a nil GAPI and a nil error.
type Lang ¶
type Lang struct { Input io.Reader // os.Stdin or anything that satisfies this interface Hostname string World resources.World Debug bool // contains filtered or unexported fields }
Lang is the main language lexer/parser object.
func (*Lang) Close ¶
Close shuts down the lang struct and causes all the funcs to shutdown. It must be called when finished after any successful Init ran.
func (*Lang) Init ¶
Init initializes the lang struct, and starts up the initial data sources. NOTE: The trick is that we need to get the list of funcs to watch AND start watching them, *before* we pull their values, that way we'll know if they changed from the values we wanted.
type LexParseErr ¶
type LexParseErr struct { Err interfaces.Error Str string Row int // this is zero-indexed (the first line is 0) Col int // this is zero-indexed (the first char is 0) }
LexParseErr is a permanent failure error to notify about borkage.
func (*LexParseErr) Error ¶
func (e *LexParseErr) Error() string
Error displays this error with all the relevant state information.
type Pos ¶
type Pos struct { Line int // line number starting at 1 Column int // column number starting at 1 Filename string // optional source filename, if known }
Pos represents a position in the code. TODO: consider expanding with range characteristics.
type StmtBind ¶
type StmtBind struct { Ident string Value interfaces.Expr }
StmtBind is a representation of an assignment, which binds a variable to an expression.
func (*StmtBind) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This particular bind statement adds its linked expression to the graph. It is not logically done in the ExprVar since that could exist multiple times for the single binding operation done here.
func (*StmtBind) Interpolate ¶
func (obj *StmtBind) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*StmtBind) Output ¶
func (obj *StmtBind) Output() (*interfaces.Output, error)
Output for the bind statement produces no output. Any values of interest come from the use of the var which this binds the expression to.
type StmtComment ¶
type StmtComment struct {
Value string
}
StmtComment is a representation of a comment. It is currently unused. It probably makes sense to make a third kind of Node (not a Stmt or an Expr) so that comments can still be part of the AST (for eventual automatic code formatting) but so that they can exist anywhere in the code. Currently these are dropped by the lexer.
func (*StmtComment) Graph ¶
func (obj *StmtComment) Graph() (*pgraph.Graph, error)
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This particular graph does nothing clever.
func (*StmtComment) Interpolate ¶
func (obj *StmtComment) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. Here it simply returns itself, as no interpolation is possible.
func (*StmtComment) Output ¶
func (obj *StmtComment) Output() (*interfaces.Output, error)
Output for the comment statement produces no output.
func (*StmtComment) SetScope ¶
func (obj *StmtComment) SetScope(*interfaces.Scope) error
SetScope does nothing for this struct, because it has no child nodes, and it does not need to know about the parent scope.
func (*StmtComment) Unify ¶
func (obj *StmtComment) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
type StmtEdge ¶
type StmtEdge struct { EdgeHalfList []*StmtEdgeHalf // represents a chain of edges // TODO: should notify be an Expr? Notify bool // specifies that this edge sends a notification as well }
StmtEdge is a representation of a dependency. It also supports send/recv. Edges represents that the first resource (Kind/Name) listed in the EdgeHalfList should happen in the resource graph *before* the next resource in the list. If there are multiple StmtEdgeHalf structs listed, then they should represent a chain, eg: a->b->c, should compile into a->b & b->c. If specified, values are sent and received along these edges if the Send/Recv names are compatible and listed. In this case of Send/Recv, only lists of length two are legal.
func (*StmtEdge) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. It is interesting to note that nothing directly adds an edge to the edges created, but rather, once all the values (expressions) with no outgoing function graph edges have produced at least a single value, then the edges know they're able to be built.
func (*StmtEdge) Interpolate ¶
func (obj *StmtEdge) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. TODO: could we expand the Name's from the EdgeHalf (if they're lists) to have them return a list of Edges's ? XXX: type check the kind1:send -> kind2:recv fields are compatible! XXX: we won't know the names yet, but it's okay.
func (*StmtEdge) Output ¶
func (obj *StmtEdge) Output() (*interfaces.Output, error)
Output returns the output that this "program" produces. This output is what is used to build the output graph. This only exists for statements. The analogous function for expressions is Value. Those Value functions might get called by this Output function if they are needed to produce the output. In the case of this edge statement, this is definitely the case. This edge stmt returns output consisting of edges.
type StmtEdgeHalf ¶
type StmtEdgeHalf struct { Kind string // kind of resource, eg: pkg, file, svc, etc... Name interfaces.Expr // unique name for the res of this kind SendRecv string // name of field to send/recv from, empty to ignore }
StmtEdgeHalf represents half of an edge in the parsed edge representation. This does not satisfy the Stmt interface.
func (*StmtEdgeHalf) Graph ¶
func (obj *StmtEdgeHalf) Graph() (*pgraph.Graph, error)
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. It is interesting to note that nothing directly adds an edge to the resources created, but rather, once all the values (expressions) with no outgoing edges have produced at least a single value, then the resources know they're able to be built.
func (*StmtEdgeHalf) Interpolate ¶
func (obj *StmtEdgeHalf) Interpolate() (*StmtEdgeHalf, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. This interpolate is different It is different from the interpolate found in the Expr and Stmt interfaces because it returns a different type as output.
func (*StmtEdgeHalf) SetScope ¶
func (obj *StmtEdgeHalf) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*StmtEdgeHalf) Unify ¶
func (obj *StmtEdgeHalf) Unify() ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller.
type StmtIf ¶
type StmtIf struct { Condition interfaces.Expr ThenBranch interfaces.Stmt // optional, but usually present ElseBranch interfaces.Stmt // optional }
StmtIf represents an if condition that contains between one and two branches of statements to be executed based on the evaluation of the boolean condition over time. In particular, this is different from an ExprIf which returns a value, where as this produces some Output. Normally if one of the branches is optional, it is the else branch, although this struct allows either to be optional, even if it is not commonly used.
func (*StmtIf) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. This particular if statement doesn't do anything clever here other than adding in both branches of the graph. Since we're functional, this shouldn't have any ill effects. XXX: is this completely true if we're running technically impure, but safe built-in functions on both branches? Can we turn off half of this?
func (*StmtIf) Interpolate ¶
func (obj *StmtIf) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*StmtIf) Output ¶
func (obj *StmtIf) Output() (*interfaces.Output, error)
Output returns the output that this "program" produces. This output is what is used to build the output graph. This only exists for statements. The analogous function for expressions is Value. Those Value functions might get called by this Output function if they are needed to produce the output.
type StmtProg ¶
type StmtProg struct {
Prog []interfaces.Stmt
}
StmtProg represents a list of stmt's. This usually occurs at the top-level of any program, and often within an if stmt. It also contains the logic so that the bind statement's are correctly applied in this scope, and irrespective of their order of definition.
func (*StmtProg) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might.
func (*StmtProg) Interpolate ¶
func (obj *StmtProg) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*StmtProg) Output ¶
func (obj *StmtProg) Output() (*interfaces.Output, error)
Output returns the output that this "program" produces. This output is what is used to build the output graph. This only exists for statements. The analogous function for expressions is Value. Those Value functions might get called by this Output function if they are needed to produce the output.
func (*StmtProg) SetScope ¶
func (obj *StmtProg) SetScope(scope *interfaces.Scope) error
SetScope propagates the scope into its list of statements. It does so cleverly by first collecting all bind statements and adding those into the scope after checking for any collisions. Finally it pushes the new scope downwards to all child statements.
type StmtRes ¶
type StmtRes struct { Kind string // kind of resource, eg: pkg, file, svc, etc... Name interfaces.Expr // unique name for the res of this kind Contents []StmtResContents // list of fields/edges in parsed order }
StmtRes is a representation of a resource and possibly some edges. TODO: consider expanding Name (if it's a list) to have this return a list of Res's in the Output function. Alternatively, it could be a map[name]struct{}, or even a map[[]name]struct{}.
func (*StmtRes) Graph ¶
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. It is interesting to note that nothing directly adds an edge to the resources created, but rather, once all the values (expressions) with no outgoing edges have produced at least a single value, then the resources know they're able to be built.
func (*StmtRes) Interpolate ¶
func (obj *StmtRes) Interpolate() (interfaces.Stmt, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents.
func (*StmtRes) Output ¶
func (obj *StmtRes) Output() (*interfaces.Output, error)
Output returns the output that this "program" produces. This output is what is used to build the output graph. This only exists for statements. The analogous function for expressions is Value. Those Value functions might get called by this Output function if they are needed to produce the output. In the case of this resource statement, this is definitely the case. XXX: Add MetaParams as a simple meta field with a struct of the right type...
type StmtResContents ¶
type StmtResContents interface { Interpolate() (StmtResContents, error) // different! SetScope(*interfaces.Scope) error Unify(kind string) ([]interfaces.Invariant, error) // different! Graph() (*pgraph.Graph, error) }
StmtResContents is the interface that is met by the resource contents. Look closely for while it is similar to the Stmt interface, it is quite different.
type StmtResEdge ¶
type StmtResEdge struct { Property string // TODO: iota constant instead? EdgeHalf *StmtEdgeHalf Condition interfaces.Expr // the value will be used if nil or true }
StmtResEdge represents a single edge property in the parsed resource representation. This does not satisfy the Stmt interface.
func (*StmtResEdge) Graph ¶
func (obj *StmtResEdge) Graph() (*pgraph.Graph, error)
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. It is interesting to note that nothing directly adds an edge to the resources created, but rather, once all the values (expressions) with no outgoing edges have produced at least a single value, then the resources know they're able to be built.
func (*StmtResEdge) Interpolate ¶
func (obj *StmtResEdge) Interpolate() (StmtResContents, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. This interpolate is different It is different from the interpolate found in the Expr and Stmt interfaces because it returns a different type as output.
func (*StmtResEdge) SetScope ¶
func (obj *StmtResEdge) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*StmtResEdge) Unify ¶
func (obj *StmtResEdge) Unify(kind string) ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller. It is different from the Unify found in the Expr and Stmt interfaces because it adds an input parameter.
type StmtResField ¶
type StmtResField struct { Field string Value interfaces.Expr Condition interfaces.Expr // the value will be used if nil or true }
StmtResField represents a single field in the parsed resource representation. This does not satisfy the Stmt interface.
func (*StmtResField) Graph ¶
func (obj *StmtResField) Graph() (*pgraph.Graph, error)
Graph returns the reactive function graph which is expressed by this node. It includes any vertices produced by this node, and the appropriate edges to any vertices that are produced by its children. Nodes which fulfill the Expr interface directly produce vertices (and possible children) where as nodes that fulfill the Stmt interface do not produces vertices, where as their children might. It is interesting to note that nothing directly adds an edge to the resources created, but rather, once all the values (expressions) with no outgoing edges have produced at least a single value, then the resources know they're able to be built.
func (*StmtResField) Interpolate ¶
func (obj *StmtResField) Interpolate() (StmtResContents, error)
Interpolate returns a new node (or itself) once it has been expanded. This generally increases the size of the AST when it is used. It calls Interpolate on any child elements and builds the new node with those new node contents. This interpolate is different It is different from the interpolate found in the Expr and Stmt interfaces because it returns a different type as output.
func (*StmtResField) SetScope ¶
func (obj *StmtResField) SetScope(scope *interfaces.Scope) error
SetScope stores the scope for later use in this resource and it's children, which it propagates this downwards to.
func (*StmtResField) Unify ¶
func (obj *StmtResField) Unify(kind string) ([]interfaces.Invariant, error)
Unify returns the list of invariants that this node produces. It recursively calls Unify on any children elements that exist in the AST, and returns the collection to the caller. It is different from the Unify found in the Expr and Stmt interfaces because it adds an input parameter.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package funcs provides a framework for functions that change over time.
|
Package funcs provides a framework for functions that change over time. |
facts
Package facts provides a framework for language values that change over time.
|
Package facts provides a framework for language values that change over time. |
Package types provides a framework for our language values and types.
|
Package types provides a framework for our language values and types. |