! 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 ; IN: regexp.combinators > @ ] ] [ '[ parse-tree>> @ ] ] bi* bi make-regexp ; inline PRIVATE> CONSTANT: R/ (?~.*)/s : ( string -- regexp ) [ "\\Q" "\\E" surround ] [ ] bi make-regexp ; foldable : ( char1 char2 -- regexp ) [ [ "[" "-" surround ] [ "]" append ] bi* append ] [ ] 2bi make-regexp ; : ( regexps -- disjunction ) [ [ raw>> "(" ")" surround ] map "|" join ] [ [ parse-tree>> ] map ] bi make-regexp ; foldable : ( strings -- regexp ) [ ] map ; foldable : ( regexps -- regexp ) [ [ raw>> ] map concat ] [ [ parse-tree>> ] map ] bi make-regexp ; foldable : ( regexp -- not-regexp ) [ "(?~" ")" surround ] [ ] modify-regexp ; foldable : ( regexps -- conjunction ) [ ] map ; foldable : ( regexp -- regexp* ) [ "(" ")*" surround ] [ ] modify-regexp ; foldable : ( regexp -- regexp+ ) [ "(" ")+" surround ] [ ] modify-regexp ; foldable :