remove dead code shebang support from self-hosted tokenizer

master
Andrew Kelley 2019-11-20 20:18:19 -05:00
parent ad77e93415
commit ed619245e9
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
1 changed files with 7 additions and 20 deletions

View File

@ -338,18 +338,6 @@ pub const Tokenizer = struct {
} }
pub fn init(buffer: []const u8) Tokenizer { pub fn init(buffer: []const u8) Tokenizer {
if (mem.startsWith(u8, buffer, "#!")) {
const src_start = if (mem.indexOfScalar(u8, buffer, '\n')) |i| i + 1 else buffer.len;
return Tokenizer{
.buffer = buffer,
.index = src_start,
.pending_invalid_token = Token{
.id = Token.Id.ShebangLine,
.start = 0,
.end = src_start,
},
};
} else {
// Skip the UTF-8 BOM if present // Skip the UTF-8 BOM if present
const src_start = if (mem.startsWith(u8, buffer, "\xEF\xBB\xBF")) 3 else @as(usize, 0); const src_start = if (mem.startsWith(u8, buffer, "\xEF\xBB\xBF")) 3 else @as(usize, 0);
return Tokenizer{ return Tokenizer{
@ -358,7 +346,6 @@ pub const Tokenizer = struct {
.pending_invalid_token = null, .pending_invalid_token = null,
}; };
} }
}
const State = enum { const State = enum {
Start, Start,