Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce redundancy and perform minor whitespace cleanup #280

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/lua-format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ std::string resetContentInDisableFormatBlocks(const std::string& original, const
std::string lua_format(std::istream& is, const Config& config) {
std::ostringstream os;
os << is.rdbuf();
std::string original = os.str();
ANTLRInputStream input(original);
std::string formatted = __format(input, config);
formatted = handleLineSeparator(original, formatted, config);
return resetContentInDisableFormatBlocks(original, formatted);
return lua_format(os.str(), config);
}

std::string lua_format(const std::string& str, const Config& config) {
Expand Down
4 changes: 2 additions & 2 deletions src/visitor/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ antlrcpp::Any FormatVisitor::visitTableconstructor(LuaParser::TableconstructorCo
column_table_limit = config_.get<int>("column_limit");
}
}

beyondLimit = cur_columns() + length > column_table_limit || lines > 1;
}
bool breakAfterLb = false;
Expand Down Expand Up @@ -225,4 +225,4 @@ antlrcpp::Any FormatVisitor::visitField(LuaParser::FieldContext* ctx) {
antlrcpp::Any FormatVisitor::visitFieldsep(LuaParser::FieldsepContext* context) {
cur_writer() << config_.get<std::string>("table_sep");
return nullptr;
}
}