(COLON NAME)? args;
| 1356 | |
| 1357 | // (COLON NAME)? args; |
| 1358 | antlrcpp::Any FormatVisitor::visitNameAndArgs(LuaParser::NameAndArgsContext* ctx) { |
| 1359 | LOG_FUNCTION_BEGIN(); |
| 1360 | if (ctx->COLON() != nullptr) { |
| 1361 | bool beyondLimit = false; |
| 1362 | LuaParser::StringContext* stringContext = ctx->args()->string(); |
| 1363 | bool needWhiteSpace = stringContext != nullptr; |
| 1364 | if (!chainedMethodCallIsFirst_.back()) { |
| 1365 | chainedMethodCallIsFirst_[chainedMethodCallIsFirst_.size() - 1] = true; |
| 1366 | } else { |
| 1367 | int length = calcASTLengthAndLines(ctx->args(), [=]() { |
| 1368 | cur_writer() << ctx->COLON()->getText(); |
| 1369 | cur_writer() << commentAfter(ctx->COLON(), ""); |
| 1370 | cur_writer() << ctx->NAME()->getText(); |
| 1371 | cur_writer() << commentAfter(ctx->NAME(), needWhiteSpace ? " " : ""); |
| 1372 | visitArgs(ctx->args()); |
| 1373 | }).first; |
| 1374 | beyondLimit = cur_columns() + length > config_.get<int>("column_limit"); |
| 1375 | } |
| 1376 | if (beyondLimit) { |
| 1377 | cur_writer() << "\n"; |
| 1378 | if (chainedMethodCallHasIncIndent_.back()) { |
| 1379 | cur_writer() << indentWithAlign(); |
| 1380 | } else { |
| 1381 | incContinuationIndent(); |
| 1382 | cur_writer() << indentWithAlign(); |
| 1383 | chainedMethodCallHasIncIndent_[chainedMethodCallHasIncIndent_.size() - 1] = true; |
| 1384 | } |
| 1385 | } |
| 1386 | cur_writer() << ctx->COLON()->getText(); |
| 1387 | cur_writer() << commentAfter(ctx->COLON(), ""); |
| 1388 | cur_writer() << ctx->NAME()->getText(); |
| 1389 | cur_writer() << commentAfter(ctx->NAME(), needWhiteSpace ? " " : ""); |
| 1390 | visitArgs(ctx->args()); |
| 1391 | } else { |
| 1392 | visitArgs(ctx->args()); |
| 1393 | } |
| 1394 | LOG_FUNCTION_END(); |
| 1395 | return nullptr; |
| 1396 | } |
| 1397 | |
| 1398 | // LP explist? RP | tableconstructor | string; |
| 1399 | antlrcpp::Any FormatVisitor::visitArgs(LuaParser::ArgsContext* ctx) { |