rev 661 - in trunk: . pr/test src

SVN User <[email protected]> Thu, 24 Jun 2004 22:12:35 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-06-24 22:12:32 -0400 (Thu, 24 Jun 2004)
New Revision: 661

Modified:
   trunk/STATUS.txt
   trunk/pr/test/test.pr
   trunk/src/parser.h
   trunk/src/parser_routines.c
   trunk/src/prothon.y
Log:
changed "except label = expr:" to "except expr as label:"

Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt	2004-06-24 07:26:16 UTC (rev 660)
+++ trunk/STATUS.txt	2004-06-25 02:12:32 UTC (rev 661)
@@ -1,15 +1,10 @@
 
 ----------------------- TO-DO (highest priority first) ------------------------
 
---- pretty print
-	http://www.prothon.org/pipermail/prothon-user/2004-June/002112.html
-
---- except (ExceptionObject1, ExceptionObject2) as label:
-
 --- OSThread, Thread, and Gate
 --- lock keyword?
 
---- implement from Module import *
+--- implement from Module import * ???
 
 --- implement 1xc3fe ?
 --- implement taint attribute on strings, unTaint() method, respect in .fmt, eval, exec
@@ -34,7 +29,6 @@
 --- Traceback objects (stack trace of an exception), exceptions should show function names
 --- Fix error reporting mess, hide fake file names
 --- raise exception_object, doc_object
---- except exception_object, tgt_obj
 
 --- put in skeleton code for + _"abc"
 --- GNU message catalog _"abc" strings
@@ -46,6 +40,10 @@
 
 --- add conditional expression "if C then x else y"
 
+--- pretty print
+	http://www.prothon.org/pipermail/prothon-user/2004-June/002112.html
+--- help() in interactive console()
+
 --- support list and dictionary object params directly in string.fmt() ???
 
 --- add resolution order combining prototypes and scope chains
@@ -70,8 +68,6 @@
 
 --- nesting  /* .. */ comments 
 
---- help() in interactive console()
-
 --- check dict keys for mutability bit
 
 --- -m -l cmd-line options missing

Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr	2004-06-24 07:26:16 UTC (rev 660)
+++ trunk/pr/test/test.pr	2004-06-25 02:12:32 UTC (rev 661)
@@ -1,4 +1,6 @@
 #!/usr/bin/env prothon
 
-x = print(Object, Modules, sep='\n', eol='\n\n')
-print (x)
+try:
+	1//0
+except DivideByZero as e:
+	print (e)
\ No newline at end of file

Modified: trunk/src/parser.h
===================================================================
--- trunk/src/parser.h	2004-06-24 07:26:16 UTC (rev 660)
+++ trunk/src/parser.h	2004-06-25 02:12:32 UTC (rev 661)
@@ -167,7 +167,7 @@
 code_p exceptall(void* param);
 code_p exec_expr(void* param, code_p expr);
 code_p expr_andor_expr(void* param, code_p lparm, code_p rparm, int andor_flg);
-code_p expr_label_body_to_except(void* param, obj_p label, code_p expr, code_p body);
+code_p expr_label_body_to_except(void* param, code_p expr, obj_p label, code_p body);
 code_p expr_to_param(void* param, code_p expr);
 code_p expr_to_slice(void* param, code_p expr);
 code_p expr_to_sparm(void* param, code_p p1);

Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c	2004-06-24 07:26:16 UTC (rev 660)
+++ trunk/src/parser_routines.c	2004-06-25 02:12:32 UTC (rev 661)
@@ -1566,7 +1566,7 @@
 	res->code_data[1].data = OBJ(EXCEPTION);
 	return debug_retrn(__LINE__, res);
 }
-code_p expr_label_body_to_except(void* param, obj_p label, code_p expr, code_p body) {
+code_p expr_label_body_to_except(void* param, code_p expr, obj_p label, code_p body) {
 	code *res;
 	int k=0, len=3, stack_depth=1, max_stack_depth = 1;
 	calc_code(expr, &len, &stack_depth, &max_stack_depth);

Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y	2004-06-24 07:26:16 UTC (rev 660)
+++ trunk/src/prothon.y	2004-06-25 02:12:32 UTC (rev 661)
@@ -371,8 +371,8 @@
 	|	mul_except except											{ $$ = append_list(yylex_param, $1, $2); }
 	;
 except:
-		EXCEPT_ expr compound_body									{ $$ = expr_label_body_to_except(yylex_param, NULL, $2, $3); }
-	|	EXCEPT_ LABEL '=' expr compound_body						{ $$ = expr_label_body_to_except(yylex_param,   $2, $4, $5); }
+		EXCEPT_ expr compound_body									{ $$ = expr_label_body_to_except(yylex_param, $2, NULL, $3); }
+	|	EXCEPT_ expr AS LABEL compound_body						    { $$ = expr_label_body_to_except(yylex_param, $2, $4, $5); }
 	;
 else_except:
 		/* empty string */											{ $$ = none(yylex_param); }