diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-12 23:54:09 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-12 23:54:09 +0200 |
commit | 3e4bf105335b4ee129823b7561f3bec320451fc3 (patch) | |
tree | 74bc8d9d1048aa847f109c1ca609a6c5349b391e | |
parent | ebf541c89aa304dbd96335e898c06b11269a81e9 (diff) |
Fix unicode spaces
-rw-r--r-- | cook/parse.scm | 5 | ||||
-rw-r--r-- | tests/parse.scm | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cook/parse.scm b/cook/parse.scm index ee4cdf2..0fc4744 100644 --- a/cook/parse.scm +++ b/cook/parse.scm @@ -85,7 +85,10 @@ https://github.com/cooklang/spec/blob/main/EBNF.md lis)) -(define whitespace-chars (char-set #\space)) +(define whitespace-chars (char-set-union + (char-set #\space #\x00A0 #\x1680) + (char-set #\x202F #\x205F #\x3000) + (ucs-range->char-set #x2000 #x200B))) (define newline-chars (char-set #\x000A #\x000D #\x0085 #\x2028 #\x2029)) (define punctuation-chars (char-set #\. #\{ #\})) ;; TODO: do it right (define word-chars (char-set-difference char-set:full diff --git a/tests/parse.scm b/tests/parse.scm index 2c1573b..2ebad75 100644 --- a/tests/parse.scm +++ b/tests/parse.scm @@ -290,7 +290,7 @@ ; NOTE: the space is U+2009 (test "testIngredientWithUnicodeWhitespace" '(recipe (metadata ()) - ((step ("Add some " (ingredient "chilli" #f) " then bake")))) + ((step ("Add " (ingredient "chilli" #f) " then bake")))) (cook->list (parse-cook "Add @chilli then bake\n"))) (test "testInvalidMultiWordIngredient" @@ -316,7 +316,7 @@ ; NOTE: the space is U+2009 (test "testCookwareWithUnicodeWhitespace" '(recipe (metadata ()) - ((step ( "Place in " (cookware "pot" #f) " then boil")))) + ((step ( "Add to " (cookware "pot" #f) " then boil")))) (cook->list (parse-cook "Add to #pot then boil\n"))) (test "testInvalidMultiWordCookware" |