Exemplo n.º 1
0
 public void Visit(PlotDef plotDef, object[] args)
 {
     kernel.RuntimeData.ScopeStack.Open(new LocalScope());
     kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_LOCAL_SCOPE_FLAG);
     kernel.RuntimeData.InstructionStack.Push(plotDef.Content);
     kernel.Next();
 }
Exemplo n.º 2
0
        public void Visit(PlotDef plotDef, object[] args)
        {
            if (reader.IsEmptyElement)
            {
                return;
            }

            plotDef.Content = new List <Statement>();
            visitMainContent(plotDef, plotDef.Content);
        }
        public void Visit(PlotDef plotDef, object[] args)
        {
            parentStack.Peek().Add("id", plotDef.ID);

            BsonArray content = new BsonArray();

            foreach (Statement statement in plotDef.Content)
            {
                BsonDocument bsonStatement = new BsonDocument();

                parentStack.Push(bsonStatement);
                statement.Accept(this);
                parentStack.Pop();

                content.Add(bsonStatement);
            }
            parentStack.Peek().Add("content", content);
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args">
        /// XMLReader, filename
        /// </param>
        public void Visit(FireMLRoot root, object[] args)
        {
            //reader = args[0] as XmlTextReader;
            //file = args[1] as string;

            while (reader.Read())
            {
                reader.MoveToContent();
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    Location location = new Location(file, reader.LineNumber, reader.LinePosition);
                    switch (dic[reader.Name])
                    {
                    case "MainPlot":
                        if (root.MainPlot != null)
                        {
                            kernel.IssueError(ErrorType.DuplicatedMainPlot, location);
                            continue;
                        }

                        PlotDef plotDef = new PlotDef();
                        plotDef.Location = location;

                        root.MainPlot = plotDef;
                        //reader.MoveToContent();
                        plotDef.Accept(this);
                        break;

                    case "SubPlot":
                        reader.MoveToAttribute("name");
                        string subPlotName = reader.Value;
                        if (root.SubPlotMap.ContainsKey(subPlotName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedSubPlot, subPlotName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        PlotDef subPlotDef = new PlotDef();
                        subPlotDef.Location = location;
                        subPlotDef.Name     = subPlotName;

                        root.SubPlotMap.Add(subPlotName, subPlotDef);
                        //reader.MoveToContent();
                        subPlotDef.Accept(this);
                        break;

                    case "ActionLayer":
                        reader.MoveToAttribute("name");
                        string layerName = reader.Value;
                        if (root.ActionLayerMap.ContainsKey(layerName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedActorLayer, layerName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        ActionLayerDef actionLayerDef = new ActionLayerDef();
                        actionLayerDef.Location = location;
                        actionLayerDef.Name     = layerName;

                        root.ActionLayerMap.Add(layerName, actionLayerDef);
                        //reader.Read();
                        reader.MoveToElement();
                        actionLayerDef.Accept(this);
                        break;

                    case "Function":
                        reader.MoveToAttribute("name");
                        string funcName = reader.Value;
                        if (root.FuncDefMap.ContainsKey(funcName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedFunction, funcName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        FunctionDef funcDef = new FunctionDef();
                        funcDef.Location = location;
                        funcDef.Name     = funcName;

                        root.FuncDefMap.Add(funcName, funcDef);
                        //reader.MoveToContent();
                        funcDef.Accept(this);
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:
                    reader.Read();
                    break;
                }
            }
        }