No multiline strings for now

Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
teo3300
2024-01-17 17:09:08 +09:00
parent 18ca7ddbdf
commit 6eed79557f
2 changed files with 7 additions and 2 deletions

View File

@ -116,7 +116,6 @@ pub fn interactive(env: Env) {
}
Err(ReadlineError::Interrupted) => {
parser.clear();
// eprintln!("; ... Interrupted");
continue;
}
Err(ReadlineError::Eof) => exit(0),

View File

@ -99,7 +99,13 @@ impl Reader {
if Regex::new(r"^-?[0-9]+$").unwrap().is_match(tk) {
Ok(Int(tk.parse::<isize>().unwrap()))
} else if tk.starts_with('\"') {
Ok(Str(unescape_str(tk)))
if tk.len() > 2 && tk.ends_with('\"') {
Ok(Str(unescape_str(tk)))
} else {
Err(MalErr::recoverable(
"End of line reached without closing string",
))
}
} else if tk.starts_with(':') {
Ok(Key(format!("ʞ{}", tk)))
} else {