Browse Source

change Syntax to extern class (some TODOs left)

Simon Krajewski 11 years ago
parent
commit
8bc1d59b7d

+ 29 - 29
genpy.ml

@@ -1183,19 +1183,15 @@ module Printer = struct
 			| "super",_ ->
 			| "super",_ ->
 				let s_el = print_exprs pctx ", " el in
 				let s_el = print_exprs pctx ", " el in
 				Printf.sprintf "super().__init__(%s)" s_el
 				Printf.sprintf "super().__init__(%s)" s_el
-(* 			| "__python_kwargs__",[e1] ->
-				"**" ^ (print_expr pctx e1) *)
-			| "__python_varargs__",[e1] ->
-				"*" ^ (print_expr pctx e1)
-			| "__python__",[e1] ->
+			| "__feature__",_ ->
+				""
+			| "__define_feature__",[_;e1] ->
+				print_expr pctx e1
+			| ("__python__" | "python_Syntax.untypedPython"),[e1] ->
 				begin match e1.eexpr with
 				begin match e1.eexpr with
 					| TConst (TString s) -> s
 					| TConst (TString s) -> s
 					| e -> print_expr pctx e1
 					| e -> print_expr pctx e1
 				end
 				end
-(* 			| "__named_arg__",[{eexpr = TConst (TString name)};e2] ->
-				Printf.sprintf "%s=%s" name (print_expr pctx e2) *)
-			| "__feature__",_ ->
-				""
 			| "__named__",el ->
 			| "__named__",el ->
 				let res,fields = match List.rev el with
 				let res,fields = match List.rev el with
 					| {eexpr = TObjectDecl fields} :: el ->
 					| {eexpr = TObjectDecl fields} :: el ->
@@ -1211,45 +1207,49 @@ module Printer = struct
 					| [] ->
 					| [] ->
 						Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_params_named pctx ", " fields)
 						Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_params_named pctx ", " fields)
 				end
 				end
-			| "__define_feature__",[_;e1] ->
-				print_expr pctx e1
-			| "__call__" ,e1 :: el->
+			| "python_Syntax.varArgs",[e1] ->
+				"*" ^ (print_expr pctx e1)
+			| "python_Syntax.call" ,e1 :: [{eexpr = TArrayDecl el}]->
 				Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
 				Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
-			| "__field__",[e1;{eexpr = TConst(TString id)}] ->
+			| "python_Syntax.field",[e1;{eexpr = TConst(TString id)}] ->
 				Printf.sprintf "%s.%s" (print_expr pctx e1) id
 				Printf.sprintf "%s.%s" (print_expr pctx e1) id
-			| "__python_tuple__",el ->
+			| "python_Syntax.tuple", [{eexpr = TArrayDecl el}] ->
 				Printf.sprintf "(%s)" (print_exprs pctx ", " el)
 				Printf.sprintf "(%s)" (print_exprs pctx ", " el)
-			| "__python_array_get__",e1::tail ->
-				Printf.sprintf "%s[%s]" (print_expr pctx e1) (print_exprs pctx ":" tail)
+			| "python_Syntax._arrayAccess", e1 :: [{eexpr = TArrayDecl el}] ->
+				Printf.sprintf "%s[%s]" (print_expr pctx e1) (print_exprs pctx ":" el)
 			| "__python_array_access_leading_colon__", e1::tail ->
 			| "__python_array_access_leading_colon__", e1::tail ->
 				Printf.sprintf "%s[%s:]" (print_expr pctx e1) (print_exprs pctx ":" tail)
 				Printf.sprintf "%s[%s:]" (print_expr pctx e1) (print_exprs pctx ":" tail)
-			| "__python_in__",[e1;e2] ->
+			| "python_Syntax.isIn",[e1;e2] ->
 				Printf.sprintf "%s in %s" (print_expr pctx e1) (print_expr pctx e2)
 				Printf.sprintf "%s in %s" (print_expr pctx e1) (print_expr pctx e2)
 			| "__python_for__",[{eexpr = TBlock [{eexpr = TVar(v1,_)};e2;block]}] ->
 			| "__python_for__",[{eexpr = TBlock [{eexpr = TVar(v1,_)};e2;block]}] ->
 				let f1 = v1.v_name in
 				let f1 = v1.v_name in
 				let pctx = {pctx with pc_indent = "\t" ^ pctx.pc_indent} in
 				let pctx = {pctx with pc_indent = "\t" ^ pctx.pc_indent} in
 				let i = pctx.pc_indent in
 				let i = pctx.pc_indent in
 				Printf.sprintf "for %s in %s:\n%s%s" f1 (print_expr pctx e2) i (print_expr pctx block)
 				Printf.sprintf "for %s in %s:\n%s%s" f1 (print_expr pctx e2) i (print_expr pctx block)
