aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-05-12 00:08:20 +0000
committerdos-reis <gdr@axiomatics.org>2012-05-12 00:08:20 +0000
commitc4a6434d9caaa918b11d40f38566551067ee034f (patch)
tree1cf9414bbd89de02cd388c443df415940ae63ff0 /src
parent90e40ff963ffdca1272e393e2458d04040976096 (diff)
downloadopen-axiom-c4a6434d9caaa918b11d40f38566551067ee034f.tar.gz
* interp/io.boot (findChar): New.
* interp/preparse.lisp (preparse1): Use it instead of POSITION.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/io.boot5
-rw-r--r--src/interp/preparse.lisp6
3 files changed, 13 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 475ee3d0..55c15116 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2012-05-11 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/io.boot (findChar): New.
+ * interp/preparse.lisp (preparse1): Use it instead of POSITION.
+
+2012-05-11 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/preparse.lisp (PARSEPRINT): Move to spad-parser.boot.
Rename as parsePrint.
diff --git a/src/interp/io.boot b/src/interp/io.boot
index 1e94a4be..17fa032b 100644
--- a/src/interp/io.boot
+++ b/src/interp/io.boot
@@ -92,3 +92,8 @@ expandLeadingTabs line ==
indLoc := indentationLocation line
nbLoc = indLoc => line
strconc(makeString(indLoc,char " "), subString(line,nbLoc))
+
+findChar(c,s,k == 0) ==
+ or/[i for i in k..maxIndex s | stringChar(s,i) = c]
+
+
diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp
index 90083fcb..1f83d525 100644
--- a/src/interp/preparse.lisp
+++ b/src/interp/preparse.lisp
@@ -104,11 +104,11 @@
(if (EQ L 0) (GO READLOOP))
(setq PSLOC SLOC)
(setq I 0 INSTRING () PCOUNT 0)
- STRLOOP (setq STRSYM (OR (position #\" A :start I ) L))
+ STRLOOP (setq STRSYM (OR (|findChar| #\" A I) L))
(setq COMSYM (OR (search "--" A :start2 I ) L))
(setq NCOMSYM (OR (search "++" A :start2 I ) L))
- (setq OPARSYM (OR (position #\( A :start I ) L))
- (setq CPARSYM (OR (position #\) A :start I ) L))
+ (setq OPARSYM (OR (|findChar| #\( A I) L))
+ (setq CPARSYM (OR (|findChar| #\) A I) L))
(setq N (MIN STRSYM COMSYM NCOMSYM OPARSYM CPARSYM))
(cond ((= N L) (GO NOCOMS))
((|escaped?| A N))