aboutsummaryrefslogtreecommitdiff
path: root/src/boot/strap
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-05-13 09:29:07 +0000
committerdos-reis <gdr@axiomatics.org>2011-05-13 09:29:07 +0000
commit0df19c03c721d4ef214b335445a530dbfa66d570 (patch)
tree9ce093588b0d376b7c61c3f219dc61ea8dd2e7ba /src/boot/strap
parent665cb7df0fd6106b61a88667ae132e613d395cc4 (diff)
downloadopen-axiom-0df19c03c721d4ef214b335445a530dbfa66d570.tar.gz
* boot/utility.boot (charPosition): New.
* boot/scanner.boot (shoeAccumulateLines): Use it. (shoeS): Likewise.
Diffstat (limited to 'src/boot/strap')
-rw-r--r--src/boot/strap/scanner.clisp19
-rw-r--r--src/boot/strap/utility.clisp11
2 files changed, 21 insertions, 9 deletions
diff --git a/src/boot/strap/scanner.clisp b/src/boot/strap/scanner.clisp
index 2a01edc0..208c588a 100644
--- a/src/boot/strap/scanner.clisp
+++ b/src/boot/strap/scanner.clisp
@@ -131,13 +131,12 @@
(COND
((CHAR= (SCHAR |command| 0) (|char| '|;|))
(|shoeAccumulateLines| |$r| |string|))
- (T (SETQ |a| (STRPOS ";" |command| 0 NIL))
- (COND
- (|a| (|shoeAccumulateLines| |$r|
- (CONCAT |string|
- (|subString| |command| 0 (- |a| 1)))))
- (T (|shoeAccumulateLines| |$r|
- (CONCAT |string| |command|)))))))
+ ((SETQ |a| (|charPosition| (|char| '|;|) |command| 0))
+ (|shoeAccumulateLines| |$r|
+ (CONCAT |string|
+ (|subString| |command| 0 (- |a| 1)))))
+ (T (|shoeAccumulateLines| |$r|
+ (CONCAT |string| |command|)))))
(T (|shoeAccumulateLines| |$r| |string|))))
(T (CONS |s| |string|))))))
@@ -347,8 +346,10 @@
((NOT (< |$n| |$sz|))
(|SoftShoeError| (CONS |$linepos| |$n|) "quote added") "")
(T (SETQ |n| |$n|)
- (SETQ |strsym| (OR (STRPOS "\"" |$ln| |$n| NIL) |$sz|))
- (SETQ |escsym| (OR (STRPOS "_" |$ln| |$n| NIL) |$sz|))
+ (SETQ |strsym|
+ (OR (|charPosition| (|char| '|"|) |$ln| |$n|) |$sz|))
+ (SETQ |escsym|
+ (OR (|charPosition| (|char| '_) |$ln| |$n|) |$sz|))
(SETQ |mn| (MIN |strsym| |escsym|))
(COND
((EQUAL |mn| |$sz|) (SETQ |$n| |$sz|)
diff --git a/src/boot/strap/utility.clisp b/src/boot/strap/utility.clisp
index 02f52e9f..7bfc9387 100644
--- a/src/boot/strap/utility.clisp
+++ b/src/boot/strap/utility.clisp
@@ -302,3 +302,14 @@
((OR (CHARACTERP |x|) (INTEGERP |x|)) (|removeScalar| |l| |x|))
(T (|removeValue| |l| |x|))))
+(DEFUN |charPosition| (|c| |s| |k|)
+ (PROG (|n|)
+ (RETURN
+ (PROGN
+ (SETQ |n| (LENGTH |s|))
+ (LOOP
+ (COND
+ ((NOT (< |k| |n|)) (RETURN NIL))
+ ((CHAR= (SCHAR |s| |k|) |c|) (RETURN |k|))
+ (T (SETQ |k| (+ |k| 1)))))))))
+