MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / ForStatement

Method ForStatement

LuaParser/src/Parse/LuaParser.cpp:275–301  ·  view source on GitHub ↗

forstat -> FOR (fornum | forlist) END */

Source from the content-addressed store, hash-verified

273
274/* forstat -> FOR (fornum | forlist) END */
275void LuaParser::ForStatement() {
276 // forstatement 只有一个 for 的token 节点 加上 forNumber或者forList 节点
277 auto m = Mark();
278
279 CheckAndNext(TK_FOR);
280
281 Check(TK_NAME);
282
283 switch (LookAhead()) {
284 case '=': {
285 ForNumber();
286 break;
287 }
288 case ',':
289 case TK_IN: {
290 ForList();
291 break;
292 }
293 default: {
294 LuaExpectedError("'=' or 'in' expected");
295 }
296 }
297
298 TestAndNext(';');
299
300 m.Complete(*this, LuaSyntaxNodeKind::ForStatement);
301}
302
303void LuaParser::ForNumber() {
304 auto m = Mark();

Callers

nothing calls this directly

Calls 2

CheckFunction · 0.85
CompleteMethod · 0.80

Tested by

no test coverage detected