diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-10 07:22:50 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-10 07:22:50 +0000 |
commit | 3529e14a4b24b76c3731742a4277805a0b23ce44 (patch) | |
tree | 25db5caea349ad1241aded6d0ba95178062c26cf /parse.y | |
parent | 9ea4d33c33bd41bd66e0816f53c06b0e2252ffc8 (diff) |
* parse.y (gettable): should freeze __LINE__ string.
* parse.y (str_extend): should not process immature #$x and
#@x interportation, e.g #@#@ etc.
* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -3750,6 +3750,10 @@ str_extend(list, term, paren) case '-': tokadd(c); c = nextc(); + if (!is_identchar(c)) { + pushback(); + goto invalid_interporate; + } tokadd(c); goto fetch_id; @@ -3768,9 +3772,14 @@ str_extend(list, term, paren) goto refetch; } if (!is_identchar(c)) { - yyerror("bad global variable in string"); - newtok(); - return list; + invalid_interporate: + { + VALUE s = rb_str_new2("#"); + rb_str_cat(s, tok(), toklen()); + list_append(list, NEW_STR(s)); + newtok(); + return list; + } } } @@ -3809,6 +3818,9 @@ str_extend(list, term, paren) c = nextc(); } pushback(c); + if (toklen() == 1) { + goto invalid_interporate; + } break; case '{': @@ -4079,7 +4091,9 @@ gettable(id) return NEW_STR(rb_str_new2(ruby_sourcefile)); } else if (id == k__LINE__) { - return NEW_LIT(INT2FIX(ruby_sourceline)); + VALUE f = rb_str_new2(ruby_sourcefile); + OBJ_FREEZE(f); + return NEW_STR(f); } else if (is_local_id(id)) { if (dyna_in_block() && rb_dvar_defined(id)) return NEW_DVAR(id); |