Ejemplo n.º 1
0
        public static ParseTreeNodeList GetMappedChildNodes(this ParseTreeNode node)
        {
            var term = node.Term;

            if (!term.HasAstConfig())
            {
                return(node.ChildNodes);
            }
            var map = term.AstConfig.PartsMap;

            //If no map then mapped list is the same as original
            if (map == null)
            {
                return(node.ChildNodes);
            }
            //Create mapped list
            var result = new ParseTreeNodeList();

            for (int i = 0; i < map.Length; i++)
            {
                var index = map[i];
                result.Add(node.ChildNodes[index]);
            }
            return(result);
        }
Ejemplo n.º 2
0
 private void FindOpAndDetectPostfix(ParseTreeNodeList mappedNodes) {
   IsPostfix = false; //assume it 
   OpSymbol = mappedNodes[0].FindTokenAndGetText();
   if (OpSymbol == "--" || OpSymbol == "++") return;
   IsPostfix = true;
   OpSymbol = mappedNodes[1].FindTokenAndGetText();
 }
Ejemplo n.º 3
0
        private void agregarComa(ParseTreeNode raiz)

        {
            ParseTreeNodeList lista = new ParseTreeNodeList();

            for (int i = 0; i < raiz.ChildNodes[0].ChildNodes[4].ChildNodes.Count; i++)
            {
                lista.Add(raiz.ChildNodes[0].ChildNodes[4].ChildNodes[i]);
                if ((i + 1) < raiz.ChildNodes[0].ChildNodes[4].ChildNodes.Count)
                {
                    lista.Add(new ParseTreeNode(new Token(new Terminal("coma"), raiz.Span.Location, ",", null)));
                }
            }

            for (int i = 0; i < raiz.ChildNodes[0].ChildNodes[4].ChildNodes.Count; i++)
            {
                raiz.ChildNodes[0].ChildNodes[4].ChildNodes.RemoveAt(i);
                i--;
            }

            for (int i = 0; i < lista.Count; i++)
            {
                raiz.ChildNodes[0].ChildNodes[4].ChildNodes.Add(lista[i]);
            }
        }
Ejemplo n.º 4
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            this.unOpNode = AddChild("unOpNode", nodes[0]);
        }
Ejemplo n.º 5
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            this.exprNode = AddChild("exprNode", nodes[0]);  // 数字のみ取り出す。nodes[1]の";"は無視。
        }
Ejemplo n.º 6
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);
            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            Key   = AddChild("Key", nodes[0]);
            Value = AddChild("Value", nodes[2]);
        }
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            this.middleExprNode = AddChild("middleExprNode", nodes[1]);   // 両端の(と)は無視して、間だけを評価する
        }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
            {
                Name = nodes[1].Token.Text;
            }
            if (nodes[2].AstNode != null)
            {
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;
            }

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                case AssignmentType.IDAssignment:
                    ID = ANode.NumberValue;
                    break;

                case AssignmentType.PositionAssignment:
                    FormatedTextPosition = ANode.Array;
                    break;

                case AssignmentType.SizeAssignment:
                    Size = ANode.Array;
                    break;

                case AssignmentType.OpaqueAssignment:
                    Opaque = ANode.NumberValue;
                    break;

                case AssignmentType.LineHeightAssignment:
                    LineHeight = ANode.NumberValue;
                    break;

                case AssignmentType.EdgeOffsetLAssignment:
                    EdgeOffsetL = ANode.NumberValue;
                    break;

                case AssignmentType.EdgeOffsetRAssignment:
                    EdgeOffsetR = ANode.NumberValue;
                    break;

                case AssignmentType.EdgeOffsetTAssignment:
                    EdgeOffsetT = ANode.NumberValue;
                    break;

                case AssignmentType.EdgeOffsetBAssignment:
                    EdgeOffsetB = ANode.NumberValue;
                    break;
                }
            }

            AsString = "AddFormatedText";
        }
Ejemplo n.º 9
0
        private object ExecuteProcedureCall(ParseTreeNode procedureCallNode)
        {
            var isFunction = string.Equals(procedureCallNode.Term.Name, "FUNCTION_CALL", StringComparison.InvariantCultureIgnoreCase);

            var procedureName = string.Empty;
            ParseTreeNodeList argumentNodes = null;

            if (isFunction)
            {
                procedureName = procedureCallNode.ChildNodes[1].Token.Text;
                argumentNodes = procedureCallNode.ChildNodes[2].ChildNodes;
            }
            else
            {
                procedureName = procedureCallNode.ChildNodes[0].Token.Text;
                argumentNodes = procedureCallNode.ChildNodes[1].ChildNodes;
            }

            var hasArguments = argumentNodes.Count > 0;
            var callingProcedureArguments = new List <object>();

            if (hasArguments)
            {
                foreach (var argumentNode in argumentNodes)
                {
                    if (argumentNode.Term.Name == "EXPRESSION")
                    {
                        callingProcedureArguments.Add(EvaluateArithmeticExpression(argumentNode).Value);
                    }
                }
            }

            var procedure = procedures.FirstOrDefault(x => string.Equals(procedureName, x.Name, StringComparison.InvariantCultureIgnoreCase));

            if (procedure != null)
            {
                if (callingProcedureArguments.Count != procedure.Arguments.Count())
                {
                    throw new RuntimeException($"Procedure call argument count mismatch.");
                }

                var procedureScope = new ProcedureScope(procedureName);
                for (var idx = 0; idx < procedure.Arguments.Count(); idx++)
                {
                    procedureScope[procedure.Arguments.ElementAt(idx)] = callingProcedureArguments[idx];
                }

                procedureScopes.Push(procedureScope);
                procedure.Invoke(this, out var result);
                procedureScopes.Pop();
                return(result);
            }
            else
            {
                throw new RuntimeException($"The calling procedure {procedureName} is not defined.");
            }
        }
        //do not return null, just return empty list...
        public static ParseTreeNodeList ClauseList(this ParseTreeNode clause)
        {
            if (clause == null || clause.ChildNodes.Count == 0) return new ParseTreeNodeList();

            var list = new ParseTreeNodeList();
            list.AddRange(clause.ChildNodes.Skip(1));

            return list;
        }
