Skip to content

Commit

Permalink
Merge pull request #6959 from CyberShadow/pull-20170702-145440
Browse files Browse the repository at this point in the history
Fix Issue 13512 - Allow non-UTF-8 encoding in shebang line 
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Jul 3, 2017
2 parents 54c5f66 + c25d606 commit 48d5ef1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/ddmd/lexer.d
Expand Up @@ -191,28 +191,16 @@ class Lexer
p += 2;
while (1)
{
char c = *p;
char c = *p++;
switch (c)
{
case '\n':
p++;
break;
case '\r':
p++;
if (*p == '\n')
p++;
break;
case 0:
case 0x1A:
p--;
goto case;
case '\n':
break;
default:
if (c & 0x80)
{
uint u = decodeUTF();
if (u == PS || u == LS)
break;
}
p++;
continue;
}
break;
Expand Down
8 changes: 8 additions & 0 deletions test/compilable/test13512.d
@@ -0,0 +1,8 @@
#!/opt/dmd/ÐÒÏÂÙ/rdmd

import std.stdio;


void main () {
writeln("we are here!");
}

0 comments on commit 48d5ef1

Please sign in to comment.