-			| "__python_del__",[e1] ->
+			| "python_Syntax.delete",[e1] ->
 				Printf.sprintf "del %s" (print_expr pctx e1)
 				Printf.sprintf "del %s" (print_expr pctx e1)
-			| "__python_binop__",[e0;{eexpr = TConst(TString id)};e2] ->
+			| "python_Syntax.binop",[e0;{eexpr = TConst(TString id)};e2] ->
 				Printf.sprintf "(%s %s %s)" (print_expr pctx e0) id (print_expr pctx e2)
 				Printf.sprintf "(%s %s %s)" (print_expr pctx e0) id (print_expr pctx e2)
-			| "__python_assign__",[e0;e1] ->
+			| "python_Syntax.assign",[e0;e1] ->
 				Printf.sprintf "%s = %s" (print_expr pctx e0) (print_expr pctx e1)
 				Printf.sprintf "%s = %s" (print_expr pctx e0) (print_expr pctx e1)
-			| "__python_array_set__",[e1;e2;e3] ->
+			| "python_Syntax.arraySet",[e1;e2;e3] ->
 				Printf.sprintf "%s[%s] = %s" (print_expr pctx e1) (print_expr pctx e2) (print_expr pctx e3)
 				Printf.sprintf "%s[%s] = %s" (print_expr pctx e1) (print_expr pctx e2) (print_expr pctx e3)
