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

Method Diagnostic

CodeFormatLib/src/LuaCodeFormat.cpp:170–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::Diagnostic(const std::string &uri, std::string &&text) {
171 auto file = std::make_shared<LuaSource>(std::move(text));
172 LuaLexer luaLexer(file);
173 if (_supportNonStandardSymbol) {
174 luaLexer.SupportNonStandardSymbol();
175 }
176 if (_supportCLikeComments) {
177 luaLexer.SupportCLikeComments();
178 }
179
180 luaLexer.Parse();
181
182 LuaParser p(file, std::move(luaLexer.GetTokens()));
183 p.Parse();
184
185 if (p.HasError()) {
186 return ResultType::Err;
187 }
188
189 LuaSyntaxTree t;
190 t.BuildTree(p);
191
192 LuaStyle style = GetStyle(uri);
193
194 DiagnosticBuilder diagnosticBuilder(style, _diagnosticStyle);
195 diagnosticBuilder.CodeStyleCheck(t);
196 return MakeDiagnosticInfo(diagnosticBuilder.GetDiagnosticResults(t), file);
197}
198
199Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::SpellCheck(const std::string &uri, std::string &&text,
200 const CodeSpellChecker::CustomDictionary &tempDict) {

Callers 1

diagnose_fileFunction · 0.45

Calls 8

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
CodeStyleCheckMethod · 0.80
GetDiagnosticResultsMethod · 0.80
SupportCLikeCommentsMethod · 0.45
ParseMethod · 0.45
HasErrorMethod · 0.45

Tested by

no test coverage detected