Browse Source

work in progress

Igor 2 years ago
parent
commit
7397c05918
1 changed files with 19 additions and 2 deletions
  1. 19 2
      js/util/codeParser.js

+ 19 - 2
js/util/codeParser.js

@@ -66,8 +66,6 @@ function parseParameter (parameter_obj) {
 
 function parseFunction (function_obj) {
 
-  console.log(function_obj)
-  
   const new_function = new Models.Function(
     function_obj.name, 
     function_obj.return_type, 
@@ -94,6 +92,8 @@ function parseFunction (function_obj) {
     });
   }
 
+  new_function.commands = parseCommands(function_obj.commands)
+
   window.program_obj.addFunction(new_function);
   
 }
@@ -111,4 +111,21 @@ export function parserCodeVisual (code_obj = null) {
   window.program_obj.functions = [];
   code_obj.functions.forEach(parseFunction);
 
+}
+
+function parseCommands (commands_block) {
+
+  console.log('bloco', commands_block)
+
+  if (Array.isArray(commands_block)) {
+    var temp = [];
+    commands_block.forEach(function(command) {
+      temp.push(parseCommands(command));
+    });
+    return temp;
+  }
+  else {
+    return null;
+  }
+  
 }