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

Method GetSyntaxTree

CodeFormatServer/src/VFS/VirtualFile.cpp:12–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12std::optional<LuaSyntaxTree> VirtualFile::GetSyntaxTree(VirtualFileSystem &vfs) const {
13 auto &db = vfs.GetFileDB();
14 auto opText = db.Query(_fileId);
15 if (opText.has_value()) {
16 auto text = *std::move(opText.value());
17 auto file = std::make_shared<LuaSource>(std::move(text));
18 LuaLexer luaLexer(file);
19 luaLexer.Parse();
20
21 LuaParser p(file, std::move(luaLexer.GetTokens()));
22 p.Parse();
23
24 LuaSyntaxTree t;
25 t.BuildTree(p);
26 return t;
27 }
28 return std::nullopt;
29}
30
31std::shared_ptr<LineIndex> VirtualFile::GetLineIndex(VirtualFileSystem &vfs) const {
32 auto &lineIndexDB = vfs.GetLineIndexDB();

Callers 5

OnFormattingMethod · 0.80
OnRangeFormattingMethod · 0.80
OnTypeFormattingMethod · 0.80
ReformatMethod · 0.80

Calls 5

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
QueryMethod · 0.45
valueMethod · 0.45
ParseMethod · 0.45

Tested by

no test coverage detected