Fix lexer: Strings can be empty
This commit is contained in:
parent
ac1f8aef03
commit
c5e9cf2155
2 changed files with 4 additions and 2 deletions
|
@ -75,7 +75,7 @@ sub tokenize {
|
||||||
value => $1,
|
value => $1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
elsif($str =~ s/^"(([^"\\]|\\.)+)"//)
|
elsif($str =~ s/^"(([^"\\]|\\.)*)"//)
|
||||||
{
|
{
|
||||||
$debug->("String '$1'");
|
$debug->("String '$1'");
|
||||||
my $value = $1;
|
my $value = $1;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
(plan 4)
|
(plan 5)
|
||||||
|
|
||||||
(expect "length of string" (= (length "hello") 5))
|
(expect "length of string" (= (length "hello") 5))
|
||||||
|
|
||||||
|
(expect "empty strings" (= (length "") 0))
|
||||||
|
|
||||||
(expect "string-upcase" (string= (string-upcase "helLo") "HELLO"))
|
(expect "string-upcase" (string= (string-upcase "helLo") "HELLO"))
|
||||||
|
|
||||||
(expect "string-downcase" (string= (string-downcase "HEllO") "hello"))
|
(expect "string-downcase" (string= (string-downcase "HEllO") "hello"))
|
||||||
|
|
Loading…
Reference in a new issue