Skip to content

Commit ab2be72

Browse files
committed
Fix shebang lexing.
1 parent 6722979 commit ab2be72

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/source/dlexer.d

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,11 @@ struct DLexer {
372372

373373
import source.name;
374374
Name popSheBang() {
375-
auto c = frontChar;
376-
if (c != '#') {
375+
if (frontChar != '#' || nextChar != '!') {
377376
return BuiltinName!"";
378377
}
379378

380-
while (c != '\n') {
381-
popChar();
382-
c = frontChar;
383-
}
384-
379+
popLine();
385380
return context.getName(content[0 .. index]);
386381
}
387382

test/compilable/nonutf8_shebang.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/opt/dmd/ÐÒÏÂÙ/rdmd
2-
32
import core.stdc.stdio;
43

54
void main() {

0 commit comments

Comments
 (0)