Skip to content

Commit 8139c5a

Browse files
authored
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
1 parent 67fbb04 commit 8139c5a

File tree

216 files changed

+92963
-92942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+92963
-92942
lines changed

build.zig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn build(b: *Builder) !void {
1717

1818
const rel_zig_exe = try os.path.relative(b.allocator, b.build_root, b.zig_exe);
1919
const langref_out_path = os.path.join(b.allocator, b.cache_root, "langref.html") catch unreachable;
20-
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8.{
20+
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8{
2121
docgen_exe.getOutputPath(),
2222
rel_zig_exe,
2323
"doc" ++ os.path.sep_str ++ "langref.html.in",
@@ -31,12 +31,12 @@ pub fn build(b: *Builder) !void {
3131
const test_step = b.step("test", "Run all the tests");
3232

3333
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
34-
const build_info = try b.exec([][]const u8.{
34+
const build_info = try b.exec([][]const u8{
3535
b.zig_exe,
3636
"BUILD_INFO",
3737
});
3838
var index: usize = 0;
39-
var ctx = Context.{
39+
var ctx = Context{
4040
.cmake_binary_dir = nextValue(&index, build_info),
4141
.cxx_compiler = nextValue(&index, build_info),
4242
.llvm_config_exe = nextValue(&index, build_info),
@@ -162,7 +162,7 @@ fn addCppLib(b: *Builder, lib_exe_obj: var, cmake_binary_dir: []const u8, lib_na
162162
lib_exe_obj.addObjectFile(os.path.join(b.allocator, cmake_binary_dir, "zig_cpp", b.fmt("{}{}{}", lib_prefix, lib_name, lib_exe_obj.target.libFileExt())) catch unreachable);
163163
}
164164

165-
const LibraryDep = struct.{
165+
const LibraryDep = struct {
166166
prefix: []const u8,
167167
libdirs: ArrayList([]const u8),
168168
libs: ArrayList([]const u8),
@@ -171,24 +171,24 @@ const LibraryDep = struct.{
171171
};
172172

173173
fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
174-
const shared_mode = try b.exec([][]const u8.{ llvm_config_exe, "--shared-mode" });
174+
const shared_mode = try b.exec([][]const u8{ llvm_config_exe, "--shared-mode" });
175175
const is_static = mem.startsWith(u8, shared_mode, "static");
176176
const libs_output = if (is_static)
177-
try b.exec([][]const u8.{
177+
try b.exec([][]const u8{
178178
llvm_config_exe,
179179
"--libfiles",
180180
"--system-libs",
181181
})
182182
else
183-
try b.exec([][]const u8.{
183+
try b.exec([][]const u8{
184184
llvm_config_exe,
185185
"--libs",
186186
});
187-
const includes_output = try b.exec([][]const u8.{ llvm_config_exe, "--includedir" });
188-
const libdir_output = try b.exec([][]const u8.{ llvm_config_exe, "--libdir" });
189-
const prefix_output = try b.exec([][]const u8.{ llvm_config_exe, "--prefix" });
187+
const includes_output = try b.exec([][]const u8{ llvm_config_exe, "--includedir" });
188+
const libdir_output = try b.exec([][]const u8{ llvm_config_exe, "--libdir" });
189+
const prefix_output = try b.exec([][]const u8{ llvm_config_exe, "--prefix" });
190190

191-
var result = LibraryDep.{
191+
var result = LibraryDep{
192192
.prefix = mem.split(prefix_output, " \r\n").next().?,
193193
.libs = ArrayList([]const u8).init(b.allocator),
194194
.system_libs = ArrayList([]const u8).init(b.allocator),
@@ -328,7 +328,7 @@ fn addCxxKnownPath(
328328
objname: []const u8,
329329
errtxt: ?[]const u8,
330330
) !void {
331-
const path_padded = try b.exec([][]const u8.{
331+
const path_padded = try b.exec([][]const u8{
332332
ctx.cxx_compiler,
333333
b.fmt("-print-file-name={}", objname),
334334
});
@@ -344,7 +344,7 @@ fn addCxxKnownPath(
344344
exe.addObjectFile(path_unpadded);
345345
}
346346

347-
const Context = struct.{
347+
const Context = struct {
348348
cmake_binary_dir: []const u8,
349349
cxx_compiler: []const u8,
350350
llvm_config_exe: []const u8,

0 commit comments

Comments
 (0)