blueloveTH 2 лет назад
Родитель
Сommit
7916bb035f
3 измененных файлов с 17 добавлено и 13 удалено
  1. 6 6
      include/pocketpy/common.h
  2. 7 7
      include/pocketpy/lexer.h
  3. 4 0
      include/typings/linalg.pyi

+ 6 - 6
include/pocketpy/common.h

@@ -119,12 +119,12 @@ union BitsCvtImpl<4>{
 	BitsCvtImpl(NumberTraits<4>::float_t val): _float(val) {}
 	BitsCvtImpl(NumberTraits<4>::int_t val): _int(val) {}
 
-	void print(){
-		std::string s = std::bitset<32>(_int).to_string();
-		std::cout << s.substr(0, 1) << '|';
-		std::cout << s.substr(1, 8) << '|';
-		std::cout << s.substr(9) << std::endl;
-	}
+	// void print(){
+	// 	std::string s = std::bitset<32>(_int).to_string();
+	// 	std::cout << s.substr(0, 1) << '|';
+	// 	std::cout << s.substr(1, 8) << '|';
+	// 	std::cout << s.substr(9) << std::endl;
+	// }
 };
 
 template<>

+ 7 - 7
include/pocketpy/lexer.h

@@ -59,13 +59,13 @@ struct Token{
   Str str() const { return Str(start, length);}
   std::string_view sv() const { return std::string_view(start, length);}
 
-  Str info() const {
-    SStream ss;
-    ss << line << ": " << TK_STR(type) << " '" << (
-        sv()=="\n" ? "\\n" : sv()
-    ) << "'";
-    return ss.str();
-  }
+  // Str info() const {
+  //   SStream ss;
+  //   ss << line << ": " << TK_STR(type) << " '" << (
+  //       sv()=="\n" ? "\\n" : sv()
+  //   ) << "'";
+  //   return ss.str();
+  // }
 };
 
 // https://docs.python.org/3/reference/expressions.html#operator-precedence

+ 4 - 0
include/typings/linalg.pyi

@@ -9,6 +9,7 @@ class vec2(_StructLike['vec2']):
     def __add__(self, other: vec2) -> vec2: ...
     def __sub__(self, other: vec2) -> vec2: ...
     def __mul__(self, other: float) -> vec2: ...
+    def __rmul__(self, other: float) -> vec2: ...
     def __truediv__(self, other: float) -> vec2: ...
     def dot(self, other: vec2) -> float: ...
     def cross(self, other: vec2) -> float: ...
@@ -27,6 +28,7 @@ class vec3(_StructLike['vec3']):
     def __add__(self, other: vec3) -> vec3: ...
     def __sub__(self, other: vec3) -> vec3: ...
     def __mul__(self, other: float) -> vec3: ...
+    def __rmul__(self, other: float) -> vec3: ...
     def __truediv__(self, other: float) -> vec3: ...
     def dot(self, other: vec3) -> float: ...
     def cross(self, other: vec3) -> float: ...
@@ -44,6 +46,7 @@ class vec4(_StructLike['vec4']):
     def __add__(self, other: vec4) -> vec4: ...
     def __sub__(self, other: vec4) -> vec4: ...
     def __mul__(self, other: float) -> vec4: ...
+    def __rmul__(self, other: float) -> vec4: ...
     def __truediv__(self, other: float) -> vec4: ...
     def dot(self, other: vec4) -> float: ...
     def length(self) -> float: ...
@@ -80,6 +83,7 @@ class mat3x3(_StructLike['mat3x3']):
     def __add__(self, other: mat3x3) -> mat3x3: ...
     def __sub__(self, other: mat3x3) -> mat3x3: ...
     def __mul__(self, other: float) -> mat3x3: ...
+    def __rmul__(self, other: float) -> mat3x3: ...
     def __truediv__(self, other: float) -> mat3x3: ...
 
     def __invert__(self) -> mat3x3: ...