diff --git a/README.md b/README.md index 7c20c07a..7fe2284c 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ Lykia is a toy document database basically written for educational purposes. It - [x] A minimal standard library - [ ] SQL parsing - [x] "SELECT" expressions (the most complex part of the SQL syntax) - - [ ] "INSERT" statements - - [ ] "UPDATE" statements - - [ ] "DELETE" statements -- [ ] Query planning + - [ ] "INSERT" statements (in progress) + - [ ] "UPDATE" statements (in progress) + - [ ] "DELETE" statements (in progress) +- [ ] Query planning (in progress) - [ ] Plan optimization - [ ] Async runtime/event loop - [ ] In-memory storage engine diff --git a/server/src/lang/scanner.rs b/server/src/lang/scanner.rs index b473e696..b988597b 100644 --- a/server/src/lang/scanner.rs +++ b/server/src/lang/scanner.rs @@ -172,18 +172,18 @@ impl<'a> Scanner<'a> { } }; - if !is_coerced_identifier && CASE_SNS_KEYWORDS.contains_key(&raw_str) { + if !is_coerced_identifier && GENERIC_KEYWORDS.contains_key(&raw_str) { Ok(Token { - tok_type: CASE_SNS_KEYWORDS.get(&raw_str).unwrap().clone(), + tok_type: GENERIC_KEYWORDS.get(&raw_str).unwrap().clone(), literal: None, lexeme: Some(raw_str), span, }) } else if !is_coerced_identifier - && CASE_INS_KEYWORDS.contains_key(&raw_str.to_ascii_uppercase()) + && SQL_KEYWORDS.contains_key(&raw_str.to_ascii_uppercase()) { Ok(Token { - tok_type: CASE_INS_KEYWORDS + tok_type: SQL_KEYWORDS .get(&raw_str.to_ascii_uppercase()) .unwrap() .clone(), diff --git a/server/src/lang/token.rs b/server/src/lang/token.rs index 68eef360..e83cc39d 100644 --- a/server/src/lang/token.rs +++ b/server/src/lang/token.rs @@ -182,7 +182,7 @@ pub static SYMBOLS: phf::Map = phf_map! { ']' => sym!(Symbol::RightBracket), }; -pub static CASE_SNS_KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! { +pub static GENERIC_KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! { "class" => kw!(Keyword::Class), "else" => kw!(Keyword::Else), "for" => kw!(Keyword::For), @@ -203,7 +203,7 @@ pub static CASE_SNS_KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! { "true" => TokenType::True, }; -pub static CASE_INS_KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! { +pub static SQL_KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! { // "ALL" => skw!(SqlKeyword::All), "DISTINCT" => skw!(SqlKeyword::Distinct),