Ejemplo n.º 11
0
 public virtual void Init(AstContext context, ParseTreeNode parseNode)
 {
     Term              = parseNode.Term;
     Span              = parseNode.Span;
     ErrorAnchor       = Location;
     parseNode.AstNode = this;
     AsString          = (Term == null ? GetType().Name : Term.Name);
     Nodes             = parseNode.GetMappedChildNodes();
 }
Ejemplo n.º 12
0
        private String getId(String nombre, ParseTreeNodeList parametros)
        {
            String idMetodo = nombre.ToLower();

            foreach (ParseTreeNode parametro in parametros)
            {
                idMetodo = idMetodo + "$" + parametro.ChildNodes[0].ChildNodes[0].Token.Text.ToLower();
            }
            return(idMetodo);
        }
Ejemplo n.º 13
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            Left  = AddChild("Left", nodes[0]);
            Op    = nodes[1];
            Right = AddChild("Right", nodes[2]);
        }
Ejemplo n.º 14
0
        public UniqueConstraintDef(ParseTreeNode i_parseNode)
        {
            if (i_parseNode.Term.Name != "constraintDef")
            {
                throw new SyntaxErrorException("ParseNode must be of type 'constraintDef'");
            }

            foreach (ParseTreeNode parseNode in i_parseNode.ChildNodes)
            {
                switch (parseNode.Term.Name)
                {
                case "Id":

                    foreach (ParseTreeNode parseNode_ID in parseNode.ChildNodes)
                    {
                        if (parseNode_ID.Term.Name == "id_simple")
                        {
                            m_id_simple = parseNode_ID;
                            break;
                        }
                    }

                    break;

                case "constraintTypeOpt":



                    if (!(parseNode.ChildNodes[0].Term.Name == "UNIQUE"))
                    {
                        throw new SyntaxErrorException("ParseNode must be of type NOT NULL constraintDef");
                    }

                    if (!(parseNode.ChildNodes[1].Term.Name == "idlistPar"))
                    {
                        throw new SyntaxErrorException("ParseNode UNIQUE constraintDef must iclude idlistPar");
                    }

                    foreach (ParseTreeNode parseTreeNodeID in parseNode.ChildNodes[1].ChildNodes[1].ChildNodes)
                    {
                        if (parseTreeNodeID.Term.Name == "Id")
                        {
                            if (m_coloumns == null)
                            {
                                m_coloumns = new ParseTreeNodeList();
                            }

                            m_coloumns.Add(parseTreeNodeID.ChildNodes[0]);
                        }
                    }

                    break;
                }
            }
        }
Ejemplo n.º 15
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;

            StrIndex = (int)nodes[2].ChildNodes[0].ChildNodes[0].ChildNodes[2].Token.Value;

            AsString = "DefineString";
        }
Ejemplo n.º 16
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            foreach (var node in nodes)
            {
                this.numList.Add(AddChild("numList", node));
            }
        }
Ejemplo n.º 17
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            //InitChildrenAsList(nodes);
            foreach(ParseTreeNode Node in nodes)
            {
                if (Node.AstNode != null)
                    Numbers.Add((int)Node.Token.Value);
            }

            AsString = "ArrayList";
        }
Ejemplo n.º 18
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            Control = nodes[1].Token.Text;
            Image   = "";

            if (nodes[2].AstNode != null)
            {
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;
            }

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                case AssignmentType.ImageAssignment:
                    Image = ANode.StrValue;
                    break;

                case AssignmentType.PositionAssignment:
                    PositionAssignment    = new int[2];
                    PositionAssignment[0] = ANode.Array.Numbers[0];
                    PositionAssignment[1] = ANode.Array.Numbers[1];
                    break;

                case AssignmentType.SizeAssignment:
                    Size = ANode.Array;
                    break;

                case AssignmentType.ThumbSizeAssignment:
                    ThumbSize = ANode.Array;
                    break;

                case AssignmentType.ThumbMarginsAssignment:
                    ThumbMargins = ANode.Array;
                    break;

                case AssignmentType.ThumbImageSizeAssignment:
                    ThumbImageSize = ANode.Array;
                    break;

                case AssignmentType.ThumbImageOffsetsAssignment:
                    ThumbImageOffsets = ANode.Array;
                    break;

                case AssignmentType.ThumbButtonImageAssignment:
                    ThumbButtonImage = ANode.StrValue;
                    break;
                }
            }

            AsString = "SetControlProperties";
        }
Ejemplo n.º 19
0
 private void FindOpAndDetectPostfix(ParseTreeNodeList mappedNodes)
 {
     IsPostfix = false; //assume it
     OpSymbol  = mappedNodes[0].FindTokenAndGetText();
     if (OpSymbol == "--" || OpSymbol == "++")
     {
         return;
     }
     IsPostfix = true;
     OpSymbol  = mappedNodes[1].FindTokenAndGetText();
 }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes.Count > 0)
            {
                if(nodes[0].AstNode != null)
                    LineContent = (LineContentNode)AddChild("LineContent", nodes[0]);
            }

            AsString = "StartStatement";
        }
