rev 422 - in trunk: pr src

SVN User <[email protected]> Tue, 27 Apr 2004 13:56:39 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-04-27 13:56:36 -0400 (Tue, 27 Apr 2004)
New Revision: 422

Modified:
   trunk/pr/int.pr
   trunk/pr/meow.pr
   trunk/pr/modint.pr
   trunk/pr/oops.pr
   trunk/pr/scope.pr
   trunk/pr/super.pr
   trunk/src/parser.h
   trunk/src/parser_routines.c
   trunk/src/prothon.y
Log:
Changed .var to $var and obj^func() to obj$func()

Modified: trunk/pr/int.pr
===================================================================
--- trunk/pr/int.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/int.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -8,8 +8,8 @@
 
 INT=Int()
 with INT:
-	def .__add__(other):
-		print ., "+", other
+	def $__add__(other):
+		print $, "+", other
 		i = ^__add__(other) % 16
 		i.setProto(INT)
 		return i

Modified: trunk/pr/meow.pr
===================================================================
--- trunk/pr/meow.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/meow.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -2,28 +2,28 @@
 
 Animal = Object()
 with Animal:
-   def .describe():
+   def $describe():
        print "I am an animal."
-       .make_noise()
-   def .make_noise():
+       $make_noise()
+   def $make_noise():
      print "I make animal noise."
    
 Mammal = Animal()
 with Mammal:
-   def .describe():
+   def $describe():
           print "I am a mammal."
-          Animal^describe()			# directed super call
-          .make_noise()
-   def .make_noise():
+          Animal$describe()			# directed super call
+          $make_noise()
+   def $make_noise():
      print "I make mammal noise."
    
 Cat = Mammal()
 with Cat:
-     def .describe():
+     def $describe():
           print "I am a cat."
           ^describe()				# non-directed super call
-          .make_noise()
-     def .make_noise():
+          $make_noise()
+     def $make_noise():
        print "meow"
 
 c = Cat()

Modified: trunk/pr/modint.pr
===================================================================
--- trunk/pr/modint.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/modint.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -2,15 +2,15 @@
 
 ModInt = Object()
 with ModInt:
-    .modulo = 10 #default
-    def .__init__(*x):
-        if Len(x): .val = x[0]      # val kludge here
-    def .__add__(other):
-        if .modulo != other.modulo:
+    $modulo = 10 #default
+    def $__init__(*x):
+        if Len(x): $val = x[0]      # val kludge here
+    def $__add__(other):
+        if $modulo != other.modulo:
             raise TypeError
-        return Mod16Int((.val + other.val) % .modulo)
-    def .__str__():
-        return .val.__str__()
+        return Mod16Int(($val + other.val) % $modulo)
+    def $__str__():
+        return $val.__str__()
         
 Mod16Int = ModInt() 
 Mod16Int.modulo = 16    

Modified: trunk/pr/oops.pr
===================================================================
--- trunk/pr/oops.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/oops.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -4,15 +4,15 @@
 
 with Emp_proto:
 
-	.name = "<proto name>"
+	$name = "<proto name>"
 	
-	def .__init__(name):
-		.name = name
-		.hello()
-		return .
+	def $__init__(name):
+		$name = name
+		$hello()
+		return $
 
-	def .hello():
-		print "My name is:", .name	
+	def $hello():
+		print "My name is:", $name	
 			
 
 Emp_proto.hello()

Modified: trunk/pr/scope.pr
===================================================================
--- trunk/pr/scope.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/scope.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -9,7 +9,7 @@
 	x=2
 	def @f2():
 		x=3
-		print X, &x, x, .x, @x
+		print X, &x, x, $x, @x
 f1()
 obj = Object()
 obj.x = 4

Modified: trunk/pr/super.pr
===================================================================
--- trunk/pr/super.pr	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/pr/super.pr	2004-04-27 17:56:36 UTC (rev 422)
@@ -5,7 +5,7 @@
 proto.x = 2
 obj.x   = 1
 with obj:
-	print .x   # prints 1
+	print $x   # prints 1
 	print ^x   # prints 2
 
 print '\nabove should say...'

Modified: trunk/src/parser.h
===================================================================
--- trunk/src/parser.h	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/src/parser.h	2004-04-27 17:56:36 UTC (rev 422)
@@ -154,8 +154,8 @@
 code_p cond_exc_to_assert(void* param, code_p cond, code_p exc);
 code_p continue_stmt(void* param, char* label);
 code_p del_ref(void* param, code_p expr);
-code_p dot_label_to_attrref(void* param, char* label);
-code_p dot_to_obj(void* param);
+code_p ds_label_to_attrref(void* param, char* label);
+code_p ds_to_obj(void* param);
 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);
@@ -187,7 +187,7 @@
 code_p return_expr(void* param, code_p expr);
 code_p self_func_params(void* param, code_p attr_ref, clist_p parms);
 code_p unbound_func_params(void* param, code_p attr_ref, clist_p parms);
