From a0545048bdb675efb02c5af84d0a6845b35ae504 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 17 Jun 2023 04:00:07 +0800 Subject: [PATCH] ... --- c_bindings/test_answers.txt | 4 ++-- src/cffi.h | 2 +- src/compiler.h | 4 ++-- src/pocketpy.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c_bindings/test_answers.txt b/c_bindings/test_answers.txt index 1430abc7..2222ee03 100644 --- a/c_bindings/test_answers.txt +++ b/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' diff --git a/src/cffi.h b/src/cffi.h index bd942928..87c3f362 100644 --- a/src/cffi.h +++ b/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())); } } }; diff --git a/src/compiler.h b/src/compiler.h index 24a2b5a4..3861d898 100644 --- a/src/compiler.h +++ b/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) { diff --git a/src/pocketpy.h b/src/pocketpy.h index 82334bb8..f45c6d9e 100644 --- a/src/pocketpy.h +++ b/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); });