Esempio n. 1
0
        public While(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id   = ParseTools.ParseID(node);
            string mode = node.GetNodeWithAttributeValue(WHILE_MODE_FIELD_NAME).InnerText;

            if (mode != SUPPORTED_MODE)
            {
                parserInfo.ParseExceptions.Add(new ParseException(id, "While block only supports while mode."));
            }


            XmlNode       conditionalNode = node.GetInnerBlockNode(CONDITIONAL_BLOCK_FIELD_NAME, parserInfo, new MissingBlockException(id, "While block is missing its conditional block."));
            VariableBlock decidingBlock   = null;

            if (conditionalNode != null)
            {
                decidingBlock = (VariableBlock)XmlParser.ParseAndAddNodeToDFG(conditionalNode, dfg, parserInfo);
            }

            XmlNode guardedNode = node.GetInnerBlockNode(DO_BLOCK_FIELD_NAME, parserInfo, new MissingBlockException(id, "While block is missing blocks to execute."));

            if (guardedNode != null)
            {
                DFG <Block> guardedDFG = XmlParser.ParseDFG(guardedNode, parserInfo);
                DFG <Block> nextDFG    = XmlParser.ParseNextDFG(node, parserInfo);

                this.Cond = new Conditional(decidingBlock, guardedDFG, nextDFG);
            }
        }
Esempio n. 2
0
        public Repeat(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string        id = ParseTools.ParseID(node);
            XmlNode       conditionalNode = node.GetInnerBlockNode(TimesBlockFieldName, parserInfo, new MissingBlockException(id, "Repeat block is missing its conditional block."));
            VariableBlock decidingBlock   = null;

            if (conditionalNode != null)
            {
                decidingBlock = (VariableBlock)XmlParser.ParseAndAddNodeToDFG(conditionalNode, dfg, parserInfo);
            }

            XmlNode guardedNode = node.GetInnerBlockNode(DoBlockFieldName, parserInfo, new MissingBlockException(id, "Repeat block is missing blocks to execute."));

            if (guardedNode != null)
            {
                DFG <Block> guardedDFG = XmlParser.ParseDFG(guardedNode, parserInfo);
                DFG <Block> nextDFG    = XmlParser.ParseNextDFG(node, parserInfo);

                this.Cond = new Conditional(decidingBlock, guardedDFG, nextDFG);
            }
        }
Esempio n. 3
0
        public Direct(XmlNode node, ParserInfo parserInfo)
        {
            DFG <Block> nextDFG = XmlParser.ParseDFG(node, parserInfo, false, false);

            this.Cond = new Conditional(null, null, nextDFG);
        }
Esempio n. 4
0
 public Direct(Conditional cond)
 {
     this.Cond = cond;
 }
Esempio n. 5
0
 public While(Conditional cond)
 {
     this.Cond = cond;
 }
Esempio n. 6
0
 public Repeat(Conditional cond)
 {
     this.Cond = cond;
 }