+			| "python_Syntax._newInstance", e1 :: [{eexpr = TArrayDecl el}] ->
+				Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
+(* 			| "__new_named__",e1::el ->
+				Printf.sprintf "new %s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el) *)
+(* 			| "__python_kwargs__",[e1] ->
+				"**" ^ (print_expr pctx e1) *)
+(* 			| "__named_arg__",[{eexpr = TConst (TString name)};e2] ->
+				Printf.sprintf "%s=%s" name (print_expr pctx e2) *)
 (* 			| "__assert__",el ->
 (* 			| "__assert__",el ->
 				Printf.sprintf "assert(%s)" (print_exprs pctx ", " el) *)
 				Printf.sprintf "assert(%s)" (print_exprs pctx ", " el) *)
-			| "__new_named__",e1::el ->
-				Printf.sprintf "new %s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
-			| "__new__",e1::el ->
-				Printf.sprintf "%s(%s)" (print_expr pctx e1) (print_exprs pctx ", " el)
 (* 			| "__call_global__",{eexpr = TConst(TString s)} :: el ->
 (* 			| "__call_global__",{eexpr = TConst(TString s)} :: el ->
 				Printf.sprintf "%s(%s)" s (print_exprs pctx ", " el) *)
 				Printf.sprintf "%s(%s)" s (print_exprs pctx ", " el) *)
-			| "__is__",[e1;e2] ->
-				Printf.sprintf "%s is %s" (print_expr pctx e1) (print_expr pctx e2)
-			| "__as__",[e1;e2] ->
-				Printf.sprintf "%s as %s" (print_expr pctx e1) (print_expr pctx e2)
+(* 			| "__is__",[e1;e2] ->
+				Printf.sprintf "%s is %s" (print_expr pctx e1) (print_expr pctx e2) *)
+(* 			| "__as__",[e1;e2] ->
+				Printf.sprintf "%s as %s" (print_expr pctx e1) (print_expr pctx e2) *)
 (* 			| "__int_parse__",[e1] ->
 (* 			| "__int_parse__",[e1] ->
 				Printf.sprintf "int.parse(%s)" (print_expr pctx e1) *)
 				Printf.sprintf "int.parse(%s)" (print_expr pctx e1) *)
 (* 			| "__double_parse__",[e1] ->
 (* 			| "__double_parse__",[e1] ->

+ 3 - 3
std/haxe/io/Bytes.hx

@@ -46,7 +46,7 @@ class Bytes {
 		#elseif java
 		#elseif java
 		return untyped b[pos] & 0xFF;
 		return untyped b[pos] & 0xFF;
 		#elseif python
 		#elseif python
-		return untyped __python_array_get__(b, pos);
+		return python.Syntax.arrayAccess(b, pos);
 		#else
 		#else
 		return b[pos];
 		return b[pos];
 		#end
 		#end
@@ -66,7 +66,7 @@ class Bytes {
 		#elseif cs
 		#elseif cs
 		b[pos] = cast v;
 		b[pos] = cast v;
 		#elseif python
 		#elseif python
-		untyped __python_array_set__(b, pos, v & 0xFF);
+		python.Syntax.arraySet(b, pos, v & 0xFF);
 		#else
 		#else
 		b[pos] = v & 0xFF;
 		b[pos] = v & 0xFF;
 		#end
 		#end
@@ -144,7 +144,7 @@ class Bytes {
 		cs.system.Array.Copy(b, pos, newarr, 0, len);
 		cs.system.Array.Copy(b, pos, newarr, 0, len);
 		return new Bytes(len, newarr);
 		return new Bytes(len, newarr);
 		#elseif python
 		#elseif python
-		return new Bytes(len, untyped __python_array_get__(b, pos, pos+len) );
+		return new Bytes(len, python.Syntax.arrayAccess(b, pos, pos+len) );
 		#else
 		#else
 		return new Bytes(len,b.slice(pos,pos+len));
 		return new Bytes(len,b.slice(pos,pos+len));
 		#end
 		#end

+ 1 - 1
std/python/Boot.hx

@@ -16,7 +16,7 @@ private extern class Set <T>
 {
 {
 	public inline function has (v:T):Bool
 	public inline function has (v:T):Bool
 	{
 	{
-		return untyped __python_in__(v, this);
+		return python.Syntax.isIn(v, this);
 	}
 	}
 }
 }
 
 

+ 43 - 46
std/python/Syntax.hx

@@ -8,7 +8,9 @@ import haxe.macro.Context;
 import haxe.macro.ExprTools;
 import haxe.macro.ExprTools;
 #end
 #end
 
 
-class Syntax {
+using haxe.macro.Tools;
+
+extern class Syntax {
 
 
     #if macro
     #if macro
     static var self = macro python.Syntax;
     static var self = macro python.Syntax;
@@ -30,47 +32,38 @@ class Syntax {
         }:Void);
         }:Void);
     }
     }
 
 
-
-
-    @:noUsing macro public static function newInstance (c:Expr, params:Array<Expr>):haxe.macro.Expr
-    {
-        return macro ((untyped __new__)($a{[c].concat(params)}):Dynamic);
+    @:noUsing
+	macro public static function newInstance (c:Expr, params:Array<Expr>):haxe.macro.Expr {
+        return macro $self._newInstance($c, $a{params});
     }
     }
 
 
-    @:noUsing macro public static function isIn <T>(a:Expr, b:Expr):haxe.macro.Expr
-    {
-        return macro ((untyped __python_in__)($a, $b):Bool);
-    }
+	static function _newInstance(c:Dynamic, args:Array<Dynamic>):Dynamic { return null; }
 
 
-    @:noUsing macro public static function delete <T>(a:Expr):haxe.macro.Expr
-    {
-        return macro ((untyped __python_del__)($a):Void);
-    }
+    @:noUsing
+	public static function isIn(a:Dynamic, b:Dynamic):Bool { return false; }
 
 
-    @:noUsing macro public static function binop <T>(a:Expr, op:String, b:Expr):haxe.macro.Expr
-    {
-        return macro (((untyped __python_binop__)($a, $v{op}, $b)):Dynamic);
-    }
+    @:noUsing
+	public static function delete(a:Dynamic):Void { }
 
 
-    @:noUsing macro public static function assign <T>(a:Expr, b:Expr):haxe.macro.Expr
-    {
-        return macro ((untyped __python_assign__)($a, $b):Void);
-    }
+    @:noUsing
+	public static function binop(a:Dynamic, op:String, b:Dynamic):Dynamic { return null; }
 
 
+    @:noUsing
+	public static function assign(a:Dynamic, b:Dynamic):Void { }
 
 
     @:noUsing
     @:noUsing
-    #if (!macro) macro #end
-    public static function untypedPython <T>(b:String):haxe.macro.ExprOf<Dynamic>
-    {
-        return macro (untyped __python__)($v{b});
-    }
+    public static function untypedPython<T>(b:String):T { return null; };
 
 
-    @:noUsing macro public static function arrayAccess <T>(x:Expr, rest:Array<Expr>):haxe.macro.ExprOf<Dynamic>
-    {
-        return macro ((untyped __python_array_get__)($a{[x].concat(rest)}):Dynamic);
+    @:noUsing
+	macro public static function arrayAccess(x:Expr, rest:Array<Expr>):ExprOf<Dynamic> {
+		return macro $self._arrayAccess($x, $a{rest});
     }
     }
 
 
-    @:noUsing macro public static function arrayAccessWithLeadingColon <T>(x:Expr, rest:Array<Expr>):haxe.macro.ExprOf<Dynamic>
+	static function _arrayAccess(a:Dynamic, args:Array<Dynamic>):Dynamic { return null; }
+
+	static function arraySet(a:Dynamic, i:Dynamic, v:Dynamic):Dynamic { return null; }
+
+    @:noUsing macro public static function arrayAccessWithLeadingColon<T>(x:Expr, rest:Array<Expr>):haxe.macro.ExprOf<Dynamic>
     {
     {
         return macro ((untyped __python_array_access_leading_colon__)($a{[x].concat(rest)}):Dynamic);
         return macro ((untyped __python_array_access_leading_colon__)($a{[x].concat(rest)}):Dynamic);
     }
     }
@@ -82,8 +75,6 @@ class Syntax {
             case _ : Context.error("unexpected " + ExprTools.toString(v) + ": const ident expected", v.pos);
             case _ : Context.error("unexpected " + ExprTools.toString(v) + ": const ident expected", v.pos);
         }
         }
 
 
-
-
         var res = macro @:pos(it.pos) {
         var res = macro @:pos(it.pos) {
             var $id = $it.getNativeIterator().__next__();
             var $id = $it.getNativeIterator().__next__();
             $it;
             $it;
@@ -104,20 +95,28 @@ class Syntax {
         }:Void);
         }:Void);
     }
     }
 
 
