diff options
author | dos-reis <gdr@axiomatics.org> | 2008-12-16 16:22:08 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-12-16 16:22:08 +0000 |
commit | a03f68879f697998e2a3f41029a2034dc76767e0 (patch) | |
tree | 55d9bae7ff9aa4979da1567e0e1e6b49af5f92f0 /src/interp/preparse.lisp | |
parent | d338fac5f30034125dceaf6ab952018d8cba5a76 (diff) | |
download | open-axiom-a03f68879f697998e2a3f41029a2034dc76767e0.tar.gz |
r12470@gauss: gdr | 2008-12-14 17:43:50 -0600
Forgot to commit ChangeLog.
r12471@gauss: gdr | 2008-12-14 19:11:21 -0600
Fix typo in PrimitiveRatRicDE.
r12472@gauss: gdr | 2008-12-15 01:40:45 -0600
Reformat preparse.lisp.
r12473@gauss: gdr | 2008-12-15 03:25:17 -0600
Tidy.
r12474@gauss: gdr | 2008-12-15 21:33:54 -0600
Remove unused codes.
r12475@gauss: gdr | 2008-12-15 21:57:22 -0600
.
r12476@gauss: gdr | 2008-12-15 23:07:49 -0600
Tidy fatal diagnostics.
r12477@gauss: gdr | 2008-12-15 23:50:02 -0600
Fold iterator.boot into compiler.boot.
Diffstat (limited to 'src/interp/preparse.lisp')
-rw-r--r-- | src/interp/preparse.lisp | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index 48a44d41..cee7a6e2 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -352,42 +352,54 @@ (defun PARSEPILES (LOCS LINES) "Add parens and semis to lines to aid parsing." - (mapl #'add-parens-and-semis-to-line (NCONC LINES '(" ")) (nconc locs '(nil))) + (mapl #'add-parens-and-semis-to-line + (NCONC LINES '(" ")) + (nconc locs '(nil))) LINES) (defun add-parens-and-semis-to-line (slines slocs) - "The line to be worked on is (CAR SLINES). It's indentation is (CAR SLOCS). There -is a notion of current indentation. Then: + "The line to be worked on is (CAR SLINES). + It's indentation is (CAR SLOCS). + There is a notion of current indentation. Then: -A. Add open paren to beginning of following line if following line's indentation - is greater than current, and add close paren to end of last succeeding line - with following line's indentation. -B. Add semicolon to end of line if following line's indentation is the same. -C. If the entire line consists of the single keyword then or else, leave it alone." + A. Add open paren to beginning of following line if following + line's indentation is greater than current, and add close paren + to end of last succeeding line with following line's indentation. + B. Add semicolon to end of line if following line's indentation is + the same. + C. If the entire line consists of the single keyword then or else, + leave it alone." (let ((start-column (car slocs))) (if (and start-column (> start-column 0)) - (let ((count 0) (i 0)) + (let ((count 0) + (i 0)) (seq (mapl #'(lambda (next-lines nlocs) - (let ((next-line (car next-lines)) (next-column (car nlocs))) + (let ((next-line (car next-lines)) + (next-column (car nlocs))) (incf i) (if next-column - (progn (setq next-column (abs next-column)) - (if (< next-column start-column) (exit nil)) - (cond ((and (eq next-column start-column) - (rplaca nlocs (- (car nlocs))) - (not (infixtok next-line))) - (setq next-lines (drop (1- i) slines)) - (rplaca next-lines (addclose (car next-lines) #\;)) - (setq count (1+ count)))))))) + (progn + (setq next-column (abs next-column)) + (if (< next-column start-column) + (exit nil)) + (cond + ((and (eq next-column start-column) + (rplaca nlocs (- (car nlocs))) + (not (infixtok next-line))) + (setq next-lines (drop (1- i) slines)) + (rplaca next-lines + (addclose (car next-lines) #\;)) + (setq count (1+ count)))))))) (cdr slines) (cdr slocs))) (if (> count 0) - (progn (setf (char (car slines) (1- (nonblankloc (car slines)))) - #\( ) - (setq slines (drop (1- i) slines)) - (rplaca slines (addclose (car slines) #\) )))))))) + (progn + (setf (char (car slines) (1- (nonblankloc (car slines)))) + #\( ) + (setq slines (drop (1- i) slines)) + (rplaca slines (addclose (car slines) #\) )))))))) (defun INFIXTOK (S) (MEMBER (STRING2ID-N S 1) '(|then| |else|) :test #'eq)) |