Skip to content

Commit 43ab6ca

Browse files
committed
Splice zig's parser into zls
1 parent e4593da commit 43ab6ca

File tree

6 files changed

+19117
-2
lines changed

6 files changed

+19117
-2
lines changed

src/DocumentStore.zig

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const Config = @import("Config.zig");
1313
const ZigVersionWrapper = @import("ZigVersionWrapper.zig");
1414
const translate_c = @import("translate_c.zig");
1515
const ComptimeInterpreter = @import("ComptimeInterpreter.zig");
16+
const Parser = @import("stage2/Ast.zig");
1617
const AstGen = @import("stage2/AstGen.zig");
1718
const Zir = @import("stage2/Zir.zig");
1819
const InternPool = @import("analyser/InternPool.zig");
@@ -754,8 +755,16 @@ fn createDocument(self: *DocumentStore, uri: Uri, text: [:0]const u8, open: bool
754755
var duped_uri = try self.allocator.dupe(u8, uri);
755756
errdefer self.allocator.free(duped_uri);
756757

757-
var tree = try Ast.parse(self.allocator, text, .zig);
758-
errdefer tree.deinit(self.allocator);
758+
// var tree = try Ast.parse(self.allocator, text, .zig);
759+
var zls_ast = try Parser.parse(self.allocator, text, .zig);
760+
errdefer zls_ast.deinit(self.allocator);
761+
var tree = Ast{
762+
.source = zls_ast.source,
763+
.tokens = zls_ast.tokens,
764+
.nodes = zls_ast.nodes,
765+
.extra_data = zls_ast.extra_data,
766+
.errors = zls_ast.errors,
767+
};
759768

760769
// remove unused capacity
761770
var nodes = tree.nodes.toMultiArrayList();

0 commit comments

Comments
 (0)