-    @:noUsing macro public static function callField (o:Expr, field:ExprOf<String>, params:Array<Expr>):haxe.macro.Expr {
-
-        var field = python.Syntax.field(o, field);
-        var params = [field].concat(params);
-
-        return macro (untyped __call__)($a{params});
+    @:noUsing
+	macro public static function callField(o:Expr, field:ExprOf<String>, params:Array<Expr>):haxe.macro.Expr {
+        var e = macro $self.call($self.field($o, $field), $a{params});
+		e = macro untyped $e; // check "Dynamic should be Void" cases
+		return e;
     }
     }
 
 
+	static function call(e:Dynamic, args:Array<Dynamic>):Dynamic { return null; }
+
     @:noUsing
     @:noUsing
-    #if !macro macro #end
-    public static function field (o:Expr, field:ExprOf<String>):haxe.macro.Expr
-    {
-        return macro ((untyped __field__)($o, $field):Dynamic);
-    }
+    public static function field (o:Dynamic, field:String):Dynamic { return null; }
+
+	@:noUsing
+	macro public static function tuple(args:Array<Expr>):Dynamic {
+		var args = macro $a{args};
+		return macro $self._tuple($args);
+	}
+
+	static function _tuple(args:Array<Dynamic>):Dynamic { return null; }
+
+	@:noUsing
+	public static function varArgs(args:Array<Dynamic>):Dynamic { return null; }
 
 
     @:noUsing
     @:noUsing
     #if !macro macro #end
     #if !macro macro #end
@@ -150,6 +149,4 @@ class Syntax {
     {
     {
         return macro @:pos(e.pos) ((untyped __named__)($e, $args):Dynamic);
         return macro @:pos(e.pos) ((untyped __named__)($e, $args):Dynamic);
     }
     }
-
-
 }
 }

+ 1 - 1
std/python/_std/Reflect.hx

