private void NextTokenForKey() { var start = _position; switch (_c) { case '\n': _token = new SyntaxTokenValue(TokenKind.NewLine, start, start); NextChar(); break; case '\r': NextChar(); // case of: \r\n if (_c == '\n') { _token = new SyntaxTokenValue(TokenKind.NewLine, start, _position); NextChar(); break; } // case of \r _token = new SyntaxTokenValue(TokenKind.NewLine, start, start); break; case '#': NextChar(); ReadComment(start); break; case '.': NextChar(); _token = new SyntaxTokenValue(TokenKind.Dot, start, start); break; case '=': // in the context of a key, we need to parse up to the = NextChar(); _token = new SyntaxTokenValue(TokenKind.Equal, start, start); break; case '{': _token = new SyntaxTokenValue(TokenKind.OpenBrace, _position, _position); NextChar(); break; case '}': _token = new SyntaxTokenValue(TokenKind.CloseBrace, _position, _position); NextChar(); break; case '[': NextChar(); // case of: ]] if (_c == '[') { _token = new SyntaxTokenValue(TokenKind.OpenBracketDouble, start, _position); NextChar(); break; } _token = new SyntaxTokenValue(TokenKind.OpenBracket, start, start); break; case ']': NextChar(); // case of: ]] if (_c == ']') { _token = new SyntaxTokenValue(TokenKind.CloseBracketDouble, start, _position); NextChar(); break; } _token = new SyntaxTokenValue(TokenKind.CloseBracket, start, start); break; case '"': ReadString(start, false); break; case '\'': ReadStringLiteral(start, false); break; case Eof: _token = new SyntaxTokenValue(TokenKind.Eof, _position, _position); break; default: // Eat any whitespace if (ConsumeWhitespace()) { break; } if (CharHelper.IsKeyStart(_c)) { ReadKey(); break; } // invalid char _token = new SyntaxTokenValue(TokenKind.Invalid, _position, _position); NextChar(); break; } }