Пример #1
0
        private static void AssertAttribute(AttributeParser parser, string schema, string name, string value,
                                            ParsedAttributeType type)
        {
            var attribute = parser.Attributes.FirstOrDefault(a => a.Name == name && a.Schema == schema);

            Assert.IsNotNull(attribute, string.Format("Attribute '{0}' not found.", name));

            Assert.AreEqual(schema, attribute.Schema, "Schema");
            Assert.AreEqual(value, attribute.Value, "Value");
            Assert.AreEqual(type, attribute.Type, "Type");
        }
Пример #2
0
        private void ProcessUnQuotedCode()
        {
            attributeType = ParsedAttributeType.Reference;
            while (true)
            {
                var token = tokenReader.Read();
                AddCurrentValue(token);

                var next = tokenReader.Peek();
                if ((next.Character == ' ') || next.IsEnd)
                {
                    return;
                }
            }
        }
Пример #3
0
 private void ProcessQuotedValue(char character)
 {
     attributeType = ParsedAttributeType.String;
     currentValue  = string.Empty;
     tokenReader.Read();
     while (true)
     {
         var next = tokenReader.Peek();
         if (next.IsEnd)
         {
             throw new SyntaxException();
         }
         if (!next.IsEscaped && (next.Character == character))
         {
             tokenReader.Read();
             break;
         }
         var token = tokenReader.Read();
         AddCurrentValue(token);
     }
 }
Пример #4
0
        private void ProcessHashedCode()
        {
            attributeType = ParsedAttributeType.Expression;
            tokenReader.Read();
            tokenReader.Read();
            while (true)
            {
                var token = tokenReader.Read();
                AddCurrentValue(token);

                var next = tokenReader.Peek();
                if (next.IsEnd)
                {
                    throw new SyntaxException();
                }
                if (!next.IsEscaped && (next.Character == '}'))
                {
                    tokenReader.Read();
                    return;
                }
            }
        }
Пример #5
0
        private void ProcessUnQuotedCode()
        {
            attributeType = ParsedAttributeType.Reference;
            while (true)
            {
                var token = tokenReader.Read();
                AddCurrentValue(token);

                var next = tokenReader.Peek();
                if ((next.Character == ' ') || next.IsEnd)
                {
                    return;
                }
            }
        }
Пример #6
0
        private void ProcessQuotedValue(char character)
        {
            attributeType = ParsedAttributeType.String;
            currentValue = string.Empty;
            tokenReader.Read();
            while (true)
            {
                var next = tokenReader.Peek();
                if (next.IsEnd)
                {
                    throw new SyntaxException();
                }
                if (!next.IsEscaped && (next.Character == character))
                {
                    tokenReader.Read();
                    break;
                }
                var token = tokenReader.Read();
                AddCurrentValue(token);

            }
        }
Пример #7
0
        private void ProcessHashedCode()
        {
            attributeType = ParsedAttributeType.Expression;
            tokenReader.Read();
            tokenReader.Read();
            while (true)
            {
                var token = tokenReader.Read();
                AddCurrentValue(token);

                var next = tokenReader.Peek();
                if (next.IsEnd)
                {
                    throw new SyntaxException();
                }
                if (!next.IsEscaped && (next.Character == '}'))
                {
                    tokenReader.Read();
                    return;
                }
            }
        }
Пример #8
0
 private static void AssertAttribute(AttributeParser parser, string name, string value, ParsedAttributeType type)
 {
     AssertAttribute(parser, null, name, value, type);
 }
Пример #9
0
        private static void AssertAttribute(AttributeParser parser, string schema, string name, string value,
                                            ParsedAttributeType type)
        {
            var attribute = parser.Attributes.FirstOrDefault(a => a.Name == name && a.Schema == schema);

            Assert.IsNotNull(attribute, string.Format("Attribute '{0}' not found.", name));

            Assert.AreEqual(schema, attribute.Schema, "Schema");
            Assert.AreEqual(value, attribute.Value, "Value");
            Assert.AreEqual(type, attribute.Type, "Type");
        }
Пример #10
0
 private static void AssertAttribute(AttributeParser parser, string name, string value, ParsedAttributeType type)
 {
     AssertAttribute(parser, null, name, value, type);
 }