@@ -96,7 +96,7 @@ class Reflect {
 	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic
 	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic
 	{
 	{
 		var args:VarArgs = args;
 		var args:VarArgs = args;
-		return if (Builtin.callable(func)) func(untyped __python_varargs__(args)) else null;
+		return if (Builtin.callable(func)) func(python.Syntax.varArgs(args)) else null;
 	}
 	}
 
 
 	public static function fields( o : Dynamic ) : Array<String>
 	public static function fields( o : Dynamic ) : Array<String>

+ 4 - 4
std/python/lib/ArrayTools.hx

@@ -4,16 +4,16 @@ package python.lib;
 class ArrayTools {
 class ArrayTools {
 
 
 	public static inline function extend <T>(a:Array<T>, x:Array<T>):Void {
 	public static inline function extend <T>(a:Array<T>, x:Array<T>):Void {
-		untyped __field__(a, "extend")(x);
+		python.Syntax.field(a, "extend")(x);
 	}
 	}
 
 
 	public static inline function append <T>(a:Array<T>, x:T):Void {
 	public static inline function append <T>(a:Array<T>, x:T):Void {
-		untyped __field__(a, "append")(x);
+		python.Syntax.field(a, "append")(x);
 	}
 	}
 
 
-	public static inline function contains <T>(a:Array<T>, x:T):Bool 
+	public static inline function contains <T>(a:Array<T>, x:T):Bool
 	{
 	{
-		return untyped __python_in__(x,a);
+		return python.Syntax.isIn(x,a);
 	}
 	}
 
 
 }
 }

+ 2 - 2
std/python/lib/Builtin.hx

@@ -53,7 +53,7 @@ extern class Builtin {
 	public static function int(x:Dynamic):Int;
 	public static function int(x:Dynamic):Int;
 	//public static function ord():Void;
 	//public static function ord():Void;
 	public static inline function str(o:Dynamic):String {
 	public static inline function str(o:Dynamic):String {
-		return untyped __field__(Builtin, "str")(o);
+		return python.Syntax.field(Builtin, "str")(o);
 	}
 	}
 	//public static function eval():Void;
 	//public static function eval():Void;
 
 
@@ -63,7 +63,7 @@ extern class Builtin {
 	//public static function execfile():Void;
 	//public static function execfile():Void;
 
 
 	public static inline function print(o:Dynamic):Void {
 	public static inline function print(o:Dynamic):Void {
-		return untyped __field__(Builtin, "print")(o);
+		python.Syntax.field(Builtin, "print")(o);
 	}
 	}
 
 
 	//public static function super():Void;
 	//public static function super():Void;

+ 6 - 6
std/python/lib/Re.hx

@@ -54,12 +54,12 @@ private class RegexHelper {
 	{
 	{
 		if (endpos == null) {
 		if (endpos == null) {
 			if (pos == null) {
 			if (pos == null) {
-				return untyped __field__(r, "findall")(string);
+				return python.Syntax.field(r, "findall")(string);
 			} else {
 			} else {
-				return untyped __field__(r, "findall")(string, pos);
+				return python.Syntax.field(r, "findall")(string, pos);
 			}
 			}
 		} else {
 		} else {
-			return untyped __field__(r, "findall")(string, pos, endpos);
+			return python.Syntax.field(r, "findall")(string, pos, endpos);
 		}
 		}
 
 
 	}
 	}
@@ -142,18 +142,18 @@ extern class Re
 
 
 	public static inline function findallDynamic(pattern:Pattern, string:String,    flags:Int=0):Array<Dynamic>
 	public static inline function findallDynamic(pattern:Pattern, string:String,    flags:Int=0):Array<Dynamic>
 	{
 	{
-		return untyped __field__(pattern, "findall")(string, flags);
+		return python.Syntax.field(pattern, "findall")(string, flags);
 	}
 	}
 
 
 
 
 	public static inline function findallString(pattern:Pattern, string:String,    flags:Int=0):Array<String>
 	public static inline function findallString(pattern:Pattern, string:String,    flags:Int=0):Array<String>
 	{
 	{
-		return untyped __field__(pattern, "findall")(string, flags);
+		return python.Syntax.field(pattern, "findall")(string, flags);
 	}
 	}
 
 
 	public static inline function findallTuple(pattern:Pattern, string:String,    flags:Int=0):Array<Tuple<String>>
 	public static inline function findallTuple(pattern:Pattern, string:String,    flags:Int=0):Array<Tuple<String>>
 	{
 	{
-		return untyped __field__(pattern, "findall")(string, flags);
+		return python.Syntax.field(pattern, "findall")(string, flags);
 	}
 	}
 
 
 	public static inline function findallArray(pattern:Pattern, string:String,    flags:Int=0):Array<Array<String>>
 	public static inline function findallArray(pattern:Pattern, string:String,    flags:Int=0):Array<Array<String>>

+ 7 - 7
std/python/lib/StringTools.hx

@@ -6,27 +6,27 @@ import python.lib.Types.Tup3;
 
 
 class StringTools {
 class StringTools {
 
 
-	public static function format (s:String, args:Array<Dynamic>):String 
+	public static function format (s:String, args:Array<Dynamic>):String
 	{
 	{
-		return untyped __field__(s, "format")(untyped __python_varargs__(args));
+		return python.Syntax.field(s, "format")(python.Syntax.varArgs(args));
 	}
 	}
 
 
 	public static function encode(s:String, encoding:String="utf-8", errors:String="strict"):Bytes {
 	public static function encode(s:String, encoding:String="utf-8", errors:String="strict"):Bytes {
-		return untyped __field__(s, "encode")(encoding, errors);
+		return python.Syntax.field(s, "encode")(encoding, errors);
 	}
 	}
 
 
 	public static inline function contains(s:String, e:String):Bool {
 	public static inline function contains(s:String, e:String):Bool {
-		return untyped __python_in__(e,s);
+		return python.Syntax.isIn(e,s);
 	}
 	}
 
 
-	public static inline function strip(s:String, ?chars:String):String 
+	public static inline function strip(s:String, ?chars:String):String
 	{
 	{
-		return untyped __field__(s, "strip")(chars);
+		return python.Syntax.field(s, "strip")(chars);
 	}
 	}
 
 
 	public static inline function rpartition (s:String, sep:String):Tup3<String, String, String>
 	public static inline function rpartition (s:String, sep:String):Tup3<String, String, String>
 	{
 	{
-		return untyped __field__(s, "rpartition")(sep);	
+		return python.Syntax.field(s, "rpartition")(sep);
 	}
 	}
 
 
 }
 }

+ 24 - 24
std/python/lib/Types.hx

@@ -32,7 +32,7 @@ extern class ByteArray implements ArrayAccess<Int> {
 	}
 	}
 
 
 	public inline function get(i:Int):Int {
 	public inline function get(i:Int):Int {
-		return untyped __python_array_get__(this, i);
+		return python.Syntax.arrayAccess(this, i);
 	}
 	}
 
 
 	public function decode(encoding:String="utf-8", errors:String="strict"):String;
 	public function decode(encoding:String="utf-8", errors:String="strict"):String;
@@ -133,7 +133,7 @@ extern class Set <T>
 
 
 	public inline function has (v:T):Bool
 	public inline function has (v:T):Bool
 	{
 	{
-		return untyped __python_in__(v, this);
+		return python.Syntax.isIn(v, this);
 	}
 	}
 
 
 
 
@@ -233,15 +233,15 @@ class DictImpl {
 		return d;
 		return d;
 	}
 	}
 	public static inline function hasKey <X>(d:Dict<X, Dynamic>, key:X) {
 	public static inline function hasKey <X>(d:Dict<X, Dynamic>, key:X) {
-		return untyped __python_in__(key, d);
+		return python.Syntax.isIn(key, d);
 	}
 	}
 
 
 	public static inline function remove <X>(d:Dict<X, Dynamic>, key:X) {
 	public static inline function remove <X>(d:Dict<X, Dynamic>, key:X) {
-		untyped __python_del__(untyped __python_array_get__(d, key));
+		python.Syntax.delete(python.Syntax.arrayAccess(d, key));
 	}
 	}
 
 
 	public static inline function set <K,V>(d:Dict<K, V>, key:K, val:V) {
 	public static inline function set <K,V>(d:Dict<K, V>, key:K, val:V) {
-		untyped __python_array_set__(d, key, val);
+		python.Syntax.arraySet(d, key, val);
 	}
 	}
 }
 }
 
 
