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

Function main

Test2/src/FormatTest2.cpp:9–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include "CodeFormatCore/Diagnostic/DiagnosticBuilder.h"
8
9int main() {
10 std::string buffer = R"(
11
12require "check"
13
14)";
15
16 auto file = std::make_shared<LuaSource>(std::move(buffer));
17 LuaLexer luaLexer(file);
18 luaLexer.SupportNonStandardSymbol();
19 luaLexer.Parse();
20
21 LuaParser p(file, std::move(luaLexer.GetTokens()));
22 p.Parse();
23
24 LuaSyntaxTree t;
25 t.BuildTree(p);
26 std::cout << t.GetDebugView() << std::endl;
27
28 LuaStyle s;
29 s.space_around_concat_operator = SpaceAroundStyle::None;
30 FormatBuilder b(s);
31 auto text = b.GetFormatResult(t);
32 std::cout<< text << std::endl;
33// LuaDiagnosticStyle style;
34// DiagnosticBuilder dd(s, style);
35// dd.CodeStyleCheck(t);
36// for (auto &diag: dd.GetDiagnosticResults(t)) {
37// std::cout << diag.Message << std::endl;
38// }
39 return 0;
40}

Callers

nothing calls this directly

Calls 6

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
GetDebugViewMethod · 0.80
ParseMethod · 0.45
GetFormatResultMethod · 0.45

Tested by

no test coverage detected