Selaa lähdekoodia

treat True and False as keywords (closes #https://github.com/frabbit/hx2python/issues/20)

Simon Krajewski 11 vuotta sitten
vanhempi
commit
70d3042f61
3 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 1 1
      genpy.ml
  2. 1 1
      std/python/Boot.hx
  3. 2 1
      tests/unit/TestPython.hx

+ 1 - 1
genpy.ml

@@ -49,7 +49,7 @@ module KeywordHandler = struct
 		List.iter (fun s -> Hashtbl.add h s ()) [
 			"and"; "as"; "assert"; "break"; "class"; "continue"; "def"; "del"; "elif"; "else"; "except"; "exec"; "finally"; "for";
 			"from"; "global"; "if"; "import"; "in"; "is"; "lambda"; "not"; "or"; "pass"; "print";" raise"; "return"; "try"; "while";
-			"with"; "yield"; "float"; "None"; "list"
+			"with"; "yield"; "float"; "None"; "list"; "True"; "False"
 			;"__b" (* TODO: hack to deal with haxe.Utf8 error *)
 		];
 		h

+ 1 - 1
std/python/Boot.hx

@@ -57,7 +57,7 @@ import math as _hx_math
 		"class",	 "exec",	  "in",		"raise",
 		"continue",  "finally",   "is",		"return",
 		"def",	   "for",	   "lambda",	"try",
-		"None",	  "list"
+		"None",	  "list", "True", "False"
 	]);
 
 	static function arrayJoin <T>(x:Array<T>, sep:String):String {

+ 2 - 1
tests/unit/TestPython.hx

@@ -10,7 +10,8 @@ private typedef T = {
 
 private enum MyEnum {
 	A(?x:Int, b:String);
-	B;
+	True;
+	False;
 }
 
 class TestPython extends Test {