{ f } [ "foo" "bar" append-path "*" glob-matches? ] unit-test
{ t } [ "foo" "bar" append-path "*" "*" append-path glob-matches? ] unit-test
+{ t } [ "foo" "bar" append-path "**/bar" glob-matches? ] unit-test
+{ t } [ "foo" "bar" append-path "**/b*" glob-matches? ] unit-test
{ f } [ "foo" "bar" append-path "foo?bar" glob-matches? ] unit-test
{ t } [ "foo" "bar" append-path "fo?" "bar" append-path glob-matches? ] unit-test
: not-path-separator ( -- sep )
os windows? R/ [^\\/\\]/ R/ [^\\/]/ ? ; foldable
+: wild-path-separator ( -- sep )
+ os windows? R/ [^\\/\\][\\/\\]|[^\\/\\]/ R/ [^\\/][\\/]|[^\\/]/ ? ; foldable
+
EBNF: <glob>
Character = "\\" .:c => [[ c 1string <literal> ]]
AlternationBody = Concatenation:c "," AlternationBody:a => [[ a c prefix ]]
| Concatenation => [[ 1array ]]
-Element = "*" => [[ not-path-separator <zero-or-more> ]]
+Element = "**" => [[ wild-path-separator <zero-or-more> ]]
+ | "*" => [[ not-path-separator <zero-or-more> ]]
| "?" => [[ not-path-separator ]]
| "[" CharClass:c "]" => [[ c ]]
| "{" AlternationBody:b "}" => [[ b <or> ]]