aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-12-11 22:48:38 +0000
committerdos-reis <gdr@axiomatics.org>2010-12-11 22:48:38 +0000
commita07faca18a3f5f7435cfc21f0a66a183d2c0cd05 (patch)
treecdc26e56baad314d992424ba2223ef98dda3af4b /src/boot
parent0835ad7e9a8e7f90f61b633fd74304f00b07d386 (diff)
downloadopen-axiom-a07faca18a3f5f7435cfc21f0a66a183d2c0cd05.tar.gz
* boot/tokens.boot: `finally' is now a keyword.
* boot/parser.boot (bpMissing): Use a BootParserException exception. (bpTrap): Likewise. (bpListAndRecover): Catch them. * boot/parser.boot (shoeOutParse): Likewise. * boot/ast.boot (bfHandlers): Fix thinko. (codeForCatchHandlers): Likewise.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/ast.boot4
-rw-r--r--src/boot/parser.boot10
-rw-r--r--src/boot/strap/ast.clisp5
-rw-r--r--src/boot/strap/parser.clisp19
-rw-r--r--src/boot/strap/tokens.clisp7
-rw-r--r--src/boot/strap/translator.clisp13
-rw-r--r--src/boot/tokens.boot1
-rw-r--r--src/boot/translator.boot6
8 files changed, 46 insertions, 19 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index 2336a6c9..ed2ff3bc 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -1160,7 +1160,7 @@ bfHandlers(n,e,hs) == main(n,e,hs,nil) where
main(n,e,hs,xs) ==
hs = nil =>
["COND",
- nreverse
+ :nreverse
[[true,["THROW",KEYWORD::OPEN_-AXIOM_-CATCH_-POINT,n]],:xs]]
hs is [['%Catch,['%Signature,v,t],s],:hs'] =>
t :=
@@ -1171,7 +1171,7 @@ bfHandlers(n,e,hs) == main(n,e,hs,nil) where
codeForCatchHandlers(g,e,cs) ==
ehTest := ['AND,['CONSP,g],
- [bfQ(['CAR,g],KEYWORD::OPEN_-AXIOM_-CATCH_-POINT)]]
+ bfQ(['CAR,g],KEYWORD::OPEN_-AXIOM_-CATCH_-POINT)]
["LET",[[g,["CATCH",KEYWORD::OPEN_-AXIOM_-CATCH_-POINT,e]]],
["COND",[ehTest,bfHandlers(g,["CDR",g],cs)],[true,g]]]
diff --git a/src/boot/parser.boot b/src/boot/parser.boot
index 29141095..8212b965 100644
--- a/src/boot/parser.boot
+++ b/src/boot/parser.boot
@@ -258,13 +258,13 @@ bpMissingMate(close,open)==
bpMissing s==
bpSpecificErrorHere strconc(PNAME s,'" possibly missing")
- throw TRAPPOINT "TRAPPED"
+ throw 'TRAPPED : BootParserException
bpCompMissing s == bpEqKey s or bpMissing s
bpTrap()==
bpGeneralErrorHere()
- throw TRAPPOINT "TRAPPED"
+ throw 'TRAPPED : BootParserException
bpRecoverTrap()==
bpFirstToken()
@@ -281,9 +281,9 @@ bpListAndRecover(f)==
done := false
c := $inputStream
while not done repeat
- found := CATCH('TRAPPOINT,apply(f,nil))
--- try apply(f,nil)
--- catch TRAPPOINT --(e) => e
+ found :=
+ try apply(f,nil)
+ catch(e: BootParserException) => e
if found = "TRAPPED"
then
$inputStream:=c
diff --git a/src/boot/strap/ast.clisp b/src/boot/strap/ast.clisp
index 70ac6194..8511e03e 100644
--- a/src/boot/strap/ast.clisp
+++ b/src/boot/strap/ast.clisp
@@ -2082,7 +2082,7 @@
(RETURN
(COND
((NULL |hs|)
- (LIST 'COND
+ (CONS 'COND
(NREVERSE (CONS (LIST T
(LIST 'THROW
:OPEN-AXIOM-CATCH-POINT |n|))
@@ -2135,8 +2135,7 @@
(PROGN
(SETQ |ehTest|
(LIST 'AND (LIST 'CONSP |g|)
- (LIST (|bfQ| (LIST 'CAR |g|)
- :OPEN-AXIOM-CATCH-POINT))))
+ (|bfQ| (LIST 'CAR |g|) :OPEN-AXIOM-CATCH-POINT)))
(LIST 'LET
(LIST (LIST |g|
(LIST 'CATCH :OPEN-AXIOM-CATCH-POINT |e|)))
diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp
index e009d80d..9cdd72cb 100644
--- a/src/boot/strap/parser.clisp
+++ b/src/boot/strap/parser.clisp
@@ -319,7 +319,7 @@
(|bpSpecificErrorHere| (CONCAT (PNAME |s|) " possibly missing"))
(THROW :OPEN-AXIOM-CATCH-POINT
(CONS :OPEN-AXIOM-CATCH-POINT
- (CONS '(|SystemException|) (TRAPPOINT 'TRAPPED))))))
+ (CONS '(|BootParserException|) 'TRAPPED)))))
(DEFUN |bpCompMissing| (|s|) (OR (|bpEqKey| |s|) (|bpMissing| |s|)))
@@ -328,7 +328,7 @@
(|bpGeneralErrorHere|)
(THROW :OPEN-AXIOM-CATCH-POINT
(CONS :OPEN-AXIOM-CATCH-POINT
- (CONS '(|SystemException|) (TRAPPOINT 'TRAPPED))))))
+ (CONS '(|BootParserException|) 'TRAPPED)))))
(DEFUN |bpRecoverTrap| ()
(PROG (|pos2| |pos1|)
@@ -356,7 +356,20 @@
(COND
(|done| (RETURN NIL))
(T (PROGN
- (SETQ |found| (CATCH 'TRAPPOINT (APPLY |f| NIL)))
+ (SETQ |found|
+ (LET ((#0=#:G1354
+ (CATCH :OPEN-AXIOM-CATCH-POINT
+ (APPLY |f| NIL))))
+ (COND
+ ((AND (CONSP #0#)
+ (EQUAL (CAR #0#)
+ :OPEN-AXIOM-CATCH-POINT))
+ (COND
+ ((EQUAL (CAR #1=(CDR #0#))
+ '(|BootParserException|))
+ (LET ((|e| (CDR #1#))) |e|))
+ (T (THROW :OPEN-AXIOM-CATCH-POINT #0#))))
+ (T #0#))))
(COND
((EQ |found| 'TRAPPED) (SETQ |$inputStream| |c|)
(|bpRecoverTrap|))
diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp
index d64068f8..ecc3ce7e 100644
--- a/src/boot/strap/tokens.clisp
+++ b/src/boot/strap/tokens.clisp
@@ -8,9 +8,10 @@
(DEFCONSTANT |shoeKeyWords|
(LIST (LIST "and" 'AND) (LIST "by" 'BY) (LIST "case" 'CASE)
(LIST "catch" 'CATCH) (LIST "cross" 'CROSS)
- (LIST "else" 'ELSE) (LIST "for" 'FOR) (LIST "has" 'HAS)
- (LIST "if" 'IF) (LIST "import" 'IMPORT) (LIST "in" 'IN)
- (LIST "is" 'IS) (LIST "isnt" 'ISNT) (LIST "leave" 'LEAVE)
+ (LIST "else" 'ELSE) (LIST "finally" 'FINALLY)
+ (LIST "for" 'FOR) (LIST "has" 'HAS) (LIST "if" 'IF)
+ (LIST "import" 'IMPORT) (LIST "in" 'IN) (LIST "is" 'IS)
+ (LIST "isnt" 'ISNT) (LIST "leave" 'LEAVE)
(LIST "module" 'MODULE) (LIST "namespace" 'NAMESPACE)
(LIST "of" 'OF) (LIST "or" 'OR) (LIST "rem" 'REM)
(LIST "repeat" 'REPEAT) (LIST "return" 'RETURN)
diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp
index 1d17a095..2171c415 100644
--- a/src/boot/strap/translator.clisp
+++ b/src/boot/strap/translator.clisp
@@ -506,7 +506,18 @@
(SETQ |$bpCount| 0)
(SETQ |$bpParenCount| 0)
(|bpFirstTok|)
- (SETQ |found| (CATCH 'TRAPPOINT (|bpOutItem|)))
+ (SETQ |found|
+ (LET ((#0=#:G1354
+ (CATCH :OPEN-AXIOM-CATCH-POINT (|bpOutItem|))))
+ (COND
+ ((AND (CONSP #0#)
+ (EQUAL (CAR #0#) :OPEN-AXIOM-CATCH-POINT))
+ (COND
+ ((EQUAL (CAR #1=(CDR #0#))
+ '(|BootParserException|))
+ (LET ((|e| (CDR #1#))) |e|))
+ (T (THROW :OPEN-AXIOM-CATCH-POINT #0#))))
+ (T #0#))))
(COND
((EQ |found| 'TRAPPED) NIL)
((NOT (|bStreamNull| |$inputStream|)) (|bpGeneralErrorHere|)
diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot
index 62c33b56..e3d7bdf0 100644
--- a/src/boot/tokens.boot
+++ b/src/boot/tokens.boot
@@ -44,6 +44,7 @@ shoeKeyWords == [ _
['"catch","CATCH"], _
['"cross","CROSS"] , _
['"else", "ELSE"] , _
+ ['"finally", "FINALLY"], _
['"for", "FOR"] , _
['"has", "HAS"] , _
['"if", "IF"], _
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 1ae7a639..dd20eb89 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -363,8 +363,10 @@ shoeOutParse stream ==
$bpCount := 0
$bpParenCount := 0
bpFirstTok()
- found := CATCH('TRAPPOINT,bpOutItem()) --try bpOutItem() catch TRAPPOINT
- found = "TRAPPED" => nil
+ found :=
+ try bpOutItem()
+ catch(e: BootParserException) => e
+ found = 'TRAPPED => nil
not bStreamNull $inputStream =>
bpGeneralErrorHere()
nil