diff --git a/src/command/add.js b/src/command/add.js index ba77cbf..e6752c4 100644 --- a/src/command/add.js +++ b/src/command/add.js @@ -33,7 +33,7 @@ Juicescript.command_define({ let data_type = runner.data_type(add); if(data_type !== Juicescript.data_type.NUM && data_type !== Juicescript.data_type.STR){ // ignore with warning - runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type)); + runner.warning_argument(q, "expected data type NUM or STR, but got " + Juicescript.data_type.name(data_type)); continue; } diff --git a/src/command/div.js b/src/command/div.js index 0b69f28..1692228 100644 --- a/src/command/div.js +++ b/src/command/div.js @@ -33,7 +33,7 @@ Juicescript.command_define({ let data_type = runner.data_type(devide); if(data_type !== Juicescript.data_type.NUM){ // ignore with warning - runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type)); + runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(data_type)); continue; } diff --git a/src/command/jmp.js b/src/command/jmp.js index 2a12ab4..6341f53 100644 --- a/src/command/jmp.js +++ b/src/command/jmp.js @@ -16,6 +16,14 @@ Juicescript.command_define({ // flag name let flag = runner.argument_value(1); + // validate data type + let data_type = runner.data_type(flag); + if(data_type !== Juicescript.data_type.STR){ + // ignore with warning + runner.warning_argument(1, "expected data type STR, but got " + Juicescript.data_type.name(data_type)); + return; + } + // load this scope's flag list let flag_list = runner.scope_tree.flag; diff --git a/src/command/mul.js b/src/command/mul.js index e11f184..90767ad 100644 --- a/src/command/mul.js +++ b/src/command/mul.js @@ -35,7 +35,7 @@ Juicescript.command_define({ let factor_data_type = runner.data_type(factor); if(factor_data_type !== Juicescript.data_type.NUM){ // ignore with warning - runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(factor_data_type)); + runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(factor_data_type)); continue; } diff --git a/src/command/sub.js b/src/command/sub.js index 0d69c40..c6b12d6 100644 --- a/src/command/sub.js +++ b/src/command/sub.js @@ -33,7 +33,7 @@ Juicescript.command_define({ let data_type = runner.data_type(subtract); if(data_type !== Juicescript.data_type.NUM){ // ignore with warning - runner.warning_argument(q, "invalid data type " + Juicescript.data_type.name(data_type)); + runner.warning_argument(q, "expected data type NUM, but got " + Juicescript.data_type.name(data_type)); continue; }