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

parse.y: fix token

* parse.y (paren_args): fix separator token at `foo::bar()` in
  ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-09-24 08:25:11 +00:00
parent 79255ac86c
commit 3fa061cd57
3 changed files with 36 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Thu Sep 24 17:25:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (paren_args): fix separator token at `foo::bar()` in
ripper.
Thu Sep 24 00:00:17 2015 Rei Odaira <Rei.Odaira@gmail.com>
* complex.c: ruby/config.h must be included before math.h

View file

@ -3663,7 +3663,7 @@ method_call : fcall paren_args
$$ = NEW_CALL($1, $3, $5);
nd_set_line($$, $<num>4);
/*%
$$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
$$ = dispatch3(call, $1, ripper_id2sym(idCOLON2), $3);
$$ = method_optarg($$, $5);
%*/
}
@ -10979,7 +10979,7 @@ ripper_id2sym(ID id)
const char *name;
char buf[8];
if (id <= 256) {
if (ISASCII(id)) {
buf[0] = (char)id;
buf[1] = '\0';
return ID2SYM(rb_intern2(buf, 1));

View file

@ -346,12 +346,41 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
}
assert_equal true, thru_call
assert_equal "[call(ref(self),.,foo)]", tree
thru_call = false
assert_nothing_raised {
tree = parse("self.foo()", :on_call) {thru_call = true}
}
assert_equal true, thru_call
assert_equal "[call(ref(self),.,foo,[])]", tree
thru_call = false
assert_nothing_raised(bug2233) {
tree = parse("foo.()", :on_call) {thru_call = true}
}
assert_equal true, thru_call
assert_equal "[call(vcall(foo),.,call,[])]", tree
thru_call = false
assert_nothing_raised {
tree = parse("self::foo", :on_call) {thru_call = true}
}
assert_equal true, thru_call
assert_equal "[call(ref(self),::,foo)]", tree
thru_call = false
assert_nothing_raised {
tree = parse("self::foo()", :on_call) {thru_call = true}
}
assert_equal true, thru_call
assert_equal "[call(ref(self),::,foo,[])]", tree
thru_call = false
assert_nothing_raised(bug2233) {
tree = parse("foo::()", :on_call) {thru_call = true}
}
assert_equal true, thru_call
assert_equal "[call(vcall(foo),::,call,[])]", tree
end
def test_excessed_comma