protected virtual void ParseValue(TokenWriter tokenWriter, BasicReader reader) { int startPos = reader.Position; if (reader.StartsWith(ListValueSeperator)) { tokenWriter.Add(new Token(TokenType.ListValueSeperator, ListValueSeperator, startPos, ListValueSeperator.Length)); reader.Skip(1); } else if (reader.StartsWith("'") || reader.StartsWith("\"")) { this.ParseQuotedString(tokenWriter, reader); } else if (reader.StartsWith("$")) { TokenType type; char[] endChar = new char[] {' ', '\t', '\r', '\n', ',', '}', ')', '=', ';' }; string val = reader.ReadUntil(endChar.Contains); switch (val) { case "$null": type = TokenType.NullValue; break; case "$true": case "$false": type = TokenType.BoolValue; break; default: throw new InvalidDataException("Not a literal token: " + val); } tokenWriter.Add(new Token(type, val, startPos, reader.Position - startPos)); } else if (reader.StartsWith(DictionaryStart)) { this.ParseDictionary(tokenWriter, reader); } else if (reader.StartsWith(ListStart)) { this.ParseList(tokenWriter, reader); } else { char[] endChar = new char[] { ' ', '\t', '\r', '\n', ',', '}', ')', '=', ';' }; string val = reader.PeekUntil(endChar.Contains); bool decimalSep = val.Any(c => c == '.'); int skipSign = val[0] == '+' || val[0] == '-' ? 1 : 0; if (val.Skip(skipSign).Count(char.IsDigit) + (decimalSep ? 1 : 0) == val.Length - skipSign) { reader.Skip(val.Length); tokenWriter.Add(new Token(TokenType.NumericValue, val, startPos, reader.Position - startPos)); } else this.ParseUnquotedString(tokenWriter, reader); } }