Skip to content

Loading…

Update for new strings library. #33

Merged
merged 1 commit into from

1 participant

@cgay
The Dylan Language member

I'll merge this after merging strings.

@cgay cgay merged commit d94fb39 into dylan-lang:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 19, 2012
  1. @cgay

    Update for new strings library.

    cgay committed
Showing with 20 additions and 20 deletions.
  1. +2 −2 dylan/access.dylan
  2. +6 −6 dylan/git-storage.dylan
  3. +5 −5 dylan/group.dylan
  4. +1 −1 dylan/library.dylan
  5. +4 −4 dylan/rst-parser.dylan
  6. +1 −1 dylan/tag.dylan
  7. +1 −1 dylan/user.dylan
View
4 dylan/access.dylan
@@ -217,7 +217,7 @@ end method parse-rules;
define method parse-rule
(rule :: <string>)
=> (rule, errors? :: <boolean>)
- let rule = trim(rule);
+ let rule = strip(rule);
let action = $allow;
if (rule.size > 0)
if (rule[0] = '!')
@@ -297,7 +297,7 @@ define method respond-to-post
resource-not-found-error(url: request-url(current-request()));
end;
with-query-values (view-content, modify-content, modify-acls, comment, owner-name)
- let owner = trim(owner-name);
+ let owner = strip(owner-name);
let new-owner = ~empty?(owner) & find-user(owner);
let owner-err? = ~empty?(owner) & ~new-owner;
View
12 dylan/git-storage.dylan
@@ -499,7 +499,7 @@ define function git-parse-group
description :: <string>)
=> (user :: <wiki-group>)
let (group-name, owner-name, #rest member-names) = apply(values, split(people, ':'));
- let desc-size = string-to-integer(trim(description-size));
+ let desc-size = string-to-integer(strip(description-size));
let description = slice(description, 0, desc-size);
local method find-user-or-admin (name)
let user = find-user(name);
@@ -754,7 +754,7 @@ define function git-parse-tags
(blob :: <string>) => (tags :: <sequence>)
// one tag per line...
choose(complement(empty?),
- remove-duplicates!(map(trim, split(blob, $newline-regex)),
+ remove-duplicates!(map(strip, split(blob, $newline-regex)),
test: \=))
end;
@@ -843,7 +843,7 @@ define function %git-commit
sformat("\"%s\" \"%s\"", path, extra-path),
sformat("\"%s\"", path));
- let comment = trim(comment);
+ let comment = strip(comment);
let (stdout, stderr, exit-code)
= call-git(storage,
sformat("commit --author \"%s <%s@opendylan.org>\" -m \"%s\" %s",
@@ -855,7 +855,7 @@ define function %git-commit
error?: #f);
if (subsequence-position(stdout, "nothing to commit"))
// No changes were made. Return the head revision.
- trim(call-git(storage,
+ strip(call-git(storage,
sformat("rev-list --max-count=1 HEAD -- %s", extra-path | path),
working-directory: repo-root))
elseif (exit-code ~= 0)
@@ -876,7 +876,7 @@ define function %git-commit
$whitespace-regex);
let short-hash = elt(parts, -1);
// Unfortunately we have to run another command to get the full hash...
- let hash = trim(call-git(storage,
+ let hash = strip(call-git(storage,
sformat("rev-list --max-count=1 %s -- \"%s\"",
short-hash, extra-path | path),
working-directory: repo-root));
@@ -908,7 +908,7 @@ define function git-load-changes
values(reverse!(meta-data),
lines.tail)
else
- loop(pair(trim(lines.head), meta-data),
+ loop(pair(strip(lines.head), meta-data),
lines.tail)
end
end
View
10 dylan/group.dylan
@@ -40,7 +40,7 @@ end;
// This is pretty restrictive for now. Easier to loosen the rules later
-// than to tighten them up. The name has been pre-trimmed and %-decoded.
+// than to tighten them up. The name has been pre-stripped and %-decoded.
//
define method validate-group-name
(name :: <string>) => (name :: <string>)
@@ -279,7 +279,7 @@ define method respond-to-get
(dsp :: <edit-group-page>,
#key name :: <string>,
revision :: false-or(<string>)) // TODO:
- let name = trim(percent-decode(name));
+ let name = strip(percent-decode(name));
let group = find-group(name);
set-group-page-attributes(name, group);
process-template(dsp);
@@ -289,7 +289,7 @@ define method respond-to-post
(dsp :: <edit-group-page>,
#key name :: <string>,
revision :: false-or(<string>)) // TODO:
- let name = trim(percent-decode(name));
+ let name = strip(percent-decode(name));
let group = find-group(name);
set-group-page-attributes(name, group);
if (~group)
@@ -299,8 +299,8 @@ define method respond-to-post
let new-name = validate-form-field("group-name", validate-group-name);
let owner-name = validate-form-field("group-owner", validate-user-name);
let new-owner = find-user(owner-name);
- let comment = trim(get-query-value("comment") | "");
- let description = trim(get-query-value("group-description") | "");
+ let comment = strip(get-query-value("comment") | "");
+ let description = strip(get-query-value("group-description") | "");
if (empty?(description))
add-field-error("group-description", "A description is required.");
end;
View
2 dylan/library.dylan
@@ -86,7 +86,7 @@ define module %wiki
use smtp-client;
use streams;
use strings,
- import: { index-of, trim };
+ import: { find-substring, strip };
use substring-search;
use table-extensions,
rename: { table => make-table };
View
8 dylan/rst-parser.dylan
@@ -57,7 +57,7 @@ define function parse-wiki-markup
*markup-suffix* = *default-markup-suffix*)
iterate loop (start :: <integer> = 0)
if (start < markup.size)
- let markup-bpos = index-of(markup, *markup-prefix*, start: start);
+ let markup-bpos = find-substring(markup, *markup-prefix*, start: start);
if (~markup-bpos)
add!(chunks, slice(markup, start, #f));
else
@@ -92,7 +92,7 @@ end function parse-wiki-markup;
define function parse-markup-element
(markup-text :: <string>, bpos :: <integer>)
=> (chunk :: type-union(<string>, <wiki-reference>), epos :: <integer>)
- let epos = index-of(markup-text, *markup-suffix*, start: bpos);
+ let epos = find-substring(markup-text, *markup-suffix*, start: bpos);
if (epos)
let tokens = tokenize(slice(markup-text, bpos, epos));
values(iff(empty?(tokens),
@@ -178,12 +178,12 @@ define function parse-string-token
iterate loop (i = bpos)
case
i = len =>
- values(trim(slice(text, bpos, #f)), i, '\0');
+ values(strip(slice(text, bpos, #f)), i, '\0');
member?(text[i], end-delims) =>
let tok = slice(text, bpos, i);
let delim = text[i];
if (delim ~= '"' & delim ~= '\'')
- tok := trim(tok);
+ tok := strip(tok);
end;
values(tok, i + 1, text[i]);
otherwise =>
View
2 dylan/tag.dylan
@@ -12,7 +12,7 @@ define wf/object-test (tag) in wiki end;
define function parse-tags
(tag-string :: <string>) => (tags :: <sequence>)
choose(complement(empty?),
- remove-duplicates!(map(trim, split(tag-string, ",")), test: \=));
+ remove-duplicates!(map(strip, split(tag-string, ",")), test: \=));
end;
define function unparse-tags
View
2 dylan/user.dylan
@@ -259,7 +259,7 @@ define method account-activation-url
end method account-activation-url;
// This is pretty restrictive for now. Easier to loosen the rules later
-// than to tighten them up. The name has been pre-trimmed and %-decoded.
+// than to tighten them up. The name has been pre-stripped and %-decoded.
//
define method validate-user-name
(name :: <string>) => (name :: <string>)
Something went wrong with that request. Please try again.