feat(tokenizer): recognize meta-commands

This commit is contained in:
Khaïs COLIN 2025-05-04 12:06:47 +02:00
parent 825511a515
commit cbc4a4755c
5 changed files with 221 additions and 62 deletions

View file

@ -0,0 +1,28 @@
---
source: src/tokens.rs
expression: "tokenize(\".exit\".to_string(), \"<stdin>\".to_string())"
---
Ok(
[
Token {
location: Location {
file: "<stdin>",
offset: 0,
length: 5,
},
data: MetaCommand(
Exit,
),
lexeme: ".exit",
},
Token {
location: Location {
file: "<stdin>",
offset: 5,
length: 0,
},
data: EndOfFile,
lexeme: "",
},
],
)

View file

@ -0,0 +1,18 @@
---
source: src/tokens.rs
expression: "tokenize(\".halp\".to_string(), \"<stdin>\".to_string())"
---
Err(
[
ScanError {
location: Location {
file: "<stdin>",
offset: 0,
length: 5,
},
kind: UnknownMetaCommand(
".halp",
),
},
],
)