Add new CS entities: locals data_type identifier parameter_declaration scope_declaration
parent
e5b4114855
commit
8a87464b39
|
@ -21,11 +21,11 @@ module CeleryScriptSettingsBag
|
|||
tool_slots tools points tokens users device)
|
||||
ALLOWED_MESSAGE_TYPES = %w(success busy warn error info fun debug)
|
||||
ALLOWED_CHANNEL_NAMES = %w(ticker toast email)
|
||||
ALLOWED_DATA_TYPES = %w(string integer)
|
||||
ALLOWED_POINTER_TYPE = %w(GenericPointer ToolSlot Plant)
|
||||
ALLOWED_DATA_TYPES = %w(tool coordinate point)
|
||||
ALLOWED_OPS = %w(< > is not is_undefined)
|
||||
ALLOWED_AXIS = %w(x y z all)
|
||||
ALLOWED_LHS = [*(0..69)].map{|x| "pin#{x}"}.concat(%w(x y z))
|
||||
ALLOWED_POINTER_TYPE = %w(GenericPointer ToolSlot Plant)
|
||||
STEPS = %w(move_absolute move_relative write_pin read_pin wait
|
||||
send_message execute _if execute_script take_photo
|
||||
find_home)
|
||||
|
@ -136,6 +136,12 @@ module CeleryScriptSettingsBag
|
|||
.defineArg(:_then, [:execute, :nothing])
|
||||
.defineArg(:_else, [:execute, :nothing])
|
||||
.defineArg(:url, [String])
|
||||
.defineArg(:locals, [:scope_declaration])
|
||||
.defineArg(:data_type, [String]) do |node|
|
||||
within(ALLOWED_AXIS, node) do |v|
|
||||
BAD_DATA_TYPE % [v.to_s, ALLOWED_DATA_TYPES.inspect]
|
||||
end
|
||||
end
|
||||
.defineNode(:nothing, [])
|
||||
.defineNode(:tool, [:tool_id])
|
||||
.defineNode(:coordinate, [:x, :y, :z])
|
||||
|
@ -175,8 +181,10 @@ module CeleryScriptSettingsBag
|
|||
.defineNode(:install_farmware, [:url])
|
||||
.defineNode(:update_farmware, [:package])
|
||||
.defineNode(:remove_farmware, [:package])
|
||||
.defineNode(:scope_declaration, [], [:parameter_declaration])
|
||||
.defineNode(:identifier, [:label])
|
||||
.defineNode(:install_first_party_farmware, [])
|
||||
# Given an array of allowed values and a CeleryScript AST node, will DETERMINE
|
||||
# Given an array of allowed values and a CeleryScript AST node, will DETERMINE
|
||||
# if the node contains a legal value. Throws exception and invalidates if not.
|
||||
def self.within(array, node)
|
||||
val = node&.value
|
||||
|
|
21
idea.json
21
idea.json
|
@ -1,3 +1,20 @@
|
|||
// STAGE 1: = = = = = = =
|
||||
// ARGS TO ADD:
|
||||
// X "locals" (sequence),
|
||||
// X "data_type" (parameter_declaration)
|
||||
//
|
||||
// NODES TO ADD:
|
||||
// X "identifier" (label),
|
||||
// X "parameter_declaration" (label, data_type)
|
||||
// X "scope_declaration"(contains parameter_declaration),
|
||||
//
|
||||
// Stage 2: = = = = = = = =
|
||||
// NODES TO ADD:
|
||||
// "local_declaration" (label, data_value),
|
||||
//
|
||||
// ARGS TO ADD:
|
||||
// "data_value" (local_declaration)
|
||||
//
|
||||
{
|
||||
"kind": "sequence",
|
||||
"args": {
|
||||
|
@ -11,14 +28,14 @@
|
|||
"kind": "local_declaration", // <= New node
|
||||
"args": {
|
||||
"label": "parent",
|
||||
"value": "POINT_LITERAL_OR_WHATEVER_GOES_HERE"
|
||||
"data_value": "POINT_LITERAL_OR_WHATEVER_GOES_HERE"
|
||||
}
|
||||
},
|
||||
{ // SCENARIO B: Defer assignment to parent, only set expected (eventual) type
|
||||
"kind": "parameter_declaration", // <= New node
|
||||
"args": {
|
||||
"label": "parent",
|
||||
"value": "EXPECTED_KIND_GOES_HERE"
|
||||
"data_type": "EXPECTED_KIND_GOES_HERE"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue