diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/boot/parser.boot | 18 | ||||
-rw-r--r-- | src/boot/strap/parser.clisp | 35 | ||||
-rw-r--r-- | src/boot/strap/translator.clisp | 5 | ||||
-rw-r--r-- | src/boot/translator.boot | 1 |
5 files changed, 37 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 647a7164..fafaf7d4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2012-05-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + * boot/parser.boot: Remove references to $bpParentCount. + * boot/translator.boot (shoeOutParse): Likewise. + +2012-05-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + * boot/parser.boot: Remove references to $stack. * boot/translator.boot: Likewise. diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 90d72172..68a8d11f 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -90,7 +90,7 @@ bpFirstTok ps == parserTokens ps = nil => mk%Token("ERROR","NOMORE",tokenPosition $stok) first parserTokens ps $ttok := tokenValue $stok - $bpParenCount > 0 and tokenClass $stok = "KEY" => + parserNesting ps > 0 and tokenClass $stok = "KEY" => $ttok is "SETTAB" => $bpCount:=$bpCount+1 bpNext ps @@ -114,14 +114,14 @@ bpRequire(ps,f) == apply(f,ps,nil) or bpTrap() bpState ps == - [parserTokens ps,parserTrees ps,$bpParenCount,$bpCount] + [parserTokens ps,parserTrees ps,parserNesting ps,$bpCount] bpRestore(ps,x)== parserTokens(ps) := first x bpFirstToken ps parserTrees(ps) := second x - $bpParenCount:=third x + parserNesting(ps) := third x $bpCount:=CADDDR x true @@ -150,22 +150,22 @@ bpIndentParenthesized(ps,f) == $bpCount:local:=0 a:=$stok bpEqPeek "OPAREN" => - $bpParenCount:=$bpParenCount+1 + parserNesting(ps) := parserNesting ps + 1 bpNext ps apply(f,ps,nil) and bpFirstTok ps and (bpEqPeek "CPAREN" or bpParenTrap(a)) => - $bpParenCount:=$bpParenCount-1 + parserNesting(ps) := parserNesting ps - 1 bpNextToken ps $bpCount=0 => true parserTokens(ps) := append(bpAddTokens $bpCount,parserTokens ps) bpFirstToken ps - $bpParenCount=0 => + parserNesting ps = 0 => bpCancel ps true true bpEqPeek "CPAREN" => bpPush(ps,bfTuple []) - $bpParenCount:=$bpParenCount-1 + parserNesting(ps) := parserNesting ps - 1 bpNextToken ps true bpParenTrap(a) @@ -366,11 +366,11 @@ bpMoveTo(ps,n) == bpMoveTo(ps,n+1) bpEqPeek "OPAREN" => bpNextToken ps - $bpParenCount:=$bpParenCount+1 + parserNesting(ps) := parserNesting(ps) + 1 bpMoveTo(ps,n) bpEqPeek "CPAREN" => bpNextToken ps - $bpParenCount:=$bpParenCount-1 + parserNesting(ps) := parserNesting ps - 1 bpMoveTo(ps,n) bpNextToken ps bpMoveTo(ps,n) diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index d96379e5..cf7c652c 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -65,7 +65,7 @@ T)) (DEFUN |bpFirstTok| (|ps|) - (DECLARE (SPECIAL |$bpCount| |$bpParenCount| |$ttok| |$stok|)) + (DECLARE (SPECIAL |$bpCount| |$ttok| |$stok|)) (PROGN (SETQ |$stok| (COND @@ -74,7 +74,7 @@ (T (CAR (|parserTokens| |ps|))))) (SETQ |$ttok| (|tokenValue| |$stok|)) (COND - ((AND (PLUSP |$bpParenCount|) (EQ (|tokenClass| |$stok|) 'KEY)) + ((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)) @@ -95,16 +95,17 @@ (DEFUN |bpRequire| (|ps| |f|) (OR (APPLY |f| |ps| NIL) (|bpTrap|))) (DEFUN |bpState| (|ps|) - (DECLARE (SPECIAL |$bpCount| |$bpParenCount|)) - (LIST (|parserTokens| |ps|) (|parserTrees| |ps|) |$bpParenCount| |$bpCount|)) + (DECLARE (SPECIAL |$bpCount|)) + (LIST (|parserTokens| |ps|) (|parserTrees| |ps|) (|parserNesting| |ps|) + |$bpCount|)) (DEFUN |bpRestore| (|ps| |x|) - (DECLARE (SPECIAL |$bpCount| |$bpParenCount|)) + (DECLARE (SPECIAL |$bpCount|)) (PROGN (SETF (|parserTokens| |ps|) (CAR |x|)) (|bpFirstToken| |ps|) (SETF (|parserTrees| |ps|) (CADR |x|)) - (SETQ |$bpParenCount| (CADDR |x|)) + (SETF (|parserNesting| |ps|) (CADDR |x|)) (SETQ |$bpCount| (CADDDR |x|)) T)) @@ -138,27 +139,31 @@ (DEFUN |bpIndentParenthesized| (|ps| |f|) (LET* (|a|) - (DECLARE (SPECIAL |$bpParenCount| |$stok|)) + (DECLARE (SPECIAL |$stok|)) (LET ((|$bpCount| 0)) (DECLARE (SPECIAL |$bpCount|)) (PROGN (SETQ |a| |$stok|) (COND - ((|bpEqPeek| 'OPAREN) (SETQ |$bpParenCount| (+ |$bpParenCount| 1)) + ((|bpEqPeek| 'OPAREN) + (SETF (|parserNesting| |ps|) (+ (|parserNesting| |ps|) 1)) (|bpNext| |ps|) (COND ((AND (APPLY |f| |ps| NIL) (|bpFirstTok| |ps|) (OR (|bpEqPeek| 'CPAREN) (|bpParenTrap| |a|))) - (SETQ |$bpParenCount| (- |$bpParenCount| 1)) (|bpNextToken| |ps|) + (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 |$bpParenCount| 0) (|bpCancel| |ps|) T) (T T))))) + (COND ((EQL (|parserNesting| |ps|) 0) (|bpCancel| |ps|) T) + (T T))))) ((|bpEqPeek| 'CPAREN) (|bpPush| |ps| (|bfTuple| NIL)) - (SETQ |$bpParenCount| (- |$bpParenCount| 1)) (|bpNextToken| |ps|) T) + (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) + (|bpNextToken| |ps|) T) (T (|bpParenTrap| |a|)))) (T NIL)))))) @@ -404,7 +409,7 @@ (|bpPush| |ps| (|reverse!| |b|))))) (DEFUN |bpMoveTo| (|ps| |n|) - (DECLARE (SPECIAL |$bpParenCount| |$bpCount|)) + (DECLARE (SPECIAL |$bpCount|)) (COND ((NULL (|parserTokens| |ps|)) T) ((|bpEqPeek| 'BACKTAB) (COND ((EQL |n| 0) T) @@ -414,9 +419,11 @@ (COND ((EQL |n| 0) T) (T (|bpNextToken| |ps|) (|bpMoveTo| |ps| |n|)))) ((|bpEqPeek| 'SETTAB) (|bpNextToken| |ps|) (|bpMoveTo| |ps| (+ |n| 1))) ((|bpEqPeek| 'OPAREN) (|bpNextToken| |ps|) - (SETQ |$bpParenCount| (+ |$bpParenCount| 1)) (|bpMoveTo| |ps| |n|)) + (SETF (|parserNesting| |ps|) (+ (|parserNesting| |ps|) 1)) + (|bpMoveTo| |ps| |n|)) ((|bpEqPeek| 'CPAREN) (|bpNextToken| |ps|) - (SETQ |$bpParenCount| (- |$bpParenCount| 1)) (|bpMoveTo| |ps| |n|)) + (SETF (|parserNesting| |ps|) (- (|parserNesting| |ps|) 1)) + (|bpMoveTo| |ps| |n|)) (T (|bpNextToken| |ps|) (|bpMoveTo| |ps| |n|)))) (DEFUN |bpQualifiedName| (|ps|) diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp index a77d32ee..623bd82f 100644 --- a/src/boot/strap/translator.clisp +++ b/src/boot/strap/translator.clisp @@ -434,8 +434,8 @@ (DEFUN |shoeOutParse| (|toks|) (LET* (|found| |ps|) (DECLARE - (SPECIAL |$bpParenCount| |$bpCount| |$returns| |$typings| |$wheredefs| - |$op| |$ttok| |$stok|)) + (SPECIAL |$bpCount| |$returns| |$typings| |$wheredefs| |$op| |$ttok| + |$stok|)) (PROGN (SETQ |ps| (|makeParserState| |toks|)) (SETQ |$stok| NIL) @@ -445,7 +445,6 @@ (SETQ |$typings| NIL) (SETQ |$returns| NIL) (SETQ |$bpCount| 0) - (SETQ |$bpParenCount| 0) (|bpFirstTok| |ps|) (SETQ |found| (LET ((#1=#:G729 diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 7f85b60a..b0d35442 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -363,7 +363,6 @@ shoeOutParse toks == $typings := [] $returns := [] $bpCount := 0 - $bpParenCount := 0 bpFirstTok ps found := try bpOutItem ps |