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
This commit is contained in:
Nickolay Ponomarev 2019-01-13 01:51:07 +03:00
parent efdbf0f9dc
commit 56884dc700
2 changed files with 1 additions and 10 deletions

View file

@ -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(),

View file

@ -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<String, ParserError> {
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)),
}
}