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"); }
private void ProcessUnQuotedCode() { attributeType = ParsedAttributeType.Reference; while (true) { var token = tokenReader.Read(); AddCurrentValue(token); var next = tokenReader.Peek(); if ((next.Character == ' ') || next.IsEnd) { return; } } }
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); } }
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; } } }
private static void AssertAttribute(AttributeParser parser, string name, string value, ParsedAttributeType type) { AssertAttribute(parser, null, name, value, type); }