From e978fdb127b726df8a04c4f7f1936b7eaf5e227b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 30 May 2012 12:59:38 +0000 Subject: * boot/parser.boot: Remove references to $bpCount. * boot/translator.boot (shoeOutParse): Likewise. --- src/boot/strap/parser.clisp | 78 +++++++++++++++++++++-------------------- src/boot/strap/translator.clisp | 4 +-- 2 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src/boot/strap') diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index cf7c652c..620207d2 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -65,7 +65,7 @@ T)) (DEFUN |bpFirstTok| (|ps|) - (DECLARE (SPECIAL |$bpCount| |$ttok| |$stok|)) + (DECLARE (SPECIAL |$ttok| |$stok|)) (PROGN (SETQ |$stok| (COND @@ -76,9 +76,10 @@ (COND ((AND (PLUSP (|parserNesting| |ps|)) (EQ (|tokenClass| |$stok|) 'KEY)) (COND - ((EQ |$ttok| 'SETTAB) (SETQ |$bpCount| (+ |$bpCount| 1)) (|bpNext| |ps|)) - ((EQ |$ttok| 'BACKTAB) (SETQ |$bpCount| (- |$bpCount| 1)) - (|bpNext| |ps|)) + ((EQ |$ttok| 'SETTAB) + (SETF (|parserScope| |ps|) (+ (|parserScope| |ps|) 1)) (|bpNext| |ps|)) + ((EQ |$ttok| 'BACKTAB) + (SETF (|parserScope| |ps|) (- (|parserScope| |ps|) 1)) (|bpNext| |ps|)) ((EQ |$ttok| 'BACKSET) (|bpNext| |ps|)) (T T))) (T T)))) @@ -95,18 +96,16 @@ (DEFUN |bpRequire| (|ps| |f|) (OR (APPLY |f| |ps| NIL) (|bpTrap|))) (DEFUN |bpState| (|ps|) - (DECLARE (SPECIAL |$bpCount|)) (LIST (|parserTokens| |ps|) (|parserTrees| |ps|) (|parserNesting| |ps|) - |$bpCount|)) + (|parserScope| |ps|))) (DEFUN |bpRestore| (|ps| |x|) - (DECLARE (SPECIAL |$bpCount|)) (PROGN (SETF (|parserTokens| |ps|) (CAR |x|)) (|bpFirstToken| |ps|) (SETF (|parserTrees| |ps|) (CADR |x|)) (SETF (|parserNesting| |ps|) (CADDR |x|)) - (SETQ |$bpCount| (CADDDR |x|)) + (SETF (|parserScope| |ps|) (CADDDR |x|)) T)) (DEFUN |bpPush| (|ps| |x|) @@ -138,34 +137,37 @@ |a|))) (DEFUN |bpIndentParenthesized| (|ps| |f|) - (LET* (|a|) + (LET* (|a| |scope|) (DECLARE (SPECIAL |$stok|)) - (LET ((|$bpCount| 0)) - (DECLARE (SPECIAL |$bpCount|)) - (PROGN - (SETQ |a| |$stok|) - (COND - ((|bpEqPeek| 'OPAREN) - (SETF (|parserNesting| |ps|) (+ (|parserNesting| |ps|) 1)) - (|bpNext| |ps|) - (COND - ((AND (APPLY |f| |ps| NIL) (|bpFirstTok| |ps|) - (OR (|bpEqPeek| 'CPAREN) (|bpParenTrap| |a|))) - (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) - (|bpNextToken| |ps|) - (COND ((EQL |$bpCount| 0) T) - (T - (SETF (|parserTokens| |ps|) - (|append| (|bpAddTokens| |$bpCount|) - (|parserTokens| |ps|))) - (|bpFirstToken| |ps|) - (COND ((EQL (|parserNesting| |ps|) 0) (|bpCancel| |ps|) T) - (T T))))) - ((|bpEqPeek| 'CPAREN) (|bpPush| |ps| (|bfTuple| NIL)) - (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) - (|bpNextToken| |ps|) T) - (T (|bpParenTrap| |a|)))) - (T NIL)))))) + (PROGN + (SETQ |scope| (|parserScope| |ps|)) + (UNWIND-PROTECT + (PROGN + (SETF (|parserScope| |ps|) 0) + (SETQ |a| |$stok|) + (COND + ((|bpEqPeek| 'OPAREN) + (SETF (|parserNesting| |ps|) (+ (|parserNesting| |ps|) 1)) + (|bpNext| |ps|) + (COND + ((AND (APPLY |f| |ps| NIL) (|bpFirstTok| |ps|) + (OR (|bpEqPeek| 'CPAREN) (|bpParenTrap| |a|))) + (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) + (|bpNextToken| |ps|) + (COND ((EQL (|parserScope| |ps|) 0) T) + (T + (SETF (|parserTokens| |ps|) + (|append| (|bpAddTokens| (|parserScope| |ps|)) + (|parserTokens| |ps|))) + (|bpFirstToken| |ps|) + (COND ((EQL (|parserNesting| |ps|) 0) (|bpCancel| |ps|) T) + (T T))))) + ((|bpEqPeek| 'CPAREN) (|bpPush| |ps| (|bfTuple| NIL)) + (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) + (|bpNextToken| |ps|) T) + (T (|bpParenTrap| |a|)))) + (T NIL))) + (SETF (|parserScope| |ps|) |scope|))))) (DEFUN |bpParenthesized| (|ps| |f|) (LET* (|a|) @@ -378,7 +380,7 @@ (COND (|done| (RETURN NIL)) (T (SETQ |found| - (LET ((#1=#:G719 + (LET ((#1=#:G720 (CATCH :OPEN-AXIOM-CATCH-POINT (APPLY |f| |ps| NIL)))) (COND @@ -409,11 +411,11 @@ (|bpPush| |ps| (|reverse!| |b|))))) (DEFUN |bpMoveTo| (|ps| |n|) - (DECLARE (SPECIAL |$bpCount|)) (COND ((NULL (|parserTokens| |ps|)) T) ((|bpEqPeek| 'BACKTAB) (COND ((EQL |n| 0) T) - (T (|bpNextToken| |ps|) (SETQ |$bpCount| (- |$bpCount| 1)) + (T (|bpNextToken| |ps|) + (SETF (|parserScope| |ps|) (- (|parserScope| |ps|) 1)) (|bpMoveTo| |ps| (- |n| 1))))) ((|bpEqPeek| 'BACKSET) (COND ((EQL |n| 0) T) (T (|bpNextToken| |ps|) (|bpMoveTo| |ps| |n|)))) diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp index 623bd82f..c9d4a9d5 100644 --- a/src/boot/strap/translator.clisp +++ b/src/boot/strap/translator.clisp @@ -434,8 +434,7 @@ (DEFUN |shoeOutParse| (|toks|) (LET* (|found| |ps|) (DECLARE - (SPECIAL |$bpCount| |$returns| |$typings| |$wheredefs| |$op| |$ttok| - |$stok|)) + (SPECIAL |$returns| |$typings| |$wheredefs| |$op| |$ttok| |$stok|)) (PROGN (SETQ |ps| (|makeParserState| |toks|)) (SETQ |$stok| NIL) @@ -444,7 +443,6 @@ (SETQ |$wheredefs| NIL) (SETQ |$typings| NIL) (SETQ |$returns| NIL) - (SETQ |$bpCount| 0) (|bpFirstTok| |ps|) (SETQ |found| (LET ((#1=#:G729 -- cgit v1.2.3