]> gitweb.factorcode.org Git - factor.git/commitdiff
regexp.combinators: fix <char-range>.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Mar 2016 01:49:42 +0000 (18:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Mar 2016 01:49:42 +0000 (18:49 -0700)
basis/regexp/combinators/combinators.factor

index 3bb5fcef6d96ca8f692b8b859f52ef8fdf9f61dc..503f0bb1f03ed9f9a3292db4e52af2c213fc5eff 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
 USING: regexp sequences kernel regexp.negation regexp.ast
-accessors fry regexp.classes ;
+accessors fry regexp.classes strings ;
 IN: regexp.combinators
 
 <PRIVATE
@@ -19,9 +19,8 @@ CONSTANT: <nothing> R/ (?~.*)/s
     [ "\\Q" "\\E" surround ] [ <concatenation> ] bi make-regexp ; foldable
 
 : <char-range> ( char1 char2 -- regexp )
-    [ [ "[" "-" surround ] [ "]" append ] bi* append ]
-    [ <range-class> ]
-    2bi make-regexp ;
+    [ [ 1string ] bi@ [ "[" "-" surround ] [ "]" append ] bi* append ]
+    [ <range-class> ] 2bi make-regexp ;
 
 : <or> ( regexps -- disjunction )
     [ [ raw>> "(" ")" surround ] map "|" join ]