summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 16:33:06 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 16:33:06 +0000
commit1bf3fe1d60ab6cfe02686a032d9f76a0293c0999 (patch)
tree0d09c3d6e0c284122bb8a501a18953726740adcc /compile.c
parented8447821575d4a6a64b813579d9cea1078d478c (diff)
merges r21571 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@21576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 6 insertions, 0 deletions
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;
+}