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