-code_p obj_super_label_func_params(void* param, code_p attr_ref, char* label, clist_p parms);
+code_p obj_ds_label_func_params(void* param, code_p attr_ref, char* label, clist_p parms);
 code_p sparms_to_slice(void* param, code_p p1, code_p p2, code_p p3, int parm_cnt);
 code_p stack_check(void* param, code_p stmt);
 code_p star_ref_to_formparm(void* param, char* label);

Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/src/parser_routines.c	2004-04-27 17:56:36 UTC (rev 422)
@@ -359,7 +359,7 @@
 	p->code_data[1].data = sym(INTRP, label);
 	return debug_retrn(__LINE__, p);
 }
-code_p dot_label_to_attrref(void* param, char* label){
+code_p ds_label_to_attrref(void* param, char* label){
 	code_p p;
 	p = new_code(param, 2, 2, 2, OP_PUSH_SELF_REF);
 	p->code_data[1].data = sym(INTRP, label);
@@ -454,7 +454,7 @@
 	assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
-code_p obj_super_label_func_params(void* param, code_p obj, char* label,  clist_p parms) {
+code_p obj_ds_label_func_params(void* param, code_p obj, char* label,  clist_p parms) {
 	code_p res;
 	int i, k=0;
 	int len = obj->len+2;
@@ -1370,7 +1370,7 @@
 	add_to_const_list(param, obj);
 	return debug_retrn(__LINE__, p);
 }
-code_p dot_to_obj(void* param){
+code_p ds_to_obj(void* param){
 	code_p p = new_code(param, 1, 1, 1, OP_PUSH_SELF);
 	return debug_retrn(__LINE__, p);
 }

Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y	2004-04-27 17:18:01 UTC (rev 421)
+++ trunk/src/prothon.y	2004-04-27 17:56:36 UTC (rev 422)
@@ -172,6 +172,7 @@
 %nonassoc '~'	   
 %right	  EXP	 
 %left	  '.'	   
+%left	  '$'	   
 %left	  ':'	   
 %nonassoc ELIPS	 
 %nonassoc UDOT
@@ -376,7 +377,7 @@
 	;
 def_ref:
 		DEF_ LABEL													{ $$ = label_to_attrref(yylex_param, $2);		state->defdoc_flag=1; }
-	|	DEF_ '.' LABEL								%prec UDOT		{ $$ = dot_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
+	|	DEF_ '$' LABEL								%prec UDOT		{ $$ = ds_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	DEF_ '^' LABEL								%prec UCARET	{ $$ = caret_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	DEF_ '&' LABEL								%prec UAMP		{ $$ = amp_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	DEF_ '@' LABEL												{ $$ = at_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
@@ -384,7 +385,7 @@
 	;										
 gen_ref:
 		GEN LABEL													{ $$ = label_to_attrref(yylex_param, $2);		state->defdoc_flag=1; }
-	|	GEN '.' LABEL								%prec UDOT		{ $$ = dot_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
+	|	GEN '$' LABEL								%prec UDOT		{ $$ = ds_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	GEN '^' LABEL								%prec UCARET	{ $$ = caret_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	GEN '&' LABEL								%prec UAMP		{ $$ = amp_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
 	|	GEN '@' LABEL												{ $$ = at_label_to_attrref(yylex_param, $3);	state->defdoc_flag=1; }
@@ -529,7 +530,7 @@
 	|	obj
 	;
 obj:
-		'.'															{ $$ = dot_to_obj(yylex_param); }
+		'$'															{ $$ = ds_to_obj(yylex_param); }
 	|	target_param												{ $$ = tgtparm_to_obj(yylex_param, $1); }
 	|	INT_														{ $$ = int_to_obj(yylex_param, $1); }
 	|	LONG_														{ $$ = string_to_obj(yylex_param, $1, NEW_LONG); }
@@ -544,7 +545,7 @@
 	|	obj '(' function_params ')'  								{ $$ = obj_func_params(yylex_param, $1, $3); }
 	| 	attr_ref '(' function_params ')'  							{ $$ = self_func_params(yylex_param, $1, $3); }
 	| 	unbound_ref '(' function_params ')'  						{ $$ = unbound_func_params(yylex_param, $1, $3); }
-	| 	obj '^' LABEL '(' function_params ')'  						{ $$ = obj_super_label_func_params(yylex_param, $1, $3, $5); }
+	| 	obj '$' LABEL '(' function_params ')'  						{ $$ = obj_ds_label_func_params(yylex_param, $1, $3, $5); }
 	;
 target:
 		target_params
@@ -563,7 +564,7 @@
 	|	obj '[' slice ']'											{ $$ = append_code(yylex_param, $1, $3, 0); }
 	;
 attr_ref:
-		'.' LABEL								%prec UDOT			{ $$ = dot_label_to_attrref(yylex_param, $2); }
+		'$' LABEL								%prec UDOT			{ $$ = ds_label_to_attrref(yylex_param, $2); }
 	|	'^' LABEL								%prec UCARET		{ $$ = caret_label_to_attrref(yylex_param, $2); }
 	|	obj '.' LABEL												{ $$ = obj_label_to_attrref(yylex_param, $1, $3); }
 	;