| 684 | } |
| 685 | |
| 686 | int name_style_analysis(lua_State *L) { |
| 687 | int top = lua_gettop(L); |
| 688 | |
| 689 | if (top < 2) { |
| 690 | return 0; |
| 691 | } |
| 692 | |
| 693 | if (lua_isstring(L, 1) && lua_isstring(L, 2)) { |
| 694 | try { |
| 695 | std::string filename = lua_tostring(L, 1); |
| 696 | std::string text = lua_tostring(L, 2); |
| 697 | |
| 698 | auto nameStyleResult = LuaCodeFormat::GetInstance().NameStyleCheck(filename, std::move(text)); |
| 699 | if (nameStyleResult.Type == ResultType::Err) { |
| 700 | lua_pushboolean(L, false); |
| 701 | return 1; |
| 702 | } |
| 703 | |
| 704 | auto &diagnostics = nameStyleResult.Data; |
| 705 | lua_pushboolean(L, true); |
| 706 | PushDiagnosticToLua(L, diagnostics); |
| 707 | |
| 708 | return 2; |
| 709 | } catch (std::exception &e) { |
| 710 | std::string err = e.what(); |
| 711 | lua_settop(L, top); |
| 712 | lua_pushboolean(L, false); |
| 713 | lua_pushlstring(L, err.c_str(), err.size()); |
| 714 | return 2; |
| 715 | } |
| 716 | } |
| 717 | return 0; |
| 718 | } |
| 719 | |
| 720 | int spell_suggest(lua_State *L) { |
| 721 | int top = lua_gettop(L); |
nothing calls this directly
no test coverage detected