Ejemplo n.º 21
0
        protected void InitChildrenAsList(ParseTreeNodeList nodes)
        {
            foreach (var node in nodes)
            {
                if (node.AstNode != null)
                {
                    AddChild(string.Empty, node);
                }
            }

            AsString = "UINode";
        }
Ejemplo n.º 22
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
            {
                Name = nodes[1].Token.Text;
            }
            if (nodes[2].AstNode != null)
            {
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;
            }

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                case AssignmentType.IDAssignment:
                    ID = ANode.NumberValue;
                    break;

                case AssignmentType.PositionAssignment:
                    TextPosition = ANode.Array;
                    break;

                case AssignmentType.SizeAssignment:
                    Size = ANode.Array;
                    break;

                case AssignmentType.ColorAssignment:
                    Color = ANode.Array;
                    break;

                case AssignmentType.TextAssignment:
                    Text = ANode.StrValue;
                    break;

                case AssignmentType.AlignmentAssignment:
                    Alignment = (TextAlignment)ANode.NumberValue;
                    break;

                case AssignmentType.FontAssignment:
                    Font = ANode.NumberValue;
                    break;

                case AssignmentType.OpaqueAssignment:
                    Opaque = ANode.NumberValue;
                    break;
                }
            }

            AsString = "AddText";
        }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            foreach (ParseTreeNode Node in nodes)
            {
                if(Node.ChildNodes.Count > 1)
                    AssignmentNodes.Add((AssignmentNode)Node.ChildNodes[0].AstNode);
            }

            AsString = "AssignmentBlock";
        }
Ejemplo n.º 24
0
 private void ConvertCommandList(List <IRunnable> commands, ParseTreeNodeList childNodes)
 {
     foreach (var node in childNodes)
     {
         var converted = ConvertNode(node);
         if (!(converted is IRunnable))
         {
             throw new Exception("DBSH-00000 Runnable expected");
         }
         commands.Add((IRunnable)converted);
     }
 }
Ejemplo n.º 25
0
        private Expression TranslateAdditionExpression(XpressCompilationContext ctx, ParseTreeNodeList nodes)
        {
            var leftExpr  = TranslateBinaryAdditiveExpression(ctx, nodes[0]);
            var rightExpr = TranslateBinaryMultiplicityExpression(ctx, nodes[2]);

            var supporttedTypes = new[] { typeof(int), typeof(string) };

            // Handle 1+null , 1+ true , true +true, null+null, true+null, true +'a', null+'a'
            if (leftExpr.NodeType == ExpressionType.Constant && !supporttedTypes.Contains(leftExpr.Type))
            {
                throw new Exception($"Operator '{XpressConstants.Tokens.Terminals.BinaryAdditionOperator}' cannot be applied to operands of type {leftExpr.Type.Name}. Error at '{nodes[0].FindTokenAndGetText()}' on position {nodes[0].Span.Location.Position}");
            }

            if (rightExpr.NodeType == ExpressionType.Constant && !supporttedTypes.Contains(rightExpr.Type))
            {
                throw new Exception($"Operator '{XpressConstants.Tokens.Terminals.BinaryAdditionOperator}' cannot be applied to operands of type {leftExpr.Type.Name} and {rightExpr.Type.Name}. Error at '{nodes[2].FindTokenAndGetText()}' on position {nodes[2].Span.Location.Position}");
            }

            // Handle 1 + '2' or '1' + 2 cases
            if (leftExpr.Type == typeof(int) && rightExpr.Type == typeof(string) &&
                rightExpr.NodeType == ExpressionType.Constant)
            {
                throw new Exception($"Operator '{XpressConstants.Tokens.Terminals.BinaryAdditionOperator}' cannot be applied to operands of type {leftExpr.Type.Name} and {rightExpr.Type.Name}. Error at '{nodes[0].FindTokenAndGetText()}' on position {nodes[0].Span.Location.Position}");
            }

            if (rightExpr.Type == typeof(int) && leftExpr.Type == typeof(string) && leftExpr.NodeType == ExpressionType.Constant)
            {
                throw new Exception($"Operator '{XpressConstants.Tokens.Terminals.BinaryAdditionOperator}' cannot be applied to operands of type {leftExpr.Type.Name}. Error at '{nodes[0].FindTokenAndGetText()}' on position {nodes[0].Span.Location.Position}");
            }



            if (leftExpr.Type == typeof(int) || rightExpr.Type == typeof(int))
            {
                // add integers
                leftExpr  = ConvertToInteger(leftExpr);
                rightExpr = ConvertToInteger(rightExpr);

                return(Expression.Add(leftExpr, rightExpr));
            }
            else
            {
                // string.concat()
                leftExpr  = ConvertToString(leftExpr);
                rightExpr = ConvertToString(rightExpr);

                var stringConcatMethod = typeof(string).GetMethod("Concat",
                                                                  (BindingFlags.Public | BindingFlags.Static), null, CallingConventions.Any,
                                                                  new Type[] { typeof(string), typeof(string) }, null);
                return(Expression.Call(stringConcatMethod, leftExpr, rightExpr));
            }
        }
Ejemplo n.º 26
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
            {
                Name = nodes[1].Token.Text;
            }

            StrIndex = (int)nodes[2].ChildNodes[0].ChildNodes[0].ChildNodes[2].Token.Value;

            AsString = "DefineString";
        }
Ejemplo n.º 27
0
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            ParseTreeNodeList nodes = treeNode.GetMappedChildNodes();

            this.numberNodes = new AstNode[nodes.Count];

            for (int i = 0; i < nodes.Count; ++i)
            {
                this.numberNodes[i] = AddChild("numberNode", nodes[i]);
            }
        }
Ejemplo n.º 28
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            //InitChildrenAsList(nodes);
            foreach (ParseTreeNode Node in nodes)
            {
                if (Node.AstNode != null)
                {
                    Numbers.Add((int)Node.Token.Value);
                }
            }

            AsString = "ArrayList";
        }
Ejemplo n.º 29
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
            {
                Name = nodes[1].Token.Text;
            }

            AssetID = nodes[2].ChildNodes[0].ChildNodes[0].ChildNodes[2].Token.Text.Replace("\"", "");
            AssetID = AssetID.Substring(2);

            AsString = "DefineImage";
        }
Ejemplo n.º 30
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            foreach (ParseTreeNode Node in nodes)
            {
                if (Node.ChildNodes.Count > 1)
                {
                    AssignmentNodes.Add((AssignmentNode)Node.ChildNodes[0].AstNode);
                }
            }

            AsString = "AssignmentBlock";
        }
 private void ProcessNodeList(ParseTreeNodeList list)
 {
     foreach (ParseTreeNode child in list)
     {
         if (child.Term.Name == FdoTerminalNames.ValueExpressionCollection)
         {
             ProcessNodeList(child.ChildNodes);
         }
         else
         {
             this.ValueList.Add(FdoValueExpression.ParseValueNode(child));
         }
     }
 }
Ejemplo n.º 32
0
        private static IList <Annotation> BuildAnnotations(ParseTreeNodeList nodes)
        {
            var annotations = new List <Annotation>(nodes.Count);

            foreach (var node in nodes)
            {
                var name       = node.ChildNodes[0].FindTokenAndGetText();
                var valueToken = node.ChildNodes[1].FindToken();
                var value      = valueToken != null ? valueToken.ValueString : null;
                var annotation = new Annotation(name, value);
                annotations.Add(annotation);
            }
            return(annotations);
        }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes.Count > 0)
            {
                if (nodes[0].AstNode != null)
                {
                    LineContent = (LineContentNode)AddChild("LineContent", nodes[0]);
                }
            }

            AsString = "StartStatement";
        }
Ejemplo n.º 34
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
            {
                Name = nodes[1].Token.Text;
            }
            if (nodes[2].AstNode != null)
            {
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;
            }

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                case AssignmentType.IDAssignment:
                    ID = ANode.NumberValue;
                    break;

                case AssignmentType.PositionAssignment:
                    ProgressbarPosition = ANode.Array;
                    break;

                case AssignmentType.ForegroundImageAssignment:
                    ForegroundImage = ANode.StrValue;
                    break;

                case AssignmentType.BackgroundImageAssignment:
                    BackgroundImage = ANode.StrValue;
                    break;

                case AssignmentType.MaxValueAssignment:
                    MaximumValue = ANode.NumberValue;
                    break;

                case AssignmentType.MinValueAssignment:
                    MinimumValue = ANode.NumberValue;
                    break;

                case AssignmentType.ValueAssignment:
                    Value = ANode.NumberValue;
                    break;
                }
            }

            AsString = "AddProgressBar";
        }
Ejemplo n.º 35
0
 public static ParseTreeNodeList GetMappedChildNodes(this ParseTreeNode node) {
   var term = node.Term; 
   if (!term.HasAstConfig())
     return node.ChildNodes; 
   var map = term.AstConfig.PartsMap;
   //If no map then mapped list is the same as original 
   if (map == null) return node.ChildNodes;
   //Create mapped list
   var result = new ParseTreeNodeList();
   for (int i = 0; i < map.Length; i++) {
     var index = map[i];
     result.Add(node.ChildNodes[index]);
   }
   return result;
 }
Ejemplo n.º 36
0
        public sqlStmtParser(string tempstmt)
        {
            this.nowStmt = ReplaceQues(tempstmt);

            this.parser = new Parser(new SqlGrammar());
            this.wholeTree = parser.Parse(nowStmt);
            //Some non-typical sql couldn't be parsed right now
            if (wholeTree.Root != null)
            {
                this.isStmt = true;
                this.stmtType = wholeTree.Root.ChildNodes.First();
                this.stmtPoints = stmtType.ChildNodes;

            }
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Determina el tipo de dato que se utilizará según la lista de nodo dada
        /// </summary>
        /// <param name="tipoDato">Lista de nodos que contiene la info de una declaración de variable</param>
        /// <returns></returns>
        private Tipo GetTipoDato(ParseTreeNodeList tipoDato)
        {
            //Servirá para determinar si la variable es o no un array
            bool esArray = false;

            switch (tipoDato.Count)
            {
            case 2:
                esArray = false;
                break;

            case 3:
                esArray = tipoDato[2].Term.Name.Equals("DIMENSION_LIST");
                break;

            case 4:
                esArray = true;
                break;
            }
            //Establece el tipo de dato
            Tipo tipo = esArray ? Tipo.CLASEARR : Tipo.CLASE;

            switch (tipoDato[0].Token.Text)
            {
            case "int":
                tipo = esArray ? Tipo.INTARR : Tipo.INT;
                break;

            case "string":
                tipo = esArray ? Tipo.STRINGARR : Tipo.STRING;
                break;

            case "bool":
                tipo = esArray ? Tipo.BOOLEANARR : Tipo.BOOLEAN;
                break;

            case "char":
                tipo = esArray ? Tipo.CHARARR : Tipo.CHAR;
                break;

            case "double":
                tipo = esArray ? Tipo.DOUBLEARR : Tipo.DOUBLE;
                break;
            }
            //Elimina el nodo, pues ya se recuperó la info deseada
            tipoDato.RemoveAt(0);
            return(tipo);
        }
            static IEnumerable <XElement> GetParagraphs(ParseTreeNodeList children)
            {
                var items = new List <object> ();

                foreach (var child in children)
                {
                    var s = child.AstNode as string;
                    if (s == null || (!s.Contains("\n\n") && !s.Contains("\r\n\r\n")))
                    {
                        items.Add(child.AstNode);
                        continue;
                    }

                    const string UnixParagraph = "\n\n";
                    const string DosParagraph  = "\r\n\r\n";
                    for (int i = 0; i < s.Length;)
                    {
                        int len = 0;
                        int n   = -1;

                        if ((n = s.IndexOf(UnixParagraph, i)) >= 0)
                        {
                            len = UnixParagraph.Length;
                        }
                        else if ((n = s.IndexOf(DosParagraph, i)) >= 0)
                        {
                            len = DosParagraph.Length;
                        }

                        if (n <= 0)
                        {
                            items.Add(s.Substring(i));
                            break;
                        }

                        var c = s.Substring(i, n - i);
                        items.Add(c);
                        i = n + len;
                        yield return(new XElement("para", items.Select(v => ToXmlContent(v))));

                        items.Clear();
                    }
                }
                if (items.Count > 0)
                {
                    yield return(new XElement("para", items.Select(v => ToXmlContent(v))));
                }
            }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            Control = nodes[1].Token.Text;
            Image = "";

            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach(AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch(ANode.TypeOfAssignment)
                {
                    case AssignmentType.ImageAssignment:
                        Image = ANode.StrValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        PositionAssignment = new int[2];
                        PositionAssignment[0] = ANode.Array.Numbers[0];
                        PositionAssignment[1] = ANode.Array.Numbers[1];
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.ThumbSizeAssignment:
                        ThumbSize = ANode.Array;
                        break;
                    case AssignmentType.ThumbMarginsAssignment:
                        ThumbMargins = ANode.Array;
                        break;
                    case AssignmentType.ThumbImageSizeAssignment:
                        ThumbImageSize = ANode.Array;
                        break;
                    case AssignmentType.ThumbImageOffsetsAssignment:
                        ThumbImageOffsets = ANode.Array;
                        break;
                    case AssignmentType.ThumbButtonImageAssignment:
                        ThumbButtonImage = ANode.StrValue;
                        break;
                }
            }

            AsString = "SetControlProperties";
        }
Ejemplo n.º 40
0
        public static Header BuildHeaders(ParseTreeNodeList headerNodes)
        {
            var includes = new List<string>();
            var namespaces = new Dictionary<string, string>();
            string defaultNamespace = null;
            foreach (var headerNode in headerNodes)
            {
                var headerChildNode = headerNode.ChildNodes[0];
                if (headerChildNode.Term.Name == IdlGrammar.NTNAME_TINCLUDE)
                {
                    var include = headerChildNode.FindTokenAndGetText();
                    include = RemoveQuote(include);
                    includes.Add(include);
                }
                else if (headerChildNode.Term.Name == IdlGrammar.NTNAME_TNAMESPACE)
                {
                    string scope = null;
                    string value = null;
                    foreach (var namespaceNode in headerChildNode.ChildNodes)
                    {
                        if (namespaceNode.Term.Name == IdlGrammar.NTNAME_TNAMESPACE_SCOPE)
                        {
                            scope = namespaceNode.FindTokenAndGetText();
                        }
                        else if (namespaceNode.Term.Name == IdlGrammar.NTNAME_NAMESPACE_VALUE)
                        {
                            value = namespaceNode.FindTokenAndGetText();
                            value = RemoveQuote(value);
                        }
                    }
                    if (scope == "*")
                    {
                        defaultNamespace = value;
                    }
                    else
                    {
                        namespaces.Add(scope, value);
                    }
                }
            }

            return new Header(includes, defaultNamespace, namespaces);

        }
Ejemplo n.º 41
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.PositionAssignment:
                        SliderPosition = ANode.Array;
                        break;
                    case AssignmentType.ImageAssignment:
                        Image = ANode.StrValue;
                        break;
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.MinValueAssignment:
                        MinimumValue = ANode.NumberValue;
                        break;
                    case AssignmentType.MaxValueAssignment:
                        MaximumValue = ANode.NumberValue;
                        break;
                    case AssignmentType.OrientationAssignment:
                        Orientation = ANode.NumberValue;
                        break;
                }
            }

            AsString = "AddSlider";
        }
Ejemplo n.º 42
0
        public static ParseTreeNodeList HandleParseTree(ParseTreeNode node)
        {
            ParseTreeNodeList list = new ParseTreeNodeList();

            foreach (var n in node.ChildNodes)
            {
                if (n.Term.Name.ToLower().Contains("unnamed"))
                {
                    list.AddRange(HandleParseTree(n));
                }
                else
                {
                    var chi = HandleParseTree(n);
                    n.ChildNodes.Clear();
                    n.ChildNodes.AddRange(chi);
                    list.Add(n);
                }
            }

            return list;
        }
Ejemplo n.º 43
0
        public static List<Definition> BuildDefinitions(ParseTreeNodeList definitionNodes)
        {
            var definitions = new List<Definition>();
            foreach (var definitionNode in definitionNodes)
            {
                var definitionChildNode = definitionNode.ChildNodes[0];
                if (definitionChildNode.Term.Name == IdlGrammar.NTNAME_TENUM)
                {
                    var enumId = definitionChildNode.ChildNodes[0].Token.Text;
                    var enumFields = new List<IntegerEnumField>();
                    int nextDefaultEnumValue = 0; // trip enumerations start at zero by default
                    foreach (var enumFieldNode in definitionChildNode.ChildNodes[1].ChildNodes)
                    {
                        var enumFeildId = enumFieldNode.ChildNodes[0].Token.Text;
                        IntegerEnumField enumField = null;
                        if (enumFieldNode.ChildNodes.Count > 1 && 
                            enumFieldNode.ChildNodes[1].ChildNodes != null && 
                            enumFieldNode.ChildNodes[1].ChildNodes.Count > 0) // has enum value
                        {
                            var valueText = enumFieldNode.ChildNodes[1].ChildNodes[0].Token.Text;
                            int enumValue = int.Parse(valueText);
                            enumField = new IntegerEnumField(enumFeildId, enumValue, nextDefaultEnumValue);
                            nextDefaultEnumValue = ++enumValue;
                        }
                        else
                        {
                            enumField = new IntegerEnumField(enumFeildId, null, nextDefaultEnumValue);
                            ++nextDefaultEnumValue;
                        }
                        enumFields.Add(enumField);
                    }
                    var integerEnum = new IntegerEnum(enumId, enumFields);
                    definitions.Add(integerEnum);
                }
                else if (definitionChildNode.Term.Name == IdlGrammar.NTNAME_TSTRUCT)
                {
                    var name = definitionChildNode.ChildNodes[0].Token.Text;
                    var tripFields = BuildTripFields(definitionChildNode.ChildNodes[1], name);

                    var tripStruct = new Struct(name, tripFields);
                    definitions.Add(tripStruct);
                }
                else if (definitionChildNode.Term.Name == IdlGrammar.NTNAME_TSERVICE)
                {
                    var name = definitionChildNode.ChildNodes[0].Token.Text;
                    List<TripMethod> methods = new List<TripMethod>();

                    var firstChild = definitionChildNode.ChildNodes[1];
                    if (firstChild.Term.Name == IdlGrammar.NTNAME_FUNCTIONS)
                    {
                        methods = BuildTripMethods(definitionChildNode.ChildNodes[1]);
                    }
                    var service = new Service(name, methods);
                    definitions.Add(service);
                }
            }


            return definitions;
        }
Ejemplo n.º 44
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        TextPosition = ANode.Array;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.ColorAssignment:
                        Color = ANode.Array;
                        break;
                    case AssignmentType.TextAssignment:
                        Text = ANode.StrValue;
                        break;
                    case AssignmentType.AlignmentAssignment:
                        Alignment = (TextAlignment)ANode.NumberValue;
                        break;
                    case AssignmentType.FontAssignment:
                        Font = ANode.NumberValue;
                        break;
                    case AssignmentType.OpaqueAssignment:
                        Opaque = ANode.NumberValue;
                        break;
                }
            }

            AsString = "AddText";
        }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[1].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.StringTableAssignment:
                        StringTable = ANode.NumberValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        ControlPosition = ANode.Array;
                        break;
                    case AssignmentType.ColorAssignment:
                        Color = ANode.Array;
                        break;
                    case AssignmentType.TextColorAssignment:
                        TextColor = ANode.Array;
                        break;
                    case AssignmentType.TextColorSelectedAssignment:
                        TextColorSelected = ANode.Array;
                        break;
                    case AssignmentType.TextColorHighlightedAssignment:
                        TextColorHighlighted = ANode.Array;
                        break;
                    case AssignmentType.TextColorDisabledAssignment:
                        TextColorDisabled = ANode.Array;
                        break;
                    case AssignmentType.BackColorAssignment:
                        BackColor = ANode.Array;
                        break;
                    case AssignmentType.CursorAssignment:
                        CursorColor = ANode.Array;
                        break;
                    case AssignmentType.OpaqueAssignment:
                        Opaque = ANode.NumberValue;
                        break;
                    case AssignmentType.TransparentAssignment:
                        Transparent = ANode.NumberValue;
                        break;
                    case AssignmentType.AlignmentAssignment:
                        Alignment = ANode.NumberValue;
                        break;
                    case AssignmentType.ImageAssignment:
                        Image = ANode.StrValue;
                        break;
                    case AssignmentType.TooltipAssignment:
                        Tooltip = ANode.StrValue;
                        break;
                    case AssignmentType.TextAssignment:
                        Text = ANode.StrValue;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.OrientationAssignment:
                        Orientation = ANode.NumberValue;
                        break;
                    case AssignmentType.FontAssignment:
                        Font = ANode.NumberValue;
                        break;
                    case AssignmentType.TextButtonAssignment:
                        TextButton = (ANode.NumberValue == 1 ? true : false);
                        break;
                }
            }

            AsString = "SetSharedProperties";
        }
Ejemplo n.º 46
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            AsString = "AnyAssignment";
        }
Ejemplo n.º 47
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        TextEditPosition = ANode.Array;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.FontAssignment:
                        Font = ANode.NumberValue;
                        break;
                    case AssignmentType.LinesAssignment:
                        Lines = ANode.NumberValue;
                        break;
                    case AssignmentType.CapacityAssignment:
                        Capacity = ANode.NumberValue;
                        break;
                    case AssignmentType.FrameOnFocusAssignment:
                        FrameOnFocus = ANode.NumberValue;
                        break;
                    case AssignmentType.ColorAssignment:
                        Color = ANode.Array;
                        break;
                    case AssignmentType.BackColorAssignment:
                        BackColor = ANode.Array;
                        break;
                    case AssignmentType.CursorColorAssignment:
                        CursorColor = ANode.Array;
                        break;
                    case AssignmentType.FrameColorAssignment:
                        FrameColor = ANode.Array;
                        break;
                    case AssignmentType.TransparentAssignment:
                        Transparent = ANode.NumberValue;
                        break;
                    case AssignmentType.AlignmentAssignment:
                        Alignment = ANode.NumberValue;
                        break;
                    case AssignmentType.FlashOnEmptyAssignment:
                        FlashOnEmpty = ANode.NumberValue;
                        break;
                    case AssignmentType.TooltipAssignment:
                        Tooltip = ANode.StrValue;
                        break;
                }
            }

            AsString = "AddTextEdit";
        }
Ejemplo n.º 48
0
        protected void InitChildrenAsList(ParseTreeNodeList nodes)
        {
            foreach (var node in nodes)
            {
                if (node.AstNode != null)
                    AddChild(string.Empty, node);
            }

            AsString = "UINode";
        }
Ejemplo n.º 49
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            switch(nodes[0].Token.Text)
            {
                case "stringDir":
                    TypeOfAssignment = AssignmentType.StringDirAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "stringTable":
                    TypeOfAssignment = AssignmentType.StringTableAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "leftArrowImage":
                    TypeOfAssignment = AssignmentType.LeftArrowImageAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "rightArrowImage":
                    TypeOfAssignment = AssignmentType.RightArrowImageAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "tracking":
                    TypeOfAssignment = AssignmentType.TrackingAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "trigger":
                    TypeOfAssignment = AssignmentType.TriggerAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "image":
                    TypeOfAssignment = AssignmentType.ImageAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "position":
                    TypeOfAssignment = AssignmentType.PositionAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "size":
                    TypeOfAssignment = AssignmentType.SizeAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "id":
                    TypeOfAssignment = AssignmentType.IDAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "orientation":
                    TypeOfAssignment = AssignmentType.OrientationAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "opaque":
                    TypeOfAssignment = AssignmentType.OpaqueAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "assetID":
                    TypeOfAssignment = AssignmentType.AssetIDAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "stringIndex":
                    TypeOfAssignment = AssignmentType.StringIndexAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "text":
                    TypeOfAssignment = AssignmentType.TextAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "font":
                    TypeOfAssignment = AssignmentType.FontAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "textColorSelected":
                    TypeOfAssignment = AssignmentType.TextColorSelectedAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "textColorHighlighted":
                    TypeOfAssignment = AssignmentType.TextColorHighlightedAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "textColorDisabled":
                    TypeOfAssignment = AssignmentType.TextColorDisabledAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "textButton":
                    TypeOfAssignment = AssignmentType.TextButtonAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "color":
                    TypeOfAssignment = AssignmentType.ColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "alignment":
                    TypeOfAssignment = AssignmentType.AlignmentAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "backColor":
                    TypeOfAssignment = AssignmentType.BackColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "frameOnFocus":
                    TypeOfAssignment = AssignmentType.FrameOnFocusAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "transparent":
                    TypeOfAssignment = AssignmentType.TransparentAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "capacity":
                    TypeOfAssignment = AssignmentType.CapacityAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "lines":
                    TypeOfAssignment = AssignmentType.LinesAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "flashOnEmpty":
                    TypeOfAssignment = AssignmentType.FlashOnEmptyAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "thumbImageSize":
                    TypeOfAssignment = AssignmentType.ThumbImageSizeAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "thumbImageOffsets":
                    TypeOfAssignment = AssignmentType.ThumbImageOffsetsAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "thumbButtonImage":
                    TypeOfAssignment = AssignmentType.ThumbButtonImageAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "wrapped":
                    TypeOfAssignment = AssignmentType.WrappedAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "textColor":
                    TypeOfAssignment = AssignmentType.TextColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "mode":
                    TypeOfAssignment = AssignmentType.ModeAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "scrollBarImage":
                    TypeOfAssignment = AssignmentType.ScrollBarImageAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "scrollBarGutter":
                    TypeOfAssignment = AssignmentType.ScrollBarGutterAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "scrollBarType":
                    TypeOfAssignment = AssignmentType.ScrollBarTypeAssignment;
                    Value = Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "enableIME":
                    TypeOfAssignment = AssignmentType.EnableIMEAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "highlighted":
                    TypeOfAssignment = AssignmentType.HighlightedAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "minValue":
                    TypeOfAssignment = AssignmentType.MinValueAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "maxValue":
                    TypeOfAssignment = AssignmentType.MaxValueAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "pageSize":
                    TypeOfAssignment = AssignmentType.PageSizeAssignment;
                    Value = int.Parse(nodes[2].Token.Text);
                    break;
                case "cursorColor":
                    TypeOfAssignment = AssignmentType.CursorColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "toolTip":
                    TypeOfAssignment = AssignmentType.TooltipAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "tooltip":
                    TypeOfAssignment = AssignmentType.TooltipAssignment;
                    Value = (string)nodes[2].Token.Text;
                    break;
                case "MouseTransparent":
                    TypeOfAssignment = AssignmentType.MouseTransparentAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "imagestates":
                    TypeOfAssignment = AssignmentType.ImageStatesAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "backgroundColor":
                    TypeOfAssignment = AssignmentType.BackgroundColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "framecolor":
                    TypeOfAssignment = AssignmentType.FrameColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "alignments":
                    TypeOfAssignment = AssignmentType.AlignmentsAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "visibleRows":
                    TypeOfAssignment = AssignmentType.VisibleRowsAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "columns":
                    TypeOfAssignment = AssignmentType.ColumnsAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "rowHeight":
                    TypeOfAssignment = AssignmentType.RowHeightAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "fillColor":
                    TypeOfAssignment = AssignmentType.FillColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "selectionFillColor":
                    TypeOfAssignment = AssignmentType.SelectionFillColorAssignment;
                    Value = (ArrayListNode)nodes[2].ChildNodes[1].AstNode;
                    break;
                case "cursor":
                    TypeOfAssignment = AssignmentType.CursorAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "lineHeight":
                    TypeOfAssignment = AssignmentType.LineHeightAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "edgeOffsetL":
                    TypeOfAssignment = AssignmentType.EdgeOffsetLAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "edgeOffsetR":
                    TypeOfAssignment = AssignmentType.EdgeOffsetRAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "edgeOffsetT":
                    TypeOfAssignment = AssignmentType.EdgeOffsetTAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "edgeOffsetB":
                    TypeOfAssignment = AssignmentType.EdgeOffsetBAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "foregroundImage":
                    TypeOfAssignment = AssignmentType.ForegroundImageAssignment;
                    Value = nodes[2].Token.Text;
                    break;
                case "backgroundImage":
                    TypeOfAssignment = AssignmentType.BackgroundImageAssignment;
                    Value = nodes[2].Token.Text;
                    break;
                case "value":
                    TypeOfAssignment = AssignmentType.ValueAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "useBackgroundImage":
                    TypeOfAssignment = AssignmentType.UseBackgroundImageAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
                case "enabled":
                    TypeOfAssignment = AssignmentType.EnabledAssignment;
                    Value = (int)nodes[2].Token.Value;
                    break;
            }

            AsString = "Assignment";
        }
Ejemplo n.º 50
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            AsString = "Begin";
        }
Ejemplo n.º 51
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach(AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.PositionAssignment:
                        ButtonPosition = ANode.Array;
                        break;
                    case AssignmentType.ImageAssignment:
                        Image = ANode.StrValue;
                        break;
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.SizeAssignment:
                        ButtonSize = ANode.Array;
                        break;
                    case AssignmentType.TextAssignment:
                        Text = ANode.StrValue;
                        break;
                    case AssignmentType.TriggerAssignment:
                        Trigger = ANode.NumberValue;
                        break;
                    case AssignmentType.TrackingAssignment:
                        Tracking = ANode.NumberValue;
                        break;
                    case AssignmentType.TooltipAssignment:
                        Tooltip = ANode.StrValue;
                        break;
                    case AssignmentType.ImageStatesAssignment:
                        ImageStates = ANode.NumberValue;
                        break;
                    case AssignmentType.TextButtonAssignment:
                        TextButton = ANode.NumberValue;
                        break;
                    case AssignmentType.FontAssignment:
                        Font = ANode.NumberValue;
                        break;
                    case AssignmentType.TextColorAssignment:
                        TextColor = ANode.Array;
                        break;
                    case AssignmentType.TextColorDisabledAssignment:
                        TextColorDisabled = ANode.Array;
                        break;
                    case AssignmentType.TextColorHighlightedAssignment:
                        TextColorHighlighted = ANode.Array;
                        break;
                    case AssignmentType.TextColorSelectedAssignment:
                        TextColorSelected = ANode.Array;
                        break;
                }
            }

            AsString = "AddButton";
        }
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        FormatedTextPosition = ANode.Array;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.OpaqueAssignment:
                        Opaque = ANode.NumberValue;
                        break;
                    case AssignmentType.LineHeightAssignment:
                        LineHeight = ANode.NumberValue;
                        break;
                    case AssignmentType.EdgeOffsetLAssignment:
                        EdgeOffsetL = ANode.NumberValue;
                        break;
                    case AssignmentType.EdgeOffsetRAssignment:
                        EdgeOffsetR = ANode.NumberValue;
                        break;
                    case AssignmentType.EdgeOffsetTAssignment:
                        EdgeOffsetT = ANode.NumberValue;
                        break;
                    case AssignmentType.EdgeOffsetBAssignment:
                        EdgeOffsetB = ANode.NumberValue;
                        break;
                }
            }

            AsString = "AddFormatedText";
        }
Ejemplo n.º 53
0
 protected virtual void InitChildren(ParseTreeNodeList nodes)
 {
 }
Ejemplo n.º 54
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            AsString = "LineContent";
        }
Ejemplo n.º 55
0
        protected override void InitChildren(ParseTreeNodeList nodes)
        {
            InitChildrenAsList(nodes);

            if (nodes[1].AstNode != null)
                Name = nodes[1].Token.Text;
            if (nodes[2].AstNode != null)
                AssignmentBlock = (AssignmentBlockNode)nodes[2].AstNode;

            foreach (AssignmentNode ANode in AssignmentBlock.ChildNodes[0].ChildNodes)
            {
                switch (ANode.TypeOfAssignment)
                {
                    case AssignmentType.IDAssignment:
                        ID = ANode.NumberValue;
                        break;
                    case AssignmentType.PositionAssignment:
                        ListBoxPosition = ANode.Array;
                        break;
                    case AssignmentType.SizeAssignment:
                        Size = ANode.Array;
                        break;
                    case AssignmentType.VisibleRowsAssignment:
                        VisibleRows = ANode.NumberValue;
                        break;
                    case AssignmentType.ColumnsAssignment:
                        Columns = ANode.NumberValue;
                        break;
                    case AssignmentType.AlignmentsAssignment:
                        Alignments = ANode.NumberValue;
                        break;
                    case AssignmentType.FontAssignment:
                        Font = ANode.NumberValue;
                        break;
                    case AssignmentType.RowHeightAssignment:
                        RowHeight = ANode.NumberValue;
                        break;
                    case AssignmentType.TransparentAssignment:
                        Transparent = ANode.NumberValue;
                        break;
                    case AssignmentType.FillColorAssignment:
                        FillColor = ANode.Array;
                        break;
                    case AssignmentType.SelectionFillColorAssignment:
                        SelectionFillColor = ANode.Array;
                        break;
                    case AssignmentType.CursorAssignment:
                        Cursor = ANode.NumberValue;
                        break;
                }
            }

            AsString = "AddListBox";
        }