diff options
| author | Drahflow <drahflow@gmx.de> | 2015-05-05 18:06:38 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2015-05-05 18:06:38 +0200 |
| commit | f4a118394fc9dd1ba6c295bf22218724be8d3038 (patch) | |
| tree | 198e1c952b67b002fece072f3013aab6eeb9a71c | |
| parent | fa78ff8312f8567a28bdced9f7344428e1a09b65 (diff) | |
Simplified sys .glob for the usual cases
| -rw-r--r-- | TODO | 4 | ||||
| -rw-r--r-- | elymas/lib/sys.ey | 18 |
2 files changed, 21 insertions, 1 deletions
@@ -1,6 +1,8 @@ * make '' applicable to arrays, too, i.e. save input type * utf8 -* glob +* regex substitution +* asm-based regex engine +* [,] must be escapable in regex * txt .consume .u sollte nicht negative Zahlen liefern * evtl. BigNums bauen und die Int-Funktionen entsprechend machen * trigonometrics diff --git a/elymas/lib/sys.ey b/elymas/lib/sys.ey index a373475..8f128cb 100644 --- a/elymas/lib/sys.ey +++ b/elymas/lib/sys.ey @@ -19,6 +19,24 @@ sys .readdir { 0 -01 * 0 "." * neq } grep } /ls sys .deff + { _ ==pattern + "^(.*)/([^/]*)$" regex { + ==dir =pattern + }" { + "." ==dir + }" ? * + [ pattern { ==c + [ + # FIXME: [, ] escapes in regexes + { c 0 "." * eq } { "\\." { } each } + { c 0 "*" * eq } { ".*" { } each } + { c 0 "?" * eq } { "." { } each } + { 1 } { c } + ] conds + } each ] str .fromArray ==rx + dir sys .readdir { rx regex } grep + } /glob sys .deff + { "\0" cat -01 "\0" cat -01 +rename 0 neq { ??io.rename } rep } /rename sys .deff |
