public void Parse() { Attributes.Clear(); using (var stringReader = new StringReader(attributesString)) { tokenReader = new TokenReader(stringReader); Token next; while (!(next = tokenReader.Peek()).IsEnd) { if (next.IsWhiteSpace) { tokenReader.Read(); continue; } if ((next.Character) == '\'' || (next.IsEscaped) || (next.Character) == '"' || (next.Character) == ':' || (next.Character) == '}' || (next.Character) == '=') { throw new SyntaxException(); } ProcessKey(); AddCurrent(); currentValue = null; currentKey = null; } CheckForDuplicates(); } }
private void ProcessString() { isExpression = false; current = string.Empty; while (true) { var nextValue = tokenReader.Peek(); if (nextValue.IsEnd) { return; } if (nextValue.Character == '#' && tokenReader.Peek2().Character == '{') { return; } var token = tokenReader.Read(); var character = token.Character; current += character; } }
private void EatWhiteSpace() { while (tokenReader.Peek().IsWhiteSpace) { tokenReader.Read(); } }