From 6db869c33d939f8eb0ee3249b6188c975002aab2 Mon Sep 17 00:00:00 2001 From: NAKAMURA Usaku Date: Mon, 23 Apr 2012 14:42:05 +0900 Subject: Support ``__END__'' as the mark of the end of a script (ISO Ruby). --- src/parse.y | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/parse.y') 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 '$': -- cgit v1.2.3