summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2018-12-20 14:46:18 -0800
committerOri Bernstein <ori@markovcorp.com>2018-12-20 14:46:43 -0800
commit3f5de2514eb4a90a8f7925bbeaf6dfdfb07debf8 (patch)
treeb49237f5962eae15644fb90a56d203043909f12e /parse
parente24e91ebc63ac6dd4bdd6e7408e157c33f2d76e0 (diff)
downloadmc-3f5de2514eb4a90a8f7925bbeaf6dfdfb07debf8.tar.gz
Ignore shebang lines in the compiler.
Diffstat (limited to 'parse')
-rw-r--r--parse/tok.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/parse/tok.c b/parse/tok.c
index 934f983..f4505d5 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -880,6 +880,15 @@ tokinit(char *file)
curloc.line = 1;
curloc.file = 0;
close(fd);
+ if(fbufsz > 2 && fbuf[0] == '#' && fbuf[1] == '!') {
+ for (fidx = 0; fidx < fbufsz; fidx++) {
+ if(fbuf[fidx] == '\n') {
+ curloc.line++;
+ fidx++;
+ break;
+ }
+ }
+ }
filename = strdup(file);
}