Skip to content

Commit

Permalink
fix: Beginning of SQL statements and planning
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Dec 31, 2023
1 parent b8de55c commit cb0546d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions server/src/lang/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions server/src/lang/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub static SYMBOLS: phf::Map<char, TokenType> = 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),
Expand All @@ -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),
Expand Down

0 comments on commit cb0546d

Please sign in to comment.