diff options
| author | Shawn Landden <shawn@git.icu> | 2019-04-09 19:16:51 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-04-24 23:34:19 -0400 |
| commit | 8ef7f6febb7132d7a1ee44199fd22006f326de5c (patch) | |
| tree | 4ce5c3a8c7a54a344cee9a0e72de8fad1dd701fd /std | |
| parent | fb2acaff067dd6b385de7f2bd2726bdfebbf841f (diff) | |
| download | zig-8ef7f6febb7132d7a1ee44199fd22006f326de5c.tar.gz zig-8ef7f6febb7132d7a1ee44199fd22006f326de5c.zip | |
remove Shebang (#!) support
Closes: #2165
Diffstat (limited to 'std')
| -rw-r--r-- | std/zig/ast.zig | 3 | ||||
| -rw-r--r-- | std/zig/parse.zig | 10 | ||||
| -rw-r--r-- | std/zig/parser_test.zig | 8 | ||||
| -rw-r--r-- | std/zig/render.zig | 5 |
4 files changed, 0 insertions, 26 deletions
diff --git a/std/zig/ast.zig b/std/zig/ast.zig index 9aba59f77c..7024f988a2 100644 --- a/std/zig/ast.zig +++ b/std/zig/ast.zig @@ -479,7 +479,6 @@ pub const Node = struct { doc_comments: ?*DocComment, decls: DeclList, eof_token: TokenIndex, - shebang: ?TokenIndex, pub const DeclList = SegmentedList(*Node, 4); @@ -491,7 +490,6 @@ pub const Node = struct { } pub fn firstToken(self: *const Root) TokenIndex { - if (self.shebang) |shebang| return shebang; return if (self.decls.len == 0) self.eof_token else (self.decls.at(0).*).firstToken(); } @@ -2235,7 +2233,6 @@ test "iterate" { .doc_comments = null, .decls = Node.Root.DeclList.init(std.debug.global_allocator), .eof_token = 0, - .shebang = null, }; var base = &root.base; testing.expect(base.iterate(0) == null); diff --git a/std/zig/parse.zig b/std/zig/parse.zig index 42fa6d8590..a461e15721 100644 --- a/std/zig/parse.zig +++ b/std/zig/parse.zig @@ -22,7 +22,6 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { .base = ast.Node{ .id = ast.Node.Id.Root }, .decls = ast.Node.Root.DeclList.init(arena), .doc_comments = null, - .shebang = null, // initialized when we get the eof token .eof_token = undefined, }; @@ -43,15 +42,6 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { } var tok_it = tree.tokens.iterator(0); - // skip over shebang line - shebang: { - const shebang_tok_index = tok_it.index; - const shebang_tok_ptr = tok_it.peek() orelse break :shebang; - if (shebang_tok_ptr.id != Token.Id.ShebangLine) break :shebang; - root_node.shebang = shebang_tok_index; - _ = tok_it.next(); - } - // skip over line comments at the top of the file while (true) { const next_tok = tok_it.peek() orelse break; diff --git a/std/zig/parser_test.zig b/std/zig/parser_test.zig index 82607dbbe9..111f0cd6ac 100644 --- a/std/zig/parser_test.zig +++ b/std/zig/parser_test.zig @@ -50,14 +50,6 @@ test "zig fmt: linksection" { ); } -test "zig fmt: shebang line" { - try testCanonical( - \\#!/usr/bin/env zig - \\pub fn main() void {} - \\ - ); -} - test "zig fmt: correctly move doc comments on struct fields" { try testTransform( \\pub const section_64 = extern struct { diff --git a/std/zig/render.zig b/std/zig/render.zig index f1fe23c2a8..74c1e2acfc 100644 --- a/std/zig/render.zig +++ b/std/zig/render.zig @@ -73,11 +73,6 @@ fn renderRoot( ) (@typeOf(stream).Child.Error || Error)!void { var tok_it = tree.tokens.iterator(0); - // render the shebang line - if (tree.root_node.shebang) |shebang| { - try stream.write(tree.tokenSlice(shebang)); - } - // render all the line comments at the beginning of the file while (tok_it.next()) |token| { if (token.id != Token.Id.LineComment) break; |
