| 1606 | |
| 1607 | |
| 1608 | static void forstat (LexState *ls, int line) { |
| 1609 | /* forstat -> FOR (fornum | forlist) END */ |
| 1610 | FuncState *fs = ls->fs; |
| 1611 | TString *varname; |
| 1612 | BlockCnt bl; |
| 1613 | enterblock(fs, &bl, 1); /* scope for loop and control variables */ |
| 1614 | luaX_next(ls); /* skip 'for' */ |
| 1615 | varname = str_checkname(ls); /* first variable name */ |
| 1616 | switch (ls->t.token) { |
| 1617 | case '=': fornum(ls, varname, line); break; |
| 1618 | case ',': case TK_IN: forlist(ls, varname); break; |
| 1619 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); |
| 1620 | } |
| 1621 | check_match(ls, TK_END, TK_FOR, line); |
| 1622 | leaveblock(fs); /* loop scope ('break' jumps to this point) */ |
| 1623 | } |
| 1624 | |
| 1625 | |
| 1626 | static void test_then_block (LexState *ls, int *escapelist) { |
no test coverage detected