public PrimitiveLiteral ParsePrimitiveLiteral()
{
var token = Next();
if (!token.Is(TokenType.Null) &&
!token.Is(TokenType.True) &&
!token.Is(TokenType.False) &&
!token.Is(TokenType.String) &&
!token.Is(TokenType.Number))
throw Error("Primitive literal expected, received " + token.Type, token);
var literal = new PrimitiveLiteral
{
Token = Next(),
Value = Next().Text,
Type = Next().Type
};
Consume();
return literal;
}