[Commit]
nickle compile.c,1.136,1.137 gram.y,1.119,1.120 pretty.c,1.61,1.62
Keith Packard
commit at keithp.com
Thu Jun 5 09:03:37 PDT 2003
- Previous message: [Commit] librr/src rr_client.c,NONE,1.1 rr_strbuf.c,NONE,1.1
rr_string.c,NONE,1.1 Makefile.am,1.1,1.2 rr.c,1.2,1.3 rr.h,1.3,1.4
rr_board.c,1.4,1.5 rrint.h,1.2,1.3
- Next message: [Commit] nickle gram.y,1.120,1.121
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv29687
Modified Files:
compile.c gram.y pretty.c
Log Message:
try { } catch a ... catch b was getting compiled backwards
Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- compile.c 29 May 2003 16:37:59 -0000 1.136
+++ compile.c 5 Jun 2003 15:03:34 -0000 1.137
@@ -1840,7 +1840,7 @@
if (catches)
{
- catch = catches->tree.left;
+ catch = catches->tree.right;
/*
* try a catch b
*
@@ -1909,7 +1909,7 @@
obj->nonLocal = NewNonLocal (obj->nonLocal, NonLocalTry, 0);
- obj = CompileCatch (obj, catches->tree.right, body, stat, code);
+ obj = CompileCatch (obj, catches->tree.left, body, stat, code);
obj->nonLocal = obj->nonLocal->prev;
@@ -3327,7 +3327,7 @@
case IMPORT:
break;
case CATCH:
- obj = CompileCatch (obj, expr->tree.right, expr->tree.left, expr, code);
+ obj = CompileCatch (obj, expr->tree.left, expr->tree.right, expr, code);
break;
case RAISE:
obj = CompileRaise (obj, expr, expr, code);
Index: gram.y
===================================================================
RCS file: /local/src/CVS/nickle/gram.y,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- gram.y 28 May 2003 21:20:26 -0000 1.119
+++ gram.y 5 Jun 2003 15:03:34 -0000 1.120
@@ -607,14 +607,14 @@
$1));
}
| TRY ignorenl statement catches attendnl
- { $$ = NewExprTree (CATCH, $3, $4); }
+ { $$ = NewExprTree (CATCH, $4, $3); }
| TWIXT ignorenl namespace_start OP opt_expr SEMI opt_expr CP statement namespace_end attendnl
{ $$ = NewExprTree (TWIXT,
NewExprTree (TWIXT, $5, $7),
NewExprTree (TWIXT, $9, 0));
}
;
-catches : catch catches
+catches : catches catch
{ $$ = NewExprTree (CATCH, $1, $2); }
|
{ $$ = 0; }
Index: pretty.c
===================================================================
RCS file: /local/src/CVS/nickle/pretty.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- pretty.c 1 May 2003 19:00:18 -0000 1.61
+++ pretty.c 5 Jun 2003 15:03:34 -0000 1.62
@@ -555,6 +555,30 @@
FilePuts (f, ")");
}
+static void
+_PrettyCatch (Value f, Expr *e, int level, Bool nest, ProfileData *pd)
+{
+ CodePtr catch;
+ Atom name;
+
+ if (!e)
+ return;
+ _PrettyCatch (f, e->tree.left, level, nest, pd);
+ if (nest)
+ PrettyIndent (f, 0, level, pd);
+ e = e->tree.right;
+ catch = e->code.code;
+ if (catch->base.name->base.tag == COLONCOLON)
+ name = catch->base.name->tree.right->atom.atom;
+ else
+ name = catch->base.name->atom.atom;
+ FilePuts (f, "catch ");
+ PrettyExpr (f, catch->base.name, 0, level, nest, pd);
+ FilePuts (f, " ");
+ PrettyBody (f, catch, level, nest, pd);
+ FilePuts (f, "\n");
+}
+
void
PrettyStatement (Value f, Expr *e, int level, int blevel, Bool nest, ProfileData *pd)
{
@@ -732,29 +756,11 @@
if (nest)
{
FilePuts (f, "\n");
- PrettyStatement (f, e->tree.left, level+1, level, nest, pd);
+ PrettyStatement (f, e->tree.right, level+1, level, nest, pd);
}
else
FilePuts (f, " ");
- while ((e = e->tree.right))
- {
- CodePtr catch;
- Atom name;
- if (nest)
- {
- PrettyIndent (f, 0, level, pd);
- }
- catch = e->tree.left->code.code;
- if (catch->base.name->base.tag == COLONCOLON)
- name = catch->base.name->tree.right->atom.atom;
- else
- name = catch->base.name->atom.atom;
- FilePuts (f, "catch ");
- PrettyExpr (f, catch->base.name, 0, level, nest, pd);
- FilePuts (f, " ");
- PrettyBody (f, e->tree.left->code.code, level, nest, pd);
- FilePuts (f, "\n");
- }
+ _PrettyCatch (f, e->tree.left, level, nest, pd);
break;
case RAISE:
PrettyIndent (f, e, level, pd);
- Previous message: [Commit] librr/src rr_client.c,NONE,1.1 rr_strbuf.c,NONE,1.1
rr_string.c,NONE,1.1 Makefile.am,1.1,1.2 rr.c,1.2,1.3 rr.h,1.3,1.4
rr_board.c,1.4,1.5 rrint.h,1.2,1.3
- Next message: [Commit] nickle gram.y,1.120,1.121
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list