summaryrefslogtreecommitdiffhomepage
path: root/src/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-04-22 23:49:53 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-04-22 23:49:53 -0700
commitdaedb2b9de6302a9fa40c22e850ba505ad0ea0fd (patch)
tree079e33559f5104bf2f2016a0d878677a4c1332fd /src/parse.y
parentc80487561f291e8239541687341b4d64a840c108 (diff)
parent6db869c33d939f8eb0ee3249b6188c975002aab2 (diff)
downloadmruby-daedb2b9de6302a9fa40c22e850ba505ad0ea0fd.tar.gz
mruby-daedb2b9de6302a9fa40c22e850ba505ad0ea0fd.zip
Merge pull request #43 from unak/__end__
Support ``__END__'' as the mark of the end of a script (ISO Ruby).
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parse.y b/src/parse.y
index 2c02a31cb..39e025b04 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -4455,6 +4455,9 @@ parser_yylex(parser_state *p)
c = nextc(p);
if (c < 0) break;
} while (identchar(c));
+ if (p->column == 0 && p->bidx == 7 && (c < 0 || c == '\n') &&
+ strncmp(tok(p), "__END__", p->bidx) == 0)
+ return -1;
switch (tok(p)[0]) {
case '@': case '$':