MCPcopy Create free account
hub / github.com/Koihik/LuaFormatter / visitForStat

Method visitForStat

src/FormatVisitor.cpp:541–568  ·  view source on GitHub ↗

FOR NAME EQL exp COMMA exp (COMMA exp)? DO block END;

Source from the content-addressed store, hash-verified

539
540// FOR NAME EQL exp COMMA exp (COMMA exp)? DO block END;
541antlrcpp::Any FormatVisitor::visitForStat(LuaParser::ForStatContext* ctx) {
542 LOG_FUNCTION_BEGIN();
543 cur_writer() << ctx->FOR()->getText();
544 cur_writer() << commentAfter(ctx->FOR(), " ");
545 cur_writer() << ctx->NAME()->getText();
546 cur_writer() << commentAfter(ctx->NAME(), " ");
547 cur_writer() << ctx->EQL()->getText();
548 cur_writer() << commentAfter(ctx->EQL(), " ");
549 visitExp(ctx->exp()[0]);
550 cur_writer() << commentAfter(ctx->exp()[0], "");
551 cur_writer() << ctx->COMMA()[0]->getText();
552 cur_writer() << commentAfter(ctx->COMMA()[0], " ");
553 visitExp(ctx->exp()[1]);
554 if (ctx->COMMA().size() > 1) {
555 cur_writer() << commentAfter(ctx->exp()[1], "");
556 cur_writer() << ctx->COMMA()[1]->getText();
557 cur_writer() << commentAfter(ctx->COMMA()[1], " ");
558 visitExp(ctx->exp()[2]);
559 cur_writer() << commentAfter(ctx->exp()[2], " ");
560 } else {
561 cur_writer() << commentAfter(ctx->exp()[1], " ");
562 }
563 cur_writer() << ctx->DO()->getText();
564 visitBlockAndComment(ctx->DO(), ctx->block(), CONTROL_BLOCK);
565 cur_writer() << ctx->END()->getText();
566 LOG_FUNCTION_END();
567 return nullptr;
568}
569
570// FOR namelist IN explist DO block END;
571antlrcpp::Any FormatVisitor::visitForInStat(LuaParser::ForInStatContext* ctx) {

Callers

nothing calls this directly

Calls 8

FORMethod · 0.80
NAMEMethod · 0.80
EQLMethod · 0.80
expMethod · 0.80
COMMAMethod · 0.80
DOMethod · 0.80
blockMethod · 0.80
ENDMethod · 0.80

Tested by

no test coverage detected