| 70 | } |
| 71 | |
| 72 | Result<std::string> LuaCodeFormat::Reformat(const std::string &uri, std::string &&text, ConfigMap &configMap) { |
| 73 | auto file = std::make_shared<LuaSource>(std::move(text)); |
| 74 | LuaLexer luaLexer(file); |
| 75 | if (_supportNonStandardSymbol) { |
| 76 | luaLexer.SupportNonStandardSymbol(); |
| 77 | } |
| 78 | if (_supportCLikeComments) { |
| 79 | luaLexer.SupportCLikeComments(); |
| 80 | } |
| 81 | |
| 82 | luaLexer.Parse(); |
| 83 | |
| 84 | LuaParser p(file, std::move(luaLexer.GetTokens())); |
| 85 | p.Parse(); |
| 86 | |
| 87 | if (p.HasError()) { |
| 88 | return ResultType::Err; |
| 89 | } |
| 90 | |
| 91 | LuaSyntaxTree t; |
| 92 | t.BuildTree(p); |
| 93 | |
| 94 | LuaStyle style = GetStyle(uri); |
| 95 | CalculateTempStyle(style, configMap); |
| 96 | |
| 97 | FormatBuilder f(style); |
| 98 | |
| 99 | return f.GetFormatResult(t); |
| 100 | } |
| 101 | |
| 102 | Result<std::string> LuaCodeFormat::RangeFormat(const std::string &uri, FormatRange &range, |
| 103 | std::string &&text, |
no test coverage detected