Beispiel #1
0
 def deploy_output__mapped(self):
     i_var = NodePrivateVariableName(self.id, 'i')
     entry_var = NodeOutputVariableName(self.id, 'entry')
     index_var = NodeOutputVariableName(self.id, 'index')
     mapped_var = NodeOutputVariableName(self.id, 'mapped')
     return LanguageConcat(
         self.resolve_input_deploy('array'),
         VariableSetStatement(entry_var, LanguageNone()),
         VariableSetStatement(index_var, LanguageNone()),
         self.resolve_input_deploy_function('value'),
         VariableSetStatement(
             mapped_var,
             UtilsArrayClone(
                 self.get_input_connection_variable_name('array'))),
         SimpleLoopStatement(
             i_var, LanguageValue(0),
             UtilsArrayLength(
                 self.get_input_connection_variable_name('array')),
             LanguageConcat(
                 VariableSetStatement(index_var, i_var),
                 VariableSetStatement(
                     entry_var,
                     ArrayIndex(
                         self.get_input_connection_variable_name('array'),
                         i_var)),
                 VariableSetStatement(
                     ArrayIndex(mapped_var, i_var),
                     FunctionCall(
                         self.get_input_connection_function_name(
                             'value'))))))
Beispiel #2
0
 def deploy_output__filtered(self):
     filtered_var = NodeOutputVariableName(self.id, 'filtered')
     entry_var = NodeOutputVariableName(self.id, 'entry')
     index_var = NodeOutputVariableName(self.id, 'index')
     array_var = self.get_input_connection_variable_name('array')
     i_var = NodePrivateVariableName(self.id, 'i')
     return LanguageConcat(
         self.resolve_input_deploy('array'),
         VariableSetStatement(entry_var, LanguageNone()),
         VariableSetStatement(index_var, LanguageNone()),
         self.resolve_input_deploy_function('keep'),
         VariableSetStatement(filtered_var,
                              LanguageValue(EmptyArraySymbol())),
         SimpleLoopStatement(
             i_var, LanguageValue(0),
             LanguageValue(UtilsArrayLength(array_var)),
             LanguageConcat(
                 VariableSetStatement(index_var, i_var),
                 VariableSetStatement(entry_var,
                                      ArrayIndex(array_var, i_var)),
                 IfStatement(
                     FunctionCall(
                         self.get_input_connection_function_name('keep')),
                     VariableSetStatement(
                         filtered_var,
                         UtilsArrayConcat(filtered_var, entry_var))))))
Beispiel #3
0
 def deploy_output__out(self):
     return LanguageConcat(
         self.resolve_input_deploy('in'),
         VariableSetStatement(
             NodeOutputVariableName(self.id, 'out'),
             self.get_input_connection_variable_name('in')),
         PrintStatement(NodeOutputVariableName(self.id, 'out')))
Beispiel #4
0
 def resolve_deploy(self, name):
     node_entry = self.extended_outputs[name]
     previous_deploys = []
     for input_name in self.extended_inputs:
         self.extended_inputs[input_name][
             2].data = self.get_input_connection_variable_name(input_name)
         previous_deploys.append(self.resolve_input_deploy(input_name))
     return LanguageConcat(
         *previous_deploys, node_entry[0].resolve_deploy(node_entry[1]),
         VariableSetStatement(
             NodeOutputVariableName(self.id, name),
             NodeOutputVariableName(node_entry[0].id, node_entry[1])))
Beispiel #5
0
 def deploy_output__value(self):
     value_var = NodeOutputVariableName(self.id, 'value')
     return LanguageConcat(
         self.resolve_input_deploy('condition'),
         IfStatement(
             self.get_input_connection_variable_name('condition'),
             LanguageConcat(
                 self.resolve_input_deploy('if'),
                 VariableSetStatement(
                     value_var,
                     self.get_input_connection_variable_name('if')
                 )
             )
         ),
         IfStatement(
             None,
             LanguageConcat(
                 self.resolve_input_deploy('else'),
                 VariableSetStatement(
                     value_var,
                     self.get_input_connection_variable_name('else')
                 )
             )
         )
     )
    def deploy_output__selected(self):
        test_functions = []
        return_functions = []
        if_statements = []
        for n in range(self.condition_count):
            test_functions.append(self.resolve_input_deploy_function('test_%d' % n))
            return_functions.append(self.resolve_input_deploy_function('return_%d' % n))
            if_statements.append(
                IfStatement(
                    LanguageOperation(
                        CompareEqualsSymbol(),
                        FunctionCall(self.get_input_connection_function_name('test_%d' % n)),
                        self.get_input_connection_variable_name('value')
                    ),
                    VariableSetStatement(
                        NodeOutputVariableName(self.id, 'selected'),
                        FunctionCall(self.get_input_connection_function_name('return_%d' % n))
                    ),
                    if_type=('if' if n == 0 else 'elseif')
                )
            )
        return_functions.append(self.resolve_input_deploy_function('default'))
        if_statements.append(
            IfStatement(
                None,
                VariableSetStatement(
                    NodeOutputVariableName(self.id, 'selected'),
                    FunctionCall(self.get_input_connection_function_name('default'))
                ),
                if_type='else'
            )
        )

        return LanguageConcat(
            self.resolve_input_deploy('value'),
            *test_functions,
            *return_functions,
            VariableSetStatement(
                NodeOutputVariableName(self.id, 'selected'),
                LanguageNone()
            ),
            *if_statements
        )
Beispiel #7
0
 def deploy_output__index(self):
     return LanguageConcat(
         self.resolve_input_deploy('array'),
         self.resolve_input_deploy('search'),
         VariableSetStatement(
             NodeOutputVariableName(self.id, 'index'),
             UtilsArrayIndexOf(
                 self.get_input_connection_variable_name('array'),
                 self.get_input_connection_variable_name('search'),
             )))
