1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

/p is back for transit

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-05-22 07:29:50 +00:00
parent e4e5edd5c3
commit b8f39362b2
2 changed files with 16 additions and 15 deletions

17
parse.y
View file

@ -1434,7 +1434,7 @@ cases : opt_else
exc_list : args exc_list : args
| none | none
exc_var : kIN lhs exc_var : ':' lhs
{ {
$$ = $2; $$ = $2;
} }
@ -2257,7 +2257,8 @@ parse_regx(term, paren)
options |= RE_OPTION_EXTENDED; options |= RE_OPTION_EXTENDED;
break; break;
case 'p': /* /p is obsolete, works as /m */ case 'p': /* /p is obsolete, works as /m */
yyerror("/p option is obsolete; use /m\n\tnote: /m does not change ^, $ behavior"); rb_warn("/p option is obsolete; use /m\n\tnote: /m does not change ^, $ behavior");
options |= RE_OPTION_POSIXLINE;
break; break;
case 'm': case 'm':
options |= RE_OPTION_MULTILINE; options |= RE_OPTION_MULTILINE;
@ -2266,16 +2267,16 @@ parse_regx(term, paren)
once = 1; once = 1;
break; break;
case 'n': case 'n':
kcode = 8;
break;
case 'e':
kcode = 16; kcode = 16;
break; break;
case 'e':
kcode = 32;
break;
case 's': case 's':
kcode = 24; kcode = 48;
break; break;
case 'u': case 'u':
kcode = 32; kcode = 64;
break; break;
default: default:
pushback(c); pushback(c);
@ -4654,7 +4655,7 @@ rb_intern(name)
const char *name; const char *name;
{ {
static ID last_id = LAST_TOKEN; static ID last_id = LAST_TOKEN;
int id; ID id;
int last; int last;
if (st_lookup(sym_tbl, name, &id)) if (st_lookup(sym_tbl, name, &id))

14
re.c
View file

@ -791,33 +791,33 @@ rb_reg_initialize(obj, s, len, options)
default: default:
FL_SET(re, reg_kcode); FL_SET(re, reg_kcode);
break; break;
case 8: case 16:
kcode_none(re); kcode_none(re);
break; break;
case 16: case 32:
kcode_euc(re); kcode_euc(re);
break; break;
case 24: case 48:
kcode_sjis(re); kcode_sjis(re);
break; break;
case 32: case 64:
kcode_utf8(re); kcode_utf8(re);
break; break;
} }
if (options & ~0x7) { if (options & ~0xf) {
kcode_set_option((VALUE)re); kcode_set_option((VALUE)re);
} }
if (ruby_ignorecase) { if (ruby_ignorecase) {
options |= RE_OPTION_IGNORECASE; options |= RE_OPTION_IGNORECASE;
FL_SET(re, REG_CASESTATE); FL_SET(re, REG_CASESTATE);
} }
re->ptr = make_regexp(s, len, options & 0x7); re->ptr = make_regexp(s, len, options & 0xf);
re->str = ALLOC_N(char, len+1); re->str = ALLOC_N(char, len+1);
memcpy(re->str, s, len); memcpy(re->str, s, len);
re->str[len] = '\0'; re->str[len] = '\0';
re->len = len; re->len = len;
if (options & ~0x7) { if (options & ~0xf) {
kcode_reset_option(); kcode_reset_option();
} }
} }