加入格式化代码插件,并提交格式化后的代码

This commit is contained in:
everywhere.z
2023-03-20 11:50:40 +08:00
parent 1f13db48fc
commit ec50e3a0af
1756 changed files with 24781 additions and 22473 deletions

View File

@@ -11,30 +11,33 @@ import java.util.stream.Collectors;
/**
* Lua脚本语言的执行器实现
*
* @author Bryan.Zhang
* @since 2.9.5
*/
public class LuaScriptExecutor extends JSR223ScriptExecutor {
@Override
public ScriptTypeEnum scriptType() {
return ScriptTypeEnum.LUA;
}
@Override
protected String convertScript(String script) {
String[] lineArray = script.split("\\n");
List<String> noBlankLineList = Arrays.stream(lineArray).filter(
s -> !StrUtil.isBlank(s)
).collect(Collectors.toList());
@Override
public ScriptTypeEnum scriptType() {
return ScriptTypeEnum.LUA;
}
//用第一行的缩进的空格数作为整个代码的缩进量
String blankStr = ReUtil.getGroup0("^[ ]*", noBlankLineList.get(0));
@Override
protected String convertScript(String script) {
String[] lineArray = script.split("\\n");
List<String> noBlankLineList = Arrays.stream(lineArray)
.filter(s -> !StrUtil.isBlank(s))
.collect(Collectors.toList());
// 用第一行的缩进的空格数作为整个代码的缩进量
String blankStr = ReUtil.getGroup0("^[ ]*", noBlankLineList.get(0));
// 重新构建脚本
StringBuilder scriptSB = new StringBuilder();
noBlankLineList.forEach(s -> scriptSB.append(StrUtil.format("{}\n", s.replaceFirst(blankStr, StrUtil.EMPTY))));
return scriptSB.toString();
// return StrUtil.format("function
// process()\n{}\nend\nprocess()\n",scriptSB.toString());
}
//重新构建脚本
StringBuilder scriptSB = new StringBuilder();
noBlankLineList.forEach(s
-> scriptSB.append(StrUtil.format("{}\n", s.replaceFirst(blankStr, StrUtil.EMPTY))));
return scriptSB.toString();
//return StrUtil.format("function process()\n{}\nend\nprocess()\n",scriptSB.toString());
}
}