globs: making glob-matches? support wildcards.
parent
6581741a92
commit
a5f117c88f
|
@ -22,6 +22,8 @@ tools.test ;
|
|||
|
||||
{ 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
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ IN: globs
|
|||
: 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> ]]
|
||||
|
@ -29,7 +32,8 @@ CharClass = "^"?:n Ranges:e => [[ e <or> n [ <not> ] when ]]
|
|||
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> ]]
|
||||
|
|
Loading…
Reference in New Issue