aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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))