Esempio n. 1
0
        public static BlockNode loadBlockProgram(String parsedBlock)
        {
            //TODO search for nested programs.
            String    firstLine = parsedBlock.Split(OP_SPLIT, StringSplitOptions.RemoveEmptyEntries)[0];
            String    nodeName  = firstLine.Replace(BlockNode.START, "").Trim();
            BlockNode node;

            if (allBlockNodes.TryGetValue(nodeName, out node))
            {
                BlockNode createdNode   = node.createInstance();
                String    internalBlock = BlockNode.getInternalBlockText(createdNode.getOpName(), parsedBlock);
                createdNode.parseBlocks(internalBlock);
                //nodes.Add(createdNode);
                return(createdNode);
            }
            else
            {
                //Throw Error
                errors += "Failed to parse line: " + firstLine;
                return(null);
            }
        }