@@ -266,7 +266,7 @@ extern class Tuple<X> implements ArrayAccess<X> {
 	}
 	}
 
 
 	public inline function at (i:Int):X {
 	public inline function at (i:Int):X {
-		return untyped __python_array_get__(this, i);
+		return python.Syntax.arrayAccess(this, i);
 	}
 	}
 
 
 	public inline function toArray ():Array<X>
 	public inline function toArray ():Array<X>
@@ -278,50 +278,50 @@ extern class Tuple<X> implements ArrayAccess<X> {
 
 
 extern class Tup2 <A,B> extends Tuple<Dynamic>
 extern class Tup2 <A,B> extends Tuple<Dynamic>
 {
 {
-	public static inline function create <A,B>(a:A, b:B):Tup2<A,B> return untyped __python_tuple__(a,b);
+	public static inline function create <A,B>(a:A, b:B):Tup2<A,B> return python.Syntax.tuple(a,b);
 	public var _1(get, null):A;
 	public var _1(get, null):A;
-	public inline function get__1():A return untyped __python_array_get__(this, 0);
+	public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
 	public var _2(get, null):B;
 	public var _2(get, null):B;
-	public inline function get__2():B return untyped __python_array_get__(this, 1);
+	public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
 }
 }
 
 
 extern class Tup3 <A,B,C> extends Tuple<Dynamic>
 extern class Tup3 <A,B,C> extends Tuple<Dynamic>
 {
 {
-	public static inline function create <A,B,C>(a:A, b:B,c:C):Tup3<A,B,C> return untyped __python_tuple__(a,b,c);
+	public static inline function create <A,B,C>(a:A, b:B,c:C):Tup3<A,B,C> return python.Syntax.tuple(a,b,c);
 	public var _1(get, null):A;
 	public var _1(get, null):A;
-	public inline function get__1():A return untyped __python_array_get__(this, 0);
+	public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
 	public var _2(get, null):B;
 	public var _2(get, null):B;
-	public inline function get__2():B return untyped __python_array_get__(this, 1);
+	public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
 	public var _3(get, null):C;
 	public var _3(get, null):C;
-	public inline function get__3():C return untyped __python_array_get__(this, 2);
+	public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
 }
 }
 
 
 extern class Tup4 <A,B,C,D> extends Tuple<Dynamic>
 extern class Tup4 <A,B,C,D> extends Tuple<Dynamic>
 {
 {
-	public static inline function create <A,B,C,D>(a:A, b:B,c:C,d:D):Tup4<A,B,C,D> return untyped __python_tuple__(a,b,c,d);
+	public static inline function create <A,B,C,D>(a:A, b:B,c:C,d:D):Tup4<A,B,C,D> return python.Syntax.tuple(a,b,c,d);
 	public var _1(get, null):A;
 	public var _1(get, null):A;
-	public inline function get__1():A return untyped __python_array_get__(this, 0);
+	public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
 	public var _2(get, null):B;
 	public var _2(get, null):B;
-	public inline function get__2():B return untyped __python_array_get__(this, 1);
+	public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
 	public var _3(get, null):C;
 	public var _3(get, null):C;
-	public inline function get__3():C return untyped __python_array_get__(this, 2);
+	public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
 	public var _4(get, null):D;
 	public var _4(get, null):D;
-	public inline function get__4():D return untyped __python_array_get__(this, 3);
+	public inline function get__4():D return python.Syntax.arrayAccess(this, 3);
 }
 }
 
 
 extern class Tup5 <A,B,C,D,E> extends Tuple<Dynamic>
 extern class Tup5 <A,B,C,D,E> extends Tuple<Dynamic>
 {
 {
-	public static inline function create <A,B,C,D,E>(a:A, b:B,c:C,d:D,e:E):Tup5<A,B,C,D,E> return untyped __python_tuple__(a,b,c,d,e);
+	public static inline function create <A,B,C,D,E>(a:A, b:B,c:C,d:D,e:E):Tup5<A,B,C,D,E> return python.Syntax.tuple(a,b,c,d,e);
 	public var _1(get, null):A;
 	public var _1(get, null):A;
-	public inline function get__1():A return untyped __python_array_get__(this, 0);
+	public inline function get__1():A return python.Syntax.arrayAccess(this, 0);
 	public var _2(get, null):B;
 	public var _2(get, null):B;
-	public inline function get__2():B return untyped __python_array_get__(this, 1);
+	public inline function get__2():B return python.Syntax.arrayAccess(this, 1);
 	public var _3(get, null):C;
 	public var _3(get, null):C;
-	public inline function get__3():C return untyped __python_array_get__(this, 2);
+	public inline function get__3():C return python.Syntax.arrayAccess(this, 2);
 	public var _4(get, null):D;
 	public var _4(get, null):D;
-	public inline function get__4():D return untyped __python_array_get__(this, 3);
+	public inline function get__4():D return python.Syntax.arrayAccess(this, 3);
 	public var _5(get, null):E;
 	public var _5(get, null):E;
-	public inline function get__5():E return untyped __python_array_get__(this, 4);
+	public inline function get__5():E return python.Syntax.arrayAccess(this, 4);
 }
 }