Fix lexer: Strings can be empty

This commit is contained in:
madmaurice 2021-04-10 01:26:07 +02:00
parent ac1f8aef03
commit c5e9cf2155
2 changed files with 4 additions and 2 deletions

View file

@ -75,7 +75,7 @@ sub tokenize {
value => $1,
};
}
elsif($str =~ s/^"(([^"\\]|\\.)+)"//)
elsif($str =~ s/^"(([^"\\]|\\.)*)"//)
{
$debug->("String '$1'");
my $value = $1;

View file

@ -1,7 +1,9 @@
(plan 4)
(plan 5)
(expect "length of string" (= (length "hello") 5))
(expect "empty strings" (= (length "") 0))
(expect "string-upcase" (string= (string-upcase "helLo") "HELLO"))
(expect "string-downcase" (string= (string-downcase "HEllO") "hello"))