summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-25 07:07:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-25 07:07:43 +0000
commitf33958990a43b8a20ad7ed7eb1d30ec211b46f85 (patch)
treef962530dd96d7c293cba9d8f4bd6318d688c33f2 /parse.y
parentd65fac5daa6838c9c56c6b6dd2f3127fe229d4e8 (diff)
* eval.c (ruby_run): should set toplevel visibility again here.
* eval.c (rb_eval): should not rely on ruby_class == rb_cObject check. Besides allow implicit publicity for attribute set methods. * parse.y (primary): need not to check class_nest, just set whether method is an attrset or not. * string.c (rb_str_each_line): p might be at the top of the string. * variable.c (rb_path2class): should not use rb_eval_string(). * parse.y (str_extend): expression substitution can contain string terminator again. * parse.y (yylex): the warning message "invalid character syntax" was never issued. * file.c (rb_find_file): $LOAD_PATH must not be empty. * file.c (rb_find_file_ext): ditto. * range.c (range_eq): class check should be based on range.class, instead of Range to work with Range.dup. * range.c (range_eql): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y46
1 files changed, 27 insertions, 19 deletions
diff --git a/parse.y b/parse.y
index 10b8ab5ec4..7670c26119 100644
--- a/parse.y
+++ b/parse.y
@@ -1362,8 +1362,7 @@ primary : literal
}
if ($8) $5 = NEW_ENSURE($5, $8);
- /* NOEX_PRIVATE for toplevel */
- $$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE);
+ $$ = NEW_DEFN($2, $4, $5, NOEX_PRIVATE);
if (is_attrset_id($2)) $$->nd_noex = NOEX_PUBLIC;
fixpos($$, $4);
local_pop();
@@ -3154,22 +3153,22 @@ yylex()
}
if (ISSPACE(c)){
if (lex_state != EXPR_ARG){
- int c = 0;
+ int c2 = 0;
switch (c) {
case ' ':
- c = 's';
+ c2 = 's';
break;
case '\n':
- c = 'n';
+ c2 = 'n';
break;
case '\t':
- c = 't';
+ c2 = 't';
break;
case '\v':
- c = 'v';
+ c2 = 'v';
break;
}
- if (c) {
+ if (c2) {
rb_warn("invalid character syntax; use ?\\%c", c);
}
}
@@ -4066,13 +4065,13 @@ str_extend(list, term, paren)
case '{':
if (c == '{') brace = '}';
- brace_nest = 0;
+ brace_nest = 1;
do {
loop_again:
c = nextc();
switch (c) {
case -1:
- if (brace_nest > 0) {
+ if (brace_nest > 1) {
yyerror("bad substitution in string");
newtok();
return list;
@@ -4080,8 +4079,8 @@ str_extend(list, term, paren)
return (NODE*)-1;
case '}':
if (c == brace) {
- if (brace_nest == 0) break;
brace_nest--;
+ if (brace_nest == 0) break;
}
tokadd(c);
goto loop_again;
@@ -4099,6 +4098,22 @@ str_extend(list, term, paren)
case '{':
if (brace != -1) brace_nest++;
default:
+ /* within brace */
+ if (brace_nest > 0) {
+ if (ismbchar(c)) {
+ int i, len = mbclen(c)-1;
+
+ for (i = 0; i < len; i++) {
+ tokadd(c);
+ c = nextc();
+ }
+ }
+ else {
+ tokadd(c);
+ }
+ break;
+ }
+ /* out of brace */
if (c == paren) paren_nest++;
else if (c == term && (!paren || paren_nest-- == 0)) {
pushback(c);
@@ -4109,14 +4124,7 @@ str_extend(list, term, paren)
newtok();
return list;
}
- else if (ismbchar(c)) {
- int i, len = mbclen(c)-1;
-
- for (i = 0; i < len; i++) {
- tokadd(c);
- c = nextc();
- }
- }
+ break;
case '\n':
tokadd(c);
break;