From b09aa8e0a8ff6f0957f147c9bcac6f001de949b0 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 12 May 2012 00:58:26 +0000 Subject: * interp/io.boot (findString): New. * interp/preparse.lisp: Use it instead of SEARCH. --- src/ChangeLog | 5 +++++ src/interp/io.boot | 5 ++++- src/interp/preparse.lisp | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 55c15116..d2b5716b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-05-11 Gabriel Dos Reis + + * interp/io.boot (findString): New. + * interp/preparse.lisp: Use it instead of SEARCH. + 2012-05-11 Gabriel Dos Reis * interp/io.boot (findChar): New. diff --git a/src/interp/io.boot b/src/interp/io.boot index 17fa032b..87416720 100644 --- a/src/interp/io.boot +++ b/src/interp/io.boot @@ -96,4 +96,7 @@ expandLeadingTabs line == findChar(c,s,k == 0) == or/[i for i in k..maxIndex s | stringChar(s,i) = c] - +findString(s1,s2,k == 0) == + n1 := #s1 + or/[i for i in k..(#s2 - n1) | + and/[stringChar(s1,j) = stringChar(s2,i+j) for j in 0..(n1-1)]] diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index 1f83d525..9c16a21e 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -105,8 +105,8 @@ (setq PSLOC SLOC) (setq I 0 INSTRING () PCOUNT 0) 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 COMSYM (OR (|findString| "--" A I) L)) + (setq NCOMSYM (OR (|findString| "++" A I) L)) (setq OPARSYM (OR (|findChar| #\( A I) L)) (setq CPARSYM (OR (|findChar| #\) A I) L)) (setq N (MIN STRSYM COMSYM NCOMSYM OPARSYM CPARSYM)) @@ -141,7 +141,7 @@ ((setq CONTINUE NIL))) (if (and (null LINES) (= SLOC 0)) ;;test for skipping constructors (if (and |$byConstructors| - (null (search "==>" a)) + (null (|findString| "==>" a)) (not (member (setq functor (intern (substring a 0 (STRPOSL ": (=" A 0 NIL)))) |$byConstructors|))) -- cgit v1.2.3