mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: valid suffix word only
* parse.y (parser_str_options): use valid suffix word only, as well as numeric literal, for the backward comatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
57d06d7b3f
commit
306cf3ac03
3 changed files with 13 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 2 23:46:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_str_options): use valid suffix word only, as well as
|
||||
numeric literal, for the backward comatibility.
|
||||
|
||||
Mon Sep 2 22:55:59 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (ISDIGIT): Unused macro removed.
|
||||
|
|
13
parse.y
13
parse.y
|
@ -6000,8 +6000,8 @@ static int
|
|||
parser_str_options(struct parser_params *parser)
|
||||
{
|
||||
int c, options = 0;
|
||||
const char *save_p = lex_p;
|
||||
|
||||
newtok();
|
||||
while (c = nextc(), ISALPHA(c)) {
|
||||
switch (c) {
|
||||
#if STR_OPTION_FROZEN
|
||||
|
@ -6015,18 +6015,11 @@ parser_str_options(struct parser_params *parser)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
tokadd(c);
|
||||
break;
|
||||
lex_p = save_p;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
pushback(c);
|
||||
|
||||
if (toklen()) {
|
||||
tokfix();
|
||||
compile_error(PARSER_ARG "unknown string option%s - %s",
|
||||
toklen() > 1 ? "s" : "", tok());
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
|
@ -2194,11 +2194,14 @@ class TestString < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_unknown_string_option
|
||||
assert_raises(SyntaxError) do
|
||||
str = nil
|
||||
assert_nothing_raised(SyntaxError) do
|
||||
eval(%{
|
||||
"hello"x
|
||||
str = begin"hello"end
|
||||
})
|
||||
end
|
||||
assert_equal "hello", str
|
||||
assert_not_predicate str, :frozen?
|
||||
end
|
||||
|
||||
def test_frozen_string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue