コード例 #1
0
        public void GetValueTest()
        {
            Definition def = new Definition(_mock, 0, 0);

            def.Add(new Token(TokenType.Name, 0, 0, "Alice"));
            def.Add(new Token(TokenType.Control, 0, 0, ":"));
            def.Add(new Token(TokenType.Name, 0, 0, "string"));
            Assert.AreEqual("", ((MplString)def.GetValue()).Val);
        }
コード例 #2
0
        public void GetTypeTest()
        {
            Definition def = new Definition(_mock, 0, 0);

            def.Add(new Token(TokenType.Name, 0, 0, "Alice"));
            def.Add(new Token(TokenType.Control, 0, 0, ":"));
            def.Add(new Token(TokenType.Name, 0, 0, "string"));
            Assert.AreEqual(Type.String, def.GetType());
        }
コード例 #3
0
        public void ExitTest()
        {
            Definition def = new Definition(_mock, 0, 0);

            def.Add(new Token(TokenType.Name, 0, 0, "Alice"));
            def.Add(new Token(TokenType.Control, 0, 0, ":"));
            def.Add(new Token(TokenType.Name, 0, 0, "bool"));
            def.Exit();
            def.Run();
            Assert.IsFalse(((MplBoolean)def.GetValue()).Val);
        }
コード例 #4
0
        private Definition Parse(Definition parent)
        {
            Definition def;

            if (parent == null)
            {
                def = this.def;
            }
            else
            {
                def = new Definition();
            }

            Field temp = null;

            currentField.Read(InputStream);
            IStructureOwner struct_owner = (IStructureOwner)def;

            while (currentField.Type != FieldType.Terminator)
            {
                def.Add(temp = FieldUtil.CreateFromDefinitionItem(engine, struct_owner.OwnerObject, currentField));

                if (currentField.Type == FieldType.Block ||
                    currentField.Type == FieldType.Struct)
                {
                    Parse(temp.FieldValue as Definition);
                }

                currentField.Read(InputStream);
            }

            return(def);
        }
コード例 #5
0
        public void RunTest()
        {
            Definition def = new Definition(_mock, 0, 0);

            def.Add(new Token(TokenType.Name, 0, 0, "Nom"));
            def.Add(new Token(TokenType.Control, 0, 0, ":"));
            def.Add(new Token(TokenType.Name, 0, 0, "string"));
            def.Add(new Token(TokenType.Control, 0, 0, ":="));
            def.Add(new Token(TokenType.Number, 0, 0, "1"));
            def.Add(new Token(TokenType.Control, 0, 0, "+"));
            def.Add(new Token(TokenType.Number, 0, 0, "1"));
            def.Exit();
            def.Run();
            Assert.AreEqual(2, ((MplInteger)def.GetValue()).Val);
        }
コード例 #6
0
 public virtual void AddStyle(ChartStyleElementBase styleElement)
 {
     Definition.Add(styleElement);
 }