From 56884dc7005ddd370d896f31c0c85094e05c550d Mon Sep 17 00:00:00 2001 From: Nickolay Ponomarev Date: Sun, 13 Jan 2019 01:51:07 +0300 Subject: [PATCH] Remove Value::DoubleQuotedString ...and parser support for the corresponding token, as "..." in SQL[*] is not a literal string like we parse it - but a quoted identifier (which I intend to implement later). [*] in all the RBDMSes I know, except for sqlite which has complex rules in the name of "compatibility": https://www.sqlite.org/lang_keywords.html --- src/sqlast/value.rs | 3 --- src/sqlparser.rs | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/sqlast/value.rs b/src/sqlast/value.rs index 5bfb5299..a441987a 100644 --- a/src/sqlast/value.rs +++ b/src/sqlast/value.rs @@ -15,8 +15,6 @@ pub enum Value { Uuid(Uuid), /// 'string value' SingleQuotedString(String), - /// "string value" - DoubleQuotedString(String), /// Boolean value true or false, Boolean(bool), /// Date value @@ -39,7 +37,6 @@ impl ToString for Value { Value::String(v) => v.to_string(), Value::Uuid(v) => v.to_string(), Value::SingleQuotedString(v) => format!("'{}'", v), - Value::DoubleQuotedString(v) => format!("\"{}\"", v), Value::Boolean(v) => v.to_string(), Value::Date(v) => v.to_string(), Value::Time(v) => v.to_string(), diff --git a/src/sqlparser.rs b/src/sqlparser.rs index 3ef4c095..54652560 100644 --- a/src/sqlparser.rs +++ b/src/sqlparser.rs @@ -157,9 +157,7 @@ impl Parser { } } } - Token::Number(_) - | Token::SingleQuotedString(_) - | Token::DoubleQuotedString(_) => { + Token::Number(_) | Token::SingleQuotedString(_) => { self.prev_token(); self.parse_sql_value() } @@ -757,9 +755,6 @@ impl Parser { Token::SingleQuotedString(ref s) => { Ok(Value::SingleQuotedString(s.to_string())) } - Token::DoubleQuotedString(ref s) => { - Ok(Value::DoubleQuotedString(s.to_string())) - } _ => parser_err!(format!("Unsupported value: {:?}", self.peek_token())), } } @@ -791,7 +786,6 @@ impl Parser { pub fn parse_literal_string(&mut self) -> Result { match self.next_token() { Some(Token::SingleQuotedString(ref s)) => Ok(s.clone()), - Some(Token::DoubleQuotedString(ref s)) => Ok(s.clone()), other => parser_err!(format!("Expected literal string, found {:?}", other)), } }