public void VisitNodeJump(NodeJump nj)
        {
            if (nj.Target == null)
            {
                _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A jump node has no target set.", nj);
            }
            else if (!_nodeMap.ContainsKey(nj.Target))
            {
                _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A jump node has an invalid target.", nj);
            }
            else
            {
                var jumpOriginScene = _nodeMap[nj].SceneId;
                var jumpTargetScene = _nodeMap[nj.Target].SceneId;

                if (jumpOriginScene != jumpTargetScene)
                {
                    _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "Please refer to https://xkcd.com/292/ for additional help.", nj);
                }
            }

            if (nj.Target == nj)
            {
                _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A jump node has itself as the target.", nj);
            }
        }
예제 #2
0
 public void VisitNodeJump(NodeJump nj)
 {
     _writer.WriteStartElement("NodeJump");
     if (nj.Target != null)
     {
         var nodeIdj = _nodeMapping[nj.Target];
         _writer.WriteAttributeString("TargetNode", nodeIdj.ToString());
     }
     _writer.WriteEndElement();
 }
예제 #3
0
 public void VisitNodeJump(NodeJump nj)
 {
     _writer.WriteStartElement("NodeJump");
     if (nj.Target != null && _nodeMap.ContainsKey(nj.Target))
     {
         var(sceneIdj, nodeIdj) = _nodeMap[nj.Target];
         _writer.WriteAttributeString("TargetScene", sceneIdj.ToString());
         _writer.WriteAttributeString("TargetNode", nodeIdj.ToString());
     }
     _writer.WriteEndElement();
 }
        private bool openedBracket; // check if compiling statement

        public CompileWhile() : base()
        {
            firstDoNothingNode = new NodeDoNothing();
            conditionalJump    = new NodeConditionalJump();
            jumpBackNode       = new NodeJump();

            compiledNodes.addLast(firstDoNothingNode);
            compiledNodes.addLast(conditionalJump);
            compiledNodes.addLast(new NodeDoNothing());
            compiledNodes.addLast(jumpBackNode);
            compiledNodes.addLast(new NodeDoNothing());

            jumpBackNode.jumpNode       = compiledNodes.getFirst();
            conditionalJump.nextOntrue  = compiledNodes.get(2);
            conditionalJump.nextOnFalse = compiledNodes.getLast();

            // Settings
            openedBracket = false;
        }
예제 #5
0
        public void VisitNodeJump(NodeJump nj)
        {
            if (nj.Target == null)
            {
                return;
            }

            var targetIndexJ = _scene.Nodes.IndexOf(nj.Target);

            if (targetIndexJ == -1)
            {
                Report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "Raptors dispatched.", nj);
                Running = false;
            }
            else if (targetIndexJ < Position)
            {
                Report.AddMessage(ProjectReportMessage.MessageSeverity.Info, "Detected jump backwards (potential loop), aborting analysis of this branch.", nj);
                Running = false;
            }

            Position = targetIndexJ;
        }
        private bool openedBracket; // check if compiling statement

        public CompileIfElseStatement() : base()
        {
            firstNodeDoNothing = new NodeDoNothing();
            trueNodeDoNothing  = new NodeDoNothing();
            falseNodeDoNothing = new NodeDoNothing();
            conditionalJump    = new NodeConditionalJump();
            nodeJump           = new NodeJump();
            nodeDoNothing      = new NodeDoNothing();

            conditionalJump.nextOntrue  = trueNodeDoNothing;
            conditionalJump.nextOnFalse = falseNodeDoNothing;

            compiledNodes.addLast(firstNodeDoNothing);
            compiledNodes.addLast(conditionalJump);
            compiledNodes.addLast(trueNodeDoNothing);
            compiledNodes.addLast(falseNodeDoNothing);

            nodeJump.jumpNode = nodeDoNothing;

            compiledNodes.insertBefore(falseNodeDoNothing, nodeJump);
            compiledNodes.addLast(nodeDoNothing);
        }
 public override void visit(NodeJump node)
 {
     nextNode = node.jumpNode;
 }
예제 #8
0
 public void VisitNodeJump(NodeJump nj)
 {
 }
 public abstract void visit(NodeJump node);