mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
up
This commit is contained in:
parent
20b608fe7e
commit
1b0f29781c
@ -757,12 +757,13 @@ __LISTCOMP:
|
|||||||
consumeEndStatement();
|
consumeEndStatement();
|
||||||
} else if(match(TK("label"))){
|
} else if(match(TK("label"))){
|
||||||
if(mode() != EXEC_MODE) syntaxError("'label' is only available in EXEC_MODE");
|
if(mode() != EXEC_MODE) syntaxError("'label' is only available in EXEC_MODE");
|
||||||
consume(TK("@id"));
|
consume(TK(".")); consume(TK("@id"));
|
||||||
getCode()->addLabel(parser->previous.str());
|
getCode()->addLabel(parser->previous.str());
|
||||||
consumeEndStatement();
|
consumeEndStatement();
|
||||||
} else if(match(TK("goto"))){
|
} else if(match(TK("goto"))){
|
||||||
|
// https://entrian.com/goto/
|
||||||
if(mode() != EXEC_MODE) syntaxError("'goto' is only available in EXEC_MODE");
|
if(mode() != EXEC_MODE) syntaxError("'goto' is only available in EXEC_MODE");
|
||||||
consume(TK("@id"));
|
consume(TK(".")); consume(TK("@id"));
|
||||||
emitCode(OP_LOAD_CONST, getCode()->addConst(vm->PyStr(parser->previous.str())));
|
emitCode(OP_LOAD_CONST, getCode()->addConst(vm->PyStr(parser->previous.str())));
|
||||||
emitCode(OP_GOTO);
|
emitCode(OP_GOTO);
|
||||||
consumeEndStatement();
|
consumeEndStatement();
|
||||||
|
7
tests/4.py
Normal file
7
tests/4.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
for i in range(100):
|
||||||
|
for j in range(100):
|
||||||
|
print(i, j)
|
||||||
|
goto .end
|
||||||
|
|
||||||
|
label .end
|
||||||
|
print("END")
|
Loading…
x
Reference in New Issue
Block a user