mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-24 13:30:18 +00:00
up
This commit is contained in:
parent
4a3176ba74
commit
b2a64c47b8
@ -253,9 +253,7 @@ public:
|
|||||||
if(code->co_blocks[i].type == FOR_LOOP) pop();
|
if(code->co_blocks[i].type == FOR_LOOP) pop();
|
||||||
i = code->co_blocks[i].parent;
|
i = code->co_blocks[i].parent;
|
||||||
}
|
}
|
||||||
if(i!=next.block) throw std::runtime_error(
|
if(i!=next.block) throw std::runtime_error("invalid jump");
|
||||||
"invalid jump from " + code->co_blocks[prev.block].to_string() + " to " + code->co_blocks[next.block].to_string()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputResult input(std::string line){
|
InputResult input(std::string line){
|
||||||
|
CompileMode mode = SINGLE_MODE;
|
||||||
if(need_more_lines){
|
if(need_more_lines){
|
||||||
buffer += line;
|
buffer += line;
|
||||||
buffer += '\n';
|
buffer += '\n';
|
||||||
@ -33,6 +34,7 @@ public:
|
|||||||
need_more_lines = 0;
|
need_more_lines = 0;
|
||||||
line = buffer;
|
line = buffer;
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
|
mode = EXEC_MODE;
|
||||||
}else{
|
}else{
|
||||||
__NOT_ENOUGH_LINES:
|
__NOT_ENOUGH_LINES:
|
||||||
return NEED_MORE_LINES;
|
return NEED_MORE_LINES;
|
||||||
@ -42,7 +44,7 @@ __NOT_ENOUGH_LINES:
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
vm->compile(line, "<stdin>", SINGLE_MODE);
|
vm->compile(line, "<stdin>", mode);
|
||||||
}catch(NeedMoreLines& ne){
|
}catch(NeedMoreLines& ne){
|
||||||
buffer += line;
|
buffer += line;
|
||||||
buffer += '\n';
|
buffer += '\n';
|
||||||
@ -51,7 +53,7 @@ __NOT_ENOUGH_LINES:
|
|||||||
}catch(...){
|
}catch(...){
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
vm->exec(line, "<stdin>", SINGLE_MODE);
|
vm->exec(line, "<stdin>", mode);
|
||||||
return EXEC_STARTED;
|
return EXEC_STARTED;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user