diff --git a/basis/regexp/nfa/nfa.factor b/basis/regexp/nfa/nfa.factor index dd116f3d7a..537c85c2d3 100644 --- a/basis/regexp/nfa/nfa.factor +++ b/basis/regexp/nfa/nfa.factor @@ -9,6 +9,8 @@ regexp.transition-tables words sets regexp.classes unicode.case.private ; ! before processing starts IN: regexp.nfa +ERROR: feature-is-broken feature ; + SYMBOL: negation-mode : negated? ( -- ? ) negation-mode get 0 or odd? ; @@ -181,6 +183,7 @@ M: character-class-range nfa-node ( node -- ) ] if ; M: capture-group nfa-node ( node -- ) + "capture-groups" feature-is-broken eps literal-transition add-simple-entry capture-group-on add-traversal-flag term>> nfa-node @@ -201,6 +204,7 @@ M: negation nfa-node ( node -- ) negation-mode dec ; M: lookahead nfa-node ( node -- ) + "lookahead" feature-is-broken eps literal-transition add-simple-entry lookahead-on add-traversal-flag term>> nfa-node @@ -209,6 +213,7 @@ M: lookahead nfa-node ( node -- ) 2 [ concatenate-nodes ] times ; M: lookbehind nfa-node ( node -- ) + "lookbehind" feature-is-broken eps literal-transition add-simple-entry lookbehind-on add-traversal-flag term>> nfa-node diff --git a/basis/regexp/regexp-tests.factor b/basis/regexp/regexp-tests.factor index 74f06ed65b..6fc21be19c 100644 --- a/basis/regexp/regexp-tests.factor +++ b/basis/regexp/regexp-tests.factor @@ -1,5 +1,5 @@ USING: regexp tools.test kernel sequences regexp.parser -regexp.traversal eval strings ; +regexp.traversal eval strings multiline ; IN: regexp-tests \ must-infer @@ -76,6 +76,8 @@ IN: regexp-tests [ t ] [ "bar" "foo|bar" matches? ] unit-test [ f ] [ "foobar" "foo|bar" matches? ] unit-test +/* +! FIXME [ f ] [ "" "(a)" matches? ] unit-test [ t ] [ "a" "(a)" matches? ] unit-test [ f ] [ "aa" "(a)" matches? ] unit-test @@ -83,6 +85,7 @@ IN: regexp-tests [ f ] [ "aababaaabbac" "(a|b)+" matches? ] unit-test [ t ] [ "ababaaabba" "(a|b)+" matches? ] unit-test +*/ [ f ] [ "" "a{1}" matches? ] unit-test [ t ] [ "a" "a{1}" matches? ] unit-test @@ -165,9 +168,12 @@ IN: regexp-tests [ f ] [ "0" "[^\\d]" matches? ] unit-test [ t ] [ "a" "[^\\d]" matches? ] unit-test +/* +! FIXME [ t ] [ "a" "[a-z]{1,}|[A-Z]{2,4}|b*|c|(f|g)*" matches? ] unit-test [ t ] [ "a" "[a-z]{1,2}|[A-Z]{3,3}|b*|c|(f|g)*" matches? ] unit-test [ t ] [ "a" "[a-z]{1,2}|[A-Z]{3,3}" matches? ] unit-test +*/ [ t ] [ "1000" "\\d{4,6}" matches? ] unit-test [ t ] [ "1000" "[0-9]{4,6}" matches? ] unit-test @@ -238,7 +244,7 @@ IN: regexp-tests [ t ] [ "abc" R/ abc/r matches? ] unit-test [ t ] [ "abc" R/ a[bB][cC]/r matches? ] unit-test -[ t ] [ "adcbe" R/ a(?r)(bcd)(?-r)e/ matches? ] unit-test +! [ t ] [ "adcbe" R/ a(?r)(bcd)(?-r)e/ matches? ] unit-test ! FIXME [ t ] [ "s@f" "[a-z.-]@[a-z]" matches? ] unit-test [ f ] [ "a" "[a-z.-]@[a-z]" matches? ] unit-test @@ -247,6 +253,8 @@ IN: regexp-tests [ t ] [ "abc*" "[^\\*]*\\*" matches? ] unit-test [ t ] [ "bca" "[^a]*a" matches? ] unit-test +/* +! FIXME [ ] [ "(0[lL]?|[1-9]\\d{0,9}(\\d{0,9}[lL])?|0[xX]\\p{XDigit}{1,8}(\\p{XDigit}{0,8}[lL])?|0[0-7]{1,11}([0-7]{0,11}[lL])?|([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?|[0-9]+([eE][+-]?[0-9]+[fFdD]?|([eE][+-]?[0-9]+)?[fFdD]))" drop @@ -270,6 +278,7 @@ IN: regexp-tests [ "abc" ] [ "abc" "(ab|a)(bc)?" first-match >string ] unit-test [ "b" ] [ "aaaaaaaaaaaaaaaaaaaaaaab" "((a*)*b)*b" first-match >string ] unit-test +*/ ! [ t ] [ "a:b" ".+:?" matches? ] unit-test @@ -293,6 +302,8 @@ IN: regexp-tests [ "1.2.3.4" ] [ "1ABC2DEF3GHI4JK" R/ [A-Z]+/ "." re-replace ] unit-test +/* +! FIXME [ f ] [ "ab" "a(?!b)" first-match ] unit-test [ "a" ] [ "ac" "a(?!b)" first-match >string ] unit-test ! [ t ] [ "fxxbar" "(?!foo).{3}bar" matches? ] unit-test @@ -303,6 +314,7 @@ IN: regexp-tests [ 3 ] [ "foobar" "foo(?=bar)" match-head ] unit-test [ f ] [ "foobxr" "foo(?=bar)" match-head ] unit-test +*/ ! Bug in parsing word [ t ] [ "a" R' a' matches? ] unit-test