This commit is contained in:
blueloveTH 2023-01-28 01:59:28 +08:00
parent 4a3176ba74
commit b2a64c47b8
2 changed files with 5 additions and 5 deletions

View File

@ -253,9 +253,7 @@ public:
if(code->co_blocks[i].type == FOR_LOOP) pop();
i = code->co_blocks[i].parent;
}
if(i!=next.block) throw std::runtime_error(
"invalid jump from " + code->co_blocks[prev.block].to_string() + " to " + code->co_blocks[next.block].to_string()
);
if(i!=next.block) throw std::runtime_error("invalid jump");
}
}

View File

@ -22,6 +22,7 @@ public:
}
InputResult input(std::string line){
CompileMode mode = SINGLE_MODE;
if(need_more_lines){
buffer += line;
buffer += '\n';
@ -33,6 +34,7 @@ public:
need_more_lines = 0;
line = buffer;
buffer.clear();
mode = EXEC_MODE;
}else{
__NOT_ENOUGH_LINES:
return NEED_MORE_LINES;
@ -42,7 +44,7 @@ __NOT_ENOUGH_LINES:
}
try{
vm->compile(line, "<stdin>", SINGLE_MODE);
vm->compile(line, "<stdin>", mode);
}catch(NeedMoreLines& ne){
buffer += line;
buffer += '\n';
@ -51,7 +53,7 @@ __NOT_ENOUGH_LINES:
}catch(...){
// do nothing
}
vm->exec(line, "<stdin>", SINGLE_MODE);
vm->exec(line, "<stdin>", mode);
return EXEC_STARTED;
}
};