[Commit] nickle ChangeLog,1.86,1.87 gram.y,1.140,1.141

Bart Massey commit at keithp.com
Wed Sep 22 09:51:34 PDT 2004


Committed by: bart

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv31107

Modified Files:
	ChangeLog gram.y 
Log Message:
Made try blocks as well as try statements not create a new
scope, for convenience in using try the way it is intended
to be used.



Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- ChangeLog	22 Sep 2004 07:01:10 -0000	1.86
+++ ChangeLog	22 Sep 2004 16:51:30 -0000	1.87
@@ -1,3 +1,10 @@
+2004-09-22  Bart Massey  <bart at cs.pdx.edu>
+
+	* gram.y:
+	Made try blocks as well as try statements not create a new
+	scope, for convenience in using try the way it is intended
+	to be used.
+	
 2004-09-21  Bart Massey  <bart at cs.pdx.edu>
 
 	* gram.y:

Index: gram.y
===================================================================
RCS file: /local/src/CVS/nickle/gram.y,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- gram.y	22 Sep 2004 07:01:10 -0000	1.140
+++ gram.y	22 Sep 2004 16:51:31 -0000	1.141
@@ -93,7 +93,9 @@
 %type  <expr>	    fullname
 %type  <expr>	    opt_rawnames rawname rawnames rawnamespace
 %type  <atom>	    rawatom
-%type  <expr>	    block opt_func_body func_body func_right statements statement if_statement try_statement catches catch
+%type  <expr>	    block opt_func_body func_body func_right catches catch
+%type  <expr>	    statements statement simple_statement
+%type  <expr>	    if_statement try_statement try_body_statement
 %type  <expr>	    block_or_expr
 %type  <expr>	    case_block cases case
 %type  <expr>	    union_case_block union_cases union_case
@@ -456,7 +458,11 @@
 		| IF ignorenl namespace_start OP expr CP statement ELSE statement
 		    { $$ = NewExprTree(ELSE, $5, NewExprTree(ELSE, $7, $9)); }
 
-statement	: if_statement namespace_end attendnl
+statement:	simple_statement
+		| block
+		;
+
+simple_statement: if_statement namespace_end attendnl
                     { $$ = $1; }
 		| WHILE ignorenl namespace_start OP expr CP statement namespace_end attendnl
 		    { $$ = NewExprTree(WHILE, $5, $7); }
@@ -479,7 +485,6 @@
 		    { $$ = NewExprTree (RETURNTOK, (Expr *) 0, $2); }
 		| expr SEMI
 		    { $$ = NewExprTree(EXPR, $1, (Expr *) 0); }
-		| block
 		| SEMI
 		    { $$ = NewExprTree(SEMI, (Expr *) 0, (Expr *) 0); }
 		| func_decl doc_string opt_func_body namespace_end
@@ -640,7 +645,11 @@
 		    { $$ = NewExprTree(SEMI, $1, 0); }
 		;
 
-try_statement:  TRY ignorenl statement catches
+try_body_statement:  simple_statement
+		| OC statements CC
+		    { $$ = $2; }
+
+try_statement:  TRY ignorenl try_body_statement catches
 		    { $$ = NewExprTree (CATCH, $4, $3); }
                 ;
 




More information about the Commit mailing list