]> gitweb.factorcode.org Git - factor.git/commitdiff
strings.parser: fix bug with octal escape followed by more numbers
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 26 Jul 2022 20:06:26 +0000 (13:06 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 26 Jul 2022 20:06:26 +0000 (13:06 -0700)
core/strings/parser/parser-tests.factor
core/strings/parser/parser.factor

index 441177eea44d92ee4c0062bbe1f780ff33db66e2..42bf70932ef7dd4a551e9aae17017c22eac0acc6 100644 (file)
@@ -29,6 +29,7 @@ USING: accessors eval kernel lexer strings.parser tools.test ;
 { "foo bar" } [ "\"foo \\\nbar\"" eval( -- obj ) ] unit-test
 
 { "a" } [ "\"\\141\"" eval( -- obj ) ] unit-test
+{ "a1" } [ "\"\\1411\"" eval( -- obj ) ] unit-test
 { "\0" } [ "\"\\0\"" eval( -- obj ) ] unit-test
 { "\x01" } [ "\"\\01\"" eval( -- obj ) ] unit-test
 { "\n" } [ "\"\\012\"" eval( -- obj ) ] unit-test
index 9656a1308c3cf63099331eb0afaa722dcdc88b9e..ee3dbfa36e34666902588e81e2c7d49b7a477ad5 100644 (file)
@@ -34,8 +34,8 @@ name>char-hook [
     2 cut-slice [ hex> ] dip ;
 
 : oct-escape ( str -- ch/f str' )
-    dup [
-        3 short head-slice [ CHAR: 0 CHAR: 7 between? not ] find drop
+    dup 3 short head-slice [
+        [ CHAR: 0 CHAR: 7 between? not ] find drop
     ] keep '[ _ length ] unless* [ f ] when-zero
     [ cut-slice [ oct> ] dip ] [ f swap ] if* ;