| 10 | } |
| 11 | |
| 12 | std::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 | |
| 31 | std::shared_ptr<LineIndex> VirtualFile::GetLineIndex(VirtualFileSystem &vfs) const { |
| 32 | auto &lineIndexDB = vfs.GetLineIndexDB(); |
no test coverage detected