From e40928733d9849b63bfe665d8b1d0df7bc26df83 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 15 Jan 2009 16:14:43 +0000 Subject: * ruby.c (process_options): decrement parse_in_eval to recognize parsing main or normal eval script. * compile.c (rb_parse_in_main): return 1 if parsing main script. (if parse_in_eval is negative value, it means main script) * parse.y (yycompile0): check rb_parse_in_main() to accumulate script text. Bug #848 [ruby-core:20450] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compile.c') diff --git a/compile.c b/compile.c index f459eb3cdc..205ebafa5c 100644 --- a/compile.c +++ b/compile.c @@ -5350,3 +5350,9 @@ rb_parse_in_eval(void) { return GET_THREAD()->parse_in_eval != 0; } + +int +rb_parse_in_main(void) +{ + return GET_THREAD()->parse_in_eval < 0; +} -- cgit v1.2.3