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

Method visitField

src/FormatVisitor.cpp:1738–1762  ·  view source on GitHub ↗

LSB exp RSB EQL exp | NAME EQL exp | exp;

Source from the content-addressed store, hash-verified

1736
1737// LSB exp RSB EQL exp | NAME EQL exp | exp;
1738antlrcpp::Any FormatVisitor::visitField(LuaParser::FieldContext* ctx) {
1739 LOG_FUNCTION_BEGIN();
1740 std::string eq_space = config_.get<bool>("spaces_around_equals_in_field") ? " " : "";
1741 if (ctx->LSB() != nullptr) {
1742 cur_writer() << ctx->LSB()->getText();
1743 cur_writer() << commentAfter(ctx->LSB(), "");
1744 visitExp(ctx->exp()[0]);
1745 cur_writer() << commentAfter(ctx->exp()[0], "");
1746 cur_writer() << ctx->RSB()->getText();
1747 cur_writer() << commentAfter(ctx->RSB(), eq_space);
1748 cur_writer() << ctx->EQL()->getText();
1749 cur_writer() << commentAfter(ctx->EQL(), eq_space);
1750 visitExp(ctx->exp()[1]);
1751 } else if (ctx->NAME() != nullptr) {
1752 cur_writer() << ctx->NAME()->getText();
1753 cur_writer() << commentAfter(ctx->NAME(), eq_space);
1754 cur_writer() << ctx->EQL()->getText();
1755 cur_writer() << commentAfter(ctx->EQL(), eq_space);
1756 visitExp(ctx->exp().front());
1757 } else {
1758 visitExp(ctx->exp().front());
1759 }
1760 LOG_FUNCTION_END();
1761 return nullptr;
1762}
1763
1764antlrcpp::Any FormatVisitor::visitFieldsep(LuaParser::FieldsepContext* context) {
1765 cur_writer() << config_.get<std::string>("table_sep");

Callers

nothing calls this directly

Calls 5

LSBMethod · 0.80
expMethod · 0.80
RSBMethod · 0.80
EQLMethod · 0.80
NAMEMethod · 0.80

Tested by

no test coverage detected