blueloveTH 2 лет назад
Родитель
Сommit
a0545048bd
4 измененных файлов с 6 добавлено и 6 удалено
  1. 2 2
      c_bindings/test_answers.txt
  2. 1 1
      src/cffi.h
  3. 2 2
      src/compiler.h
  4. 1 1
      src/pocketpy.h

+ 2 - 2
c_bindings/test_answers.txt

@@ -45,7 +45,7 @@ retmany_x : 1
 retmany_x : 2
 retmany_x : 3
 successfully errored with this message: 
-TypeError: expected 2 positional arguments, but got 0 (x)
+TypeError: expected 2 positional arguments, got 0 (x)
 ['hello']
 
 testing pushing functions
@@ -74,4 +74,4 @@ pi: 3.14
 pi: 3.14
 2
 successfully errored with this message: 
-TypeError: expected 'int', but got 'float'
+TypeError: expected 'int', got 'float'

+ 1 - 1
src/cffi.h

@@ -376,7 +376,7 @@ struct NativeProxyFuncCBase {
 
     static void check_args_size(VM* vm, ArgsView args, int n){
         if (args.size() != n){
-            vm->TypeError("expected " + std::to_string(n) + " arguments, but got " + std::to_string(args.size()));
+            vm->TypeError("expected " + std::to_string(n) + " arguments, got " + std::to_string(args.size()));
         }
     }
 };

+ 2 - 2
src/compiler.h

@@ -135,7 +135,7 @@ class Compiler {
     void consume(TokenIndex expected) {
         if (!match(expected)){
             SyntaxError(
-                fmt("expected '", TK_STR(expected), "', but got '", TK_STR(curr().type), "'")
+                fmt("expected '", TK_STR(expected), "', got '", TK_STR(curr().type), "'")
             );
         }
     }
@@ -577,7 +577,7 @@ __SUBSCR_END:
 
     void parse_expression(int precedence, bool push_stack=true) {
         PrattCallback prefix = rules[curr().type].prefix;
-        if (prefix == nullptr) SyntaxError(Str("expected an expression, but got ") + TK_STR(curr().type));
+        if (prefix == nullptr) SyntaxError(Str("expected an expression, got ") + TK_STR(curr().type));
         advance();
         (this->*prefix)();
         while (rules[curr().type].precedence >= precedence) {

+ 1 - 1
src/pocketpy.h

@@ -277,7 +277,7 @@ inline void init_builtins(VM* _vm) {
             case 1: r.stop = CAST(i64, args[0]); break;
             case 2: r.start = CAST(i64, args[0]); r.stop = CAST(i64, args[1]); break;
             case 3: r.start = CAST(i64, args[0]); r.stop = CAST(i64, args[1]); r.step = CAST(i64, args[2]); break;
-            default: vm->TypeError("expected 1-3 arguments, but got " + std::to_string(args.size()));
+            default: vm->TypeError("expected 1-3 arguments, got " + std::to_string(args.size()));
         }
         return VAR(r);
     });