diff options
| author | Charles Forsyth <charles.forsyth@gmail.com> | 2015-05-04 12:30:51 +0100 |
|---|---|---|
| committer | Charles Forsyth <charles.forsyth@gmail.com> | 2015-05-04 12:30:51 +0100 |
| commit | b3bd3a7f218d6ab40fa45f4370d27e2fa4b5a330 (patch) | |
| tree | ddc9be3998d128e21ebbcc407ec988d84547ec01 /appl/lib | |
| parent | 9362a07a49e28c5b68cc47c23b55a4469cf38807 (diff) | |
remove obsolete undocumented incomplete interface
Diffstat (limited to 'appl/lib')
| -rw-r--r-- | appl/lib/mkfile | 1 | ||||
| -rw-r--r-- | appl/lib/regexutils.b | 65 |
2 files changed, 0 insertions, 66 deletions
diff --git a/appl/lib/mkfile b/appl/lib/mkfile index 206e4240..4f975883 100644 --- a/appl/lib/mkfile +++ b/appl/lib/mkfile @@ -100,7 +100,6 @@ TARG=\ readpng.dis\ readxbitmap.dis\ regex.dis\ - regexutils.dis\ registries.dis\ rfc822.dis\ riff.dis\ diff --git a/appl/lib/regexutils.b b/appl/lib/regexutils.b deleted file mode 100644 index 4040f0bf..00000000 --- a/appl/lib/regexutils.b +++ /dev/null @@ -1,65 +0,0 @@ -implement RegexUtils; - -# matching and substitution functions -# evb@lucent.com - -include "sys.m"; - sys: Sys; - -include "regexutils.m"; - -init() -{ - if (sys == nil) - sys = load Sys Sys->PATH; - - regex = load Regex Regex->PATH; - if (regex == nil) - raise "fail: Regex not loaded"; -} - -match(pattern: Regex->Re, s: string): string -{ - pos := regex->execute(pattern, s); - if (pos == nil) - return ""; - (beg, end) := pos[0]; - - return s[beg:end]; -} - -match_mult(pattern: Regex->Re, s: string): array of (int, int) -{ - return regex->execute(pattern, s); -} - -sub(text, pattern, new: string): string -{ - return sub_re(text, regex->compile(pattern, 0).t0, new); -} - -sub_re(text: string, pattern: Regex->Re, new: string): string -{ - pos := regex->execute(pattern, text); - if (pos == nil) - return text; - - (beg, end) := pos[0]; - newline := text[:beg] + new + text[end:]; - return newline; -} - -subg(text, pattern, new: string): string -{ - return subg_re(text, regex->compile(pattern, 0).t0, new); -} - -subg_re(text: string, pattern: Regex->Re, new: string): string -{ - oldtext := text; - while ( (text = sub_re(text, pattern, new)) != oldtext) { - oldtext = text; - } - - return text; -} |
