| 274 | } |
| 275 | |
| 276 | antlrcpp::Any FormatVisitor::visitChunk(LuaParser::ChunkContext* ctx) { |
| 277 | LOG_FUNCTION_BEGIN(); |
| 278 | pushWriter(); |
| 279 | cur_writer() << commentAfter(nullptr, ""); |
| 280 | bool temp = chop_down_block_; |
| 281 | chop_down_block_ = true; |
| 282 | visitBlock(ctx->block()); |
| 283 | chop_down_block_ = temp; |
| 284 | std::string comment = commentAfterNewLine(ctx->block(), NONE_INDENT); |
| 285 | |
| 286 | cur_writer() << comment; |
| 287 | std::string ret = cur_writer().str(); |
| 288 | if (*ret.rbegin() != '\n') { |
| 289 | ret += '\n'; |
| 290 | } |
| 291 | popWriter(); |
| 292 | LOG_FUNCTION_END(); |
| 293 | return ret; |
| 294 | } |
| 295 | |
| 296 | // stat* retstat? |
| 297 | antlrcpp::Any FormatVisitor::visitBlock(LuaParser::BlockContext* ctx) { |