I think this patch is much better.
Remove "dropLeadingBlanks", it is only used once.
Also removes manual loops, uses function instead.
- Qian
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index bba51e02..42cf4171 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -170,18 +170,6 @@ stringPrefix?(pref,str) ==
i := i + 1
ok
-dropLeadingBlanks str ==
- str := object2String str
- l := QCSIZE str
- nb := NIL
- i := 0
- while (i < l) and not nb repeat
- if SCHAR(str,i) ~= SCHAR('" ",0) then nb := i
- else i := i + 1
- nb = 0 => str
- nb => SUBSTRING(str,nb,NIL)
- '""
-
concat(:l) == concatList l
concatList [x,:y] ==
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index eca9f345..3337fd8c 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -2455,15 +2455,10 @@ synonymSpad2Cmd() ==
terminateSystemCommand()
processSynonymLine line ==
+ line := STRING_-LEFT_-TRIM('" ", line)
key := STRING2ID_N (line, 1)
- value := removeKeyFromLine line where
- removeKeyFromLine line ==
- line := dropLeadingBlanks line
- mx := MAXINDEX line
- for i in 0..mx repeat
- line.i = " " =>
- return (for j in (i+1)..mx repeat
- line.j ~= " " => return (SUBSTRING (line, j, nil)))
+ value := SUBSTRING(line, # STRINGIMAGE key, nil)
+ value := STRING_-LEFT_-TRIM('" ", value)
[key, :value]