diff options
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/interp/io.boot | 5 | ||||
-rw-r--r-- | src/interp/preparse.lisp | 5 | ||||
-rw-r--r-- | src/interp/spad-parser.boot | 8 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8a32132b..f74a591e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-06-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/io.boot (%Reader): Add idx field. + * interp/preparse.lisp ($INDEX): Remove. Adjust users. + 2012-06-06 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/lexing.boot: Move %Line to io.boot. diff --git a/src/interp/io.boot b/src/interp/io.boot index bb93e42b..d8b638dd 100644 --- a/src/interp/io.boot +++ b/src/interp/io.boot @@ -158,14 +158,15 @@ lineAdvanceChar! l == --% structure %Reader == Record(ins: %InputStream,est: %OutputStream, - lines: %List %String,sline: %Line) with + lines: %List %String,sline: %Line,idx: %Short) with readerInput == (.ins) readerError == (.est) -- error output stream readerPendingLines == (.lines) readerSourceLine == (.sline) -- current input line + readerLineNumber == (.idx) -- current line number makeReader(ist,ost == 'T) == - mk%Reader(ist,ost,nil,makeLine()) + mk%Reader(ist,ost,nil,makeLine(),0) ++ Add line `l' to the stack of pending lines. readerDeferLine(rd,l) == diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index 71786b00..6165e40b 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -63,7 +63,6 @@ ; Global storage -(defparameter $INDEX 0 "File line number of most recently read line.") (defparameter |$preparseLastLine| () "Most recently read line.") (defparameter |$preparseReportIfTrue| NIL "Should we print listings?") (defparameter $IOIndex 0 "Number of latest terminal input line.") @@ -72,7 +71,7 @@ (DEFPARAMETER DEFINITION_NAME NIL) (defun Initialize-Preparse (rd) - (setq $INDEX 0) + (SETF (|readerLineNumber| rd) 0) (setq |$preparseLastLine| (|readLine| (|readerInput| rd)))) (defvar $skipme) @@ -130,7 +129,7 @@ ('T (|readerDeferLine| rd (STRCONC (|makeString| N #\Space) (SUBSTRING A N NIL))) - (SETQ $INDEX (1- $INDEX)) + (SETF (|readerLineNumber| rd) (1- (|readerLineNumber| rd))) (SETQ A (SUBSEQ A 0 N)))) (GO NOCOMS)) ((= N OPARSYM) (setq PCOUNT (1+ PCOUNT))) diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot index 42cee897..2d49ad59 100644 --- a/src/interp/spad-parser.boot +++ b/src/interp/spad-parser.boot @@ -135,10 +135,10 @@ preparseReadLine1 rs == else line := expandLeadingTabs readLine readerInput rs $preparseLastLine := line - not string? line => [$INDEX] - $INDEX := $INDEX + 1 + not string? line => [readerLineNumber rs] + readerLineNumber(rs) := readerLineNumber rs + 1 line := trimTrailingBlank line - n := $INDEX + n := readerLineNumber rs if #line > 0 and line.maxIndex(line) = char "__" then line := strconc(subString(line,0,maxIndex line),rest preparseReadLine1 rs) $preparseLastLine := line @@ -200,7 +200,7 @@ preparse rd == $SKIPME := false if $preparseLastLine ~= nil then readerDeferLine(rd,$preparseLastLine) - $INDEX := $INDEX - #readerPendingLines rd + readerLineNumber(rd) := readerLineNumber rd - #readerPendingLines rd u := preparse1 rd $SKIPME => preparse rd parsePrint u |