Documentation ¶
Overview ¶
Package ast defines the AST grammar for BJK files. See: https://github.com/setzer22/blackjack
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Lexer = lexer.MustSimple([]lexer.SimpleRule{
{"Header", `(?:` + headerStr + `)[ ]*`},
{"Ident", `[a-zA-Z]\w*`},
{"Float", `\-?(?:\d*)?\.\d+`},
{"Int", `\-?(?:\d*)?\d+`},
{"String", `\"[^\"]*\"`},
{"Punct", `[-[!@#$%^&*()+_={}\|:;"'<,>.?/]|]`},
{"Whitespace", `[ \t\n\r]+`},
})
Lexer represents a lexer for the BJK grammar.
var Parser = participle.MustBuild[BJK]( participle.Lexer(Lexer), participle.Elide("Whitespace"), rustUnquoteOption("String"), )
Parser represents a participle parser for the BJK grammar.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { NodeIdx uint64 `"node_idx" ":" @Int ","?` ParamName string `"param_name" ":" @String ","?` }
Connection represents a DependencyKind's connection.
type DependencyKind ¶
type DependencyKind struct { External *External ` "External" "(" @@* ")" ","?` Connection *Connection `| "Conection" "(" @@* ")" ","?` }
DependencyKind is an enum that represents an input's dependency. It is either an External or a Connection, but not both.
type External ¶
type External struct {
Promoted *string `"promoted" ":" ( "Some" "(" @String ")" | "None" ) ","?`
}
External represents an external dependency kind.
type ExternalParameters ¶
type ExternalParameters struct {
ParamValues []*ParamValue `"(" "param_values" ":" "{" @@* "}" ","? ")" ","?`
}
ExternalParameters represents external parameters.
func (*ExternalParameters) String ¶
func (ep *ExternalParameters) String() string
type Graph ¶
type Graph struct { Nodes []*Node `"nodes" ":" "[" ( "(" @@* ")" ","? )* "]" ","?` DefaultNode *uint64 `( "default_node" ":" ( "Some" "(" @Int ")" | "None" ) ","? )?` UIData *UIData `( "ui_data" ":" ( "Some" "(" @@ ")" | "None" ) ","? )?` ExternalParameters *ExternalParameters `( "external_parameters" ":" ( "Some" "(" @@ ")" | "None" ) ","? )?` }
Graph represents the content of the Blackjack file.
type Input ¶
type Input struct { Name string `"name" ":" @String ","*` DataType string `"data_type" ":" @String ","*` Kind DependencyKind `"kind" ":" @@ ","*` // Props are not preserved in the BJK file. Props map[string]lua.LValue }
Input represents a node's input.
type Node ¶
type Node struct { OpName string `"op_name" ":" @String ","?` // e.g. "MakeScalar" ReturnValue *string `"return_value" ":" ( "Some" "(" @String ")" | "None" ) ","?` Inputs []*Input `"inputs" ":" "[" ( "(" @@* ")" ","? )* "]" ","?` Outputs []*Output `"outputs" ":" "[" ( "(" @@* ")" ","? )* "]" ","?` // Label is not preserved in the BJK file. Label string // e.g. "Scalar" // Index is not preserved in the BJK file. Index uint64 // NodePosition, if set, is used to manually position the node. NodePosition *Vec2 // EvalOutputs are generated by Eval but not preserved in the BJK file. EvalOutputs map[string]lua.LValue }
Node represents a node in Blackjack.
func (*Node) GetOutputs ¶
GetOutputs returns a slice of output names.
type Output ¶
type Output struct { Name string `"name" ":" @String ","*` DataType string `"data_type" ":" @String ","*` }
Output represents a node's output.
type ParamValue ¶
type ParamValue struct { NodeIdx uint64 `"(" "node_idx" ":" @Int ","?` ParamName string `"param_name" ":" @String ","? ")" ":"` ValueEnum ValueEnum `@@` }
ParamValue is an enum that represents a parameter value. It is exactly one of the values.
func (*ParamValue) String ¶
func (pv *ParamValue) String() string
type ScalarValue ¶
type ScalarValue struct {
X float64 `"Scalar" "(" @Float ")" ","?`
}
ScalarValue is one type of ParamValue.
func (*ScalarValue) String ¶
func (sv *ScalarValue) String() string
type SelectionValue ¶
type SelectionValue struct {
Selection string `"String" "(" @String ")" ","?`
}
SelectionValue is one type of ParamValue.
func (*SelectionValue) String ¶
func (sv *SelectionValue) String() string
type StringValue ¶
type StringValue struct {
S string `"String" "(" @String ")" ","?`
}
StringValue is one type of ParamValue.
func (*StringValue) String ¶
func (sv *StringValue) String() string
type UIData ¶
type UIData struct { NodePositions []*Vec2 `"(" "node_positions" ":" "[" @@* "]" ","?` NodeOrder []uint64 `"node_order" ":" "[" ( @Int ","? )* "]" ","?` Pan Vec2 `"pan" ":" @@ ","?` Zoom float64 `"zoom" ":" @Float ","?` LockedGizmoNodes []uint64 `"locked_gizmo_nodes" ":" "[" ( @Int ","? )* "]" ","? ")" ","?` }
UIData represents data to drive the user interface.
type ValueEnum ¶
type ValueEnum struct { Scalar *ScalarValue ` @@` Selection *SelectionValue `| @@` StrVal *StringValue `| @@` Vector *VectorValue `| @@` }
ValueEnum represents an enum for a ParamValue.
type VectorValue ¶
type VectorValue struct { X float64 `"Vector" "(" "(" @Float ","` Y float64 `@Float ","` Z float64 `@Float ")" ")" ","?` }
VectorValue is one type of ParamValue.
func (*VectorValue) String ¶
func (vv *VectorValue) String() string