Beispiel #8
0
    def deploy_output__increment(self):
        increment_var = NodeOutputVariableName(self.id, 'increment')

        return LanguageConcat(
            self.deploy_state_init('value', LanguageValue(0)),
            VariableSetStatement(
                increment_var,
                LanguageOperation(AddSymbol(),
                                  self.deploy_state_value('value'),
                                  LanguageValue(1))),
            self.deploy_state_update('value', increment_var))
 def deploy_output__value(self):
     return LanguageConcat(
         self.resolve_input_deploy_function('iter'),
         ConditionalLoopStatement(
             FunctionCall(self.get_input_connection_function_name('iter')),
             LanguageNoop()
         ),
         self.resolve_input_deploy('value'),
         VariableSetStatement(
             NodeOutputVariableName(self.id, 'value'),
             self.get_input_connection_variable_name('value')
         )
     )
Beispiel #10
0
 def deploy_output__reduced(self):
     array_var = self.get_input_connection_variable_name('array')
     i_var = NodePrivateVariableName(self.id, 'i')
     acc_var = NodeOutputVariableName(self.id, 'accumulator')
     cur_var = NodeOutputVariableName(self.id, 'current')
     return LanguageConcat(
         self.resolve_input_deploy('array'),
         VariableSetStatement(acc_var,
                              ArrayIndex(array_var, LanguageValue(0))),
         VariableSetStatement(cur_var, LanguageNone()),
         self.resolve_input_deploy_function('accumulator'),
         SimpleLoopStatement(
             i_var, LanguageValue(1), UtilsArrayLength(array_var),
             LanguageConcat(
                 VariableSetStatement(cur_var, ArrayIndex(array_var,
                                                          i_var)),
                 VariableSetStatement(
                     acc_var,
                     FunctionCall(
                         self.get_input_connection_function_name(
                             'accumulator'))))),
         VariableSetStatement(NodeOutputVariableName(self.id, 'reduced'),
                              acc_var))
Beispiel #11
0
 def deploy_output__merged(self):
     merged_var = NodeOutputVariableName(self.id, 'merged')
     input_deploys = []
     input_concats = []
     for n in range(self.array_count):
         input_deploys.append(self.resolve_input_deploy('in_%d' % n))
         input_concats.append(
             VariableSetStatement(
                 merged_var,
                 UtilsArrayConcat(merged_var, self.get_input_connection_variable_name('in_%d' % n))
             )
         )
     return LanguageConcat(
         *input_deploys,
         VariableSetStatement(merged_var, LanguageValue(EmptyArraySymbol())),
         *input_concats
     )
 def deploy_output__array(self):
     return LanguageConcat(
         self.resolve_input_deploy('array'),
         self.resolve_input_deploy('slice_start', allow_unconnected=True),
         self.resolve_input_deploy('slice_end', allow_unconnected=True),
         self.resolve_input_deploy('slice_step', allow_unconnected=True),
         VariableSetStatement(
             NodeOutputVariableName(self.id, 'array'),
             UtilsArraySlice(
                 self.get_input_connection_variable_name('array'),
                 self.get_input_connection_variable_name(
                     'slice_start', allow_unconnected=True),
                 self.get_input_connection_variable_name(
                     'slice_end', allow_unconnected=True),
                 self.get_input_connection_variable_name(
                     'slice_step', allow_unconnected=True),
             )))
Beispiel #13
0
    def deploy_output__value(self):
        num_var = self.get_input_connection_variable_name('number')
        value_var = NodeOutputVariableName(self.id, 'value')

        if_statements = []
        for n in range(self.count):
            if_statements.append(
                IfStatement(LanguageOperation(CompareEqualsSymbol(), num_var,
                                              LanguageValue(n)),
                            LanguageConcat(
                                self.resolve_input_deploy(f'in_{n}'),
                                VariableSetStatement(
                                    value_var,
                                    self.get_input_connection_variable_name(
                                        f'in_{n}'))),
                            if_type='if' if n == 0 else
                            'elseif' if n != self.count - 1 else 'else'))

        return LanguageConcat(self.resolve_input_deploy('number'),
                              VariableSetStatement(value_var, LanguageNone()),
                              *if_statements)
 def deploy_output__object(self):
     object_var = NodeOutputVariableName(self.id, 'object')
     input_deploys = []
     input_sets = []
     for n in range(self.property_count):
         input_deploys.append(self.resolve_input_deploy('key_%d' % n))
         input_deploys.append(self.resolve_input_deploy('value_%d' % n))
         input_sets.append(
             VariableSetStatement(
                 ArrayIndex(
                     object_var,
                     self.get_input_connection_variable_name('key_%d' % n)
                 ),
                 self.get_input_connection_variable_name('value_%d' % n)
             )
         )
     return LanguageConcat(
         *input_deploys,
         VariableSetStatement(
             object_var,
             LanguageValue(EmptyDictSymbol())
         ),
         *input_sets
     )
 def deploy_output__data(self):
     return VariableSetStatement(NodeOutputVariableName(self.id, 'data'), LanguageValue(self.data))
Beispiel #16
0
 def deploy_output__value(self):
     return VariableSetStatement(
         NodeOutputVariableName(self.id, 'value'),
         VariableName('env')
     )
Beispiel #17
0
 def deploy_output__value(self):
     return LanguageConcat(
         self.deploy_state_init('value', LanguageValue(0)),
         VariableSetStatement(NodeOutputVariableName(self.id, 'value'),
                              self.deploy_state_value('value')))