Commit graph

48 commits

Author SHA1 Message Date
47a68e5069
docs: add code comments and test cases for tokenization 2025-06-04 21:05:58 +02:00
33c4edf91d
feat(grammar): meta-commands must be followed by end-of-file 2025-06-04 14:06:57 +02:00
64d93e9a27
refactor(location): deduplicated usage of Location::new with same value into default 2025-06-03 22:00:18 +02:00
567aa31c07
feat(errors): improve error messages with example values
Add token type examples to make error messages more helpful. Created an
ExpectedToken enum to replace string literals for better type safety,
added example values for each token type, and enhanced error display to
show concrete examples of valid syntax.
2025-06-03 22:00:03 +02:00
e78511f692
feat(parser): implement semicolon-separated statements
Add support for semicolon-terminated statements according to the
updated grammar. This change enables executing multiple SQL statements
in a single input by separating them with semicolons. Key improvements
include:
- Update grammar to require semicolons after statements
- Add Semicolon token to the tokenizer
- Implement error recovery by skipping to next semicolon on parse errors
- Create helper functions for checking semicolons in statement parsers
- Add tests for multiple statements and error conditions
2025-06-03 19:06:54 +02:00
28cb288eaf
feat(parser): implement insert command parsing
Implements the parse_insert_command function to handle the insert
statement according to the grammar definition. The function now
correctly parses the command format insert int string string and creates
a structured Statement::Insert with the id, username, and email fields.
2025-06-03 17:48:36 +02:00
315703d46b
feat(meta): version command 2025-05-31 16:04:56 +02:00
2dead7de0a
feat(meta): add about meta-command 2025-05-30 15:58:07 +02:00
8553ae7a5a
fix(error display): print errors to stderr 2025-05-30 13:46:29 +02:00
b79702684a
feat(error display): better error message for unmatched " 2025-05-30 13:43:53 +02:00
00e9bc3b60
feat(tokenizer): string tokenizing 2025-05-24 14:38:13 +02:00
f259b079b7
feat(tokenizer): parse integers 2025-05-17 16:22:25 +02:00
71a9d82d96
feat(tokenizer): add Token::Int & UnexpectedToken error type 2025-05-10 17:00:13 +02:00
faedfadeab
refactor(error_report): remove dead code 2025-05-10 10:42:32 +02:00
620259af48
feat(error_report): show proeminent marking on error location 2025-05-10 10:35:50 +02:00
9b75cb6144
feat(cli): readline history 2025-05-10 10:28:58 +02:00
fe66326956
refactor(get_command): spawn rustyline instance from main() 2025-05-09 17:19:54 +02:00
3d4ab2e2e4 feat(cli): use rustyline for cmd entry, which allows for richer editing 2025-05-04 18:48:47 +02:00
6b49d3ca14 refactor(parsing): remove old FromStr-based parser implementation 2025-05-04 18:25:42 +02:00
106c2547b5 fix(errors): unexpected char errors were pointing one char too far 2025-05-04 18:11:21 +02:00
a0869b1b66 feat(parser): use token-based parser 2025-05-04 18:07:20 +02:00
d568653a17 feat(parser): parse tokens into commands 2025-05-04 14:14:16 +02:00
f634da3318 refactor(TokenKind): remove unused kinds 2025-05-04 13:58:07 +02:00
80cbbab6ef feat(ScanError) implement OSDBError trait 2025-05-04 13:56:59 +02:00
55b4779964 refactor(CommandParseError): remove the display implementation
we want to be able to give additional arguments to the display function later,
so this is needed
2025-05-04 13:45:09 +02:00
b8ed0868cb feat(CommandParseError): add ScanError variand with Into impl 2025-05-04 13:38:07 +02:00
cbc4a4755c feat(tokenizer): recognize meta-commands 2025-05-04 13:35:31 +02:00
825511a515 refactor(error): deduplicate error display code 2025-05-03 22:01:29 +02:00
fe6573b2de feat(error): display location of error 2025-05-03 21:55:19 +02:00
51569d3ec2 feat(errors): display basic errors with ariadne 2025-05-03 21:51:25 +02:00
4246775db5 refactor(errors): error display function takes an input string to be able to resolve spans in the future 2025-05-03 21:30:36 +02:00
442c4b7beb feat(error): display filename with the error message 2025-05-03 21:27:55 +02:00
32cfdfa07f tests(cmd): ensure wrong meta commands are recognized 2025-05-03 21:22:37 +02:00
848775587e tests(cmd): ensure wrong statements are recognized 2025-05-03 21:21:26 +02:00
92c50d6b65 tests(meta): ensure .exit works 2025-05-03 21:18:45 +02:00
47f174fb25 tests(cmd): ensure select statement works 2025-05-03 21:16:09 +02:00
75c3c74bba tests(cmd): ensure insert statement works 2025-05-03 21:14:52 +02:00
1f90d0acc3 refactor(command): display command results from special function 2025-05-03 21:10:03 +02:00
4435b375ef fix(exit): print exit message on exit via ctrl-d 2025-05-03 19:07:46 +02:00
7fbaec8743 test: ensure startup message is correct 2025-05-03 19:05:16 +02:00
6910407ad2 refactor(error_display): generic display method for error types
this is to better support ariadne in the future
2025-05-03 18:47:43 +02:00
e841a1779e feat(parser): add tokenizer (not actually called) 2025-05-03 18:17:32 +02:00
5b6d878208 refactor(command): generic execute and result type 2025-05-02 20:54:12 +02:00
711d51090e refactor(meta-command): have execute be a member function 2025-05-02 20:46:33 +02:00
ee23572983 refactor: pull things into own files, have a library 2025-05-02 20:43:55 +02:00
a7876f76bf feat(osdb): parse insert and select statements 2025-05-02 20:32:59 +02:00
a9ab0fff01 feat(osdb): basic read loop 2025-05-01 22:02:36 +02:00
edc3a7b532 feat(rust): initialize rust project 2025-05-01 19:34:18 +02:00