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

Method visitVar

src/FormatVisitor.cpp:1197–1228  ·  view source on GitHub ↗

(NAME | LP exp RP varSuffix) varSuffix*;

Source from the content-addressed store, hash-verified

1195
1196// (NAME | LP exp RP varSuffix) varSuffix*;
1197antlrcpp::Any FormatVisitor::visitVar(LuaParser::VarContext* ctx) {
1198 LOG_FUNCTION_BEGIN();
1199 int startAt = 0;
1200 if (ctx->exp() != nullptr) {
1201 cur_writer() << ctx->LP()->getText();
1202 cur_writer() << commentAfter(ctx->LP(), "");
1203 visitExp(ctx->exp());
1204 cur_writer() << commentAfter(ctx->exp(), "");
1205 cur_writer() << ctx->RP()->getText();
1206 cur_writer() << commentAfter(ctx->RP(), "");
1207 visitVarSuffix(ctx->varSuffix().front());
1208 if (ctx->varSuffix().size() > 1) {
1209 cur_writer() << commentAfter(ctx->varSuffix().front(), "");
1210 }
1211 startAt = 1;
1212 } else {
1213 cur_writer() << ctx->NAME()->getText();
1214 if (!ctx->varSuffix().empty()) {
1215 cur_writer() << commentAfter(ctx->NAME(), "");
1216 }
1217 startAt = 0;
1218 }
1219 int n = ctx->varSuffix().size();
1220 for (int i = startAt; i < n; i++) {
1221 visitVarSuffix(ctx->varSuffix()[i]);
1222 if (i != n - 1) {
1223 cur_writer() << commentAfter(ctx->varSuffix()[i], "");
1224 }
1225 }
1226 LOG_FUNCTION_END();
1227 return nullptr;
1228}
1229
1230// nameAndArgs* (LSB exp RSB | DOT NAME);
1231antlrcpp::Any FormatVisitor::visitVarSuffix(LuaParser::VarSuffixContext* ctx) {

Callers

nothing calls this directly

Calls 5

expMethod · 0.80
LPMethod · 0.80
RPMethod · 0.80
varSuffixMethod · 0.80
NAMEMethod · 0.80

Tested by

no test coverage detected