feat(tokenizer): recognize meta-commands
This commit is contained in:
parent
825511a515
commit
cbc4a4755c
5 changed files with 221 additions and 62 deletions
|
|
@ -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: "",
|
||||
},
|
||||
],
|
||||
)
|
||||
|
|
@ -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",
|
||||
),
|
||||
},
|
||||
],
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue