From 3e906e4a73ec71b8d48f00104c38cb8778b9e176 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 3 Jun 2012 17:03:18 +0000 Subject: * interp/io.boot (%Reader): New data structure. * interp/preparse.lisp (INITIALIZE-PREPARSE): Parameter is now a reader. (preparse1): Likewise. Tidy. * interp/spad-parser.boot (preparseReadLine): Likewise. (preparseReadLine1): Likewise. (preparse): Likewise. (parseSpadFile): Likewise. * interp/spad.lisp (SPAD): Make it a unary function. Simplify. (INITIALIZE): Remove. --- src/interp/preparse.lisp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/interp/preparse.lisp') diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index f0edee7c..175a3f7c 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -73,20 +73,20 @@ (DEFPARAMETER TOK NIL) (DEFPARAMETER DEFINITION_NAME NIL) -(defun Initialize-Preparse (strm) +(defun Initialize-Preparse (rd) (setq $INDEX 0 |$LineList| nil |$EchoLineStack| nil) - (setq |$preparseLastLine| (|readLine| strm))) + (setq |$preparseLastLine| (|readLine| (|readerInput| rd)))) (defvar $skipme) -(defun |preparse1| (LineList) - (PROG ((|$LineList| LineList) |$EchoLineStack| NUM A I L PSLOC +(defun |preparse1| (rd) + (PROG ((|$LineList| (|readerLines| rd)) |$EchoLineStack| NUM A I L PSLOC INSTRING PCOUNT COMSYM STRSYM OPARSYM CPARSYM N NCOMSYM (SLOC -1) (CONTINUE NIL) (PARENLEV 0) (NCOMBLOCK ()) (LINES ()) (LOCS ()) (NUMS ()) functor ) - READLOOP (DCQ (NUM . A) (|preparseReadLine| LineList)) + READLOOP (DCQ (NUM . A) (|preparseReadLine| rd)) (cond ((|atEndOfUnit?| A) - (|preparseEcho| LineList) + (|preparseEcho| (|readerLines| rd)) (COND ((NULL LINES) (RETURN NIL)) (NCOMBLOCK (|findCommentBlock| NIL NUMS LOCS NCOMBLOCK NIL))) @@ -94,7 +94,7 @@ (|parsePiles| (|reverse!| LOCS) (|reverse!| LINES)))))) (cond ((and (NULL LINES) (> (LENGTH A) 0) (EQ (CHAR A 0) #\) )) ; this is a command line, don't parse it - (|preparseEcho| LineList) + (|preparseEcho| (|readerLines| rd)) (setq |$preparseLastLine| nil) ;don't reread this line (SETQ LINE a) (CATCH 'SPAD_READER (|doSystemCommand| (subseq LINE 1))) @@ -125,7 +125,7 @@ (COND ((= SLOC N) (COND ((AND NCOMBLOCK (NOT (= N (CAR NCOMBLOCK)))) - (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK linelist) + (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK (|readerLines| rd)) (SETQ NCOMBLOCK NIL))) (SETQ NCOMBLOCK (CONS N (CONS A (IFCDR NCOMBLOCK)))) (SETQ A "")) @@ -157,8 +157,8 @@ (setq $skipme nil)))) (when (and LINES (EQL SLOC 0)) (IF (AND NCOMBLOCK (NOT (ZEROP (CAR NCOMBLOCK)))) - (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK linelist)) - (IF (NOT (|ioTerminal?| in-stream)) + (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK (|readerLines| rd))) + (IF (NOT (|ioTerminal?| (|readerInput| rd))) (setq |$preparseLastLine| (|reverse!| |$EchoLineStack|))) (RETURN (|pairList| (|reverse!| NUMS) @@ -168,14 +168,14 @@ (setq SLOC PSLOC) (GO REREAD))) (COND (NCOMBLOCK - (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK linelist) + (|findCommentBlock| NUM NUMS LOCS NCOMBLOCK (|readerLines| rd)) (setq NCOMBLOCK ()))) (PUSH SLOC LOCS) - REREAD (|preparseEcho| LineList) + REREAD (|preparseEcho| (|readerLines| rd)) (PUSH A LINES) (PUSH NUM NUMS) (setq PARENLEV (+ PARENLEV PCOUNT)) - (when (and (|ioTerminal?| in-stream) (not continue)) + (when (and (|ioTerminal?| (|readerInput| rd)) (not continue)) (setq |$preparseLastLine| nil) (RETURN (|pairList| (|reverse!| NUMS) (|parsePiles| (|reverse!| LOCS) (|reverse!| LINES))))) -- cgit v1.2.3