remove dead code shebang support from self-hosted tokenizer
parent
ad77e93415
commit
ed619245e9
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue