Fixing empty string error

Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
teo3300
2024-01-17 22:25:38 +09:00
parent 8ff87a40b1
commit aa32495a9d
2 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ impl Reader {
if Regex::new(r"^-?[0-9]+$").unwrap().is_match(tk) {
return Ok(Int(tk.parse::<isize>().unwrap()));
} else if tk.starts_with('\"') {
if tk.len() > 2 && tk.ends_with('\"') {
if tk.len() > 1 && tk.ends_with('\"') {
return Ok(Str(unescape_str(tk)));
}
return Err(MalErr::unrecoverable(