MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / name_style_analysis

Function name_style_analysis

CodeFormatLib/src/CodeFormatLib.cpp:686–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686int 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
720int spell_suggest(lua_State *L) {
721 int top = lua_gettop(L);

Callers

nothing calls this directly

Calls 9

lua_gettopFunction · 0.85
lua_isstringFunction · 0.85
lua_pushbooleanFunction · 0.85
PushDiagnosticToLuaFunction · 0.85
lua_settopFunction · 0.85
lua_pushlstringFunction · 0.85
NameStyleCheckMethod · 0.45
whatMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected