mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merges r30381 from trunk into ruby_1_9_2.
-- * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'. http://twitter.com/#!/wannabe53/status/18797576396472321 http://twitter.com/#!/wannabe53/status/18798416150663168 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
85e99f1d43
commit
27f15990ad
5 changed files with 34 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
|
||||||
|
http://twitter.com/#!/wannabe53/status/18797576396472321
|
||||||
|
http://twitter.com/#!/wannabe53/status/18798416150663168
|
||||||
|
|
||||||
Sun Dec 26 04:31:15 2010 Luis Lavena <luislavena@gmail.com>
|
Sun Dec 26 04:31:15 2010 Luis Lavena <luislavena@gmail.com>
|
||||||
|
|
||||||
* ext/dl/win32/registry.rb: Corrected RegCreateKeyExA signature.
|
* ext/dl/win32/registry.rb: Corrected RegCreateKeyExA signature.
|
||||||
|
|
6
parse.y
6
parse.y
|
@ -1171,8 +1171,14 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
}
|
}
|
||||||
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_call
|
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_call
|
||||||
{
|
{
|
||||||
|
/*%%%*/
|
||||||
yyerror("constant re-assignment");
|
yyerror("constant re-assignment");
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
|
/*%
|
||||||
|
$$ = dispatch2(const_path_field, $1, $3);
|
||||||
|
$$ = dispatch3(opassign, $$, $4, $5);
|
||||||
|
$$ = dispatch1(assign_error, $$);
|
||||||
|
%*/
|
||||||
}
|
}
|
||||||
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_call
|
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_call
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Node
|
||||||
@children = nodes
|
@children = nodes
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :children
|
attr_reader :name, :children
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"#{@name}(#{Node.trim_nil(@children).map {|n| n.to_s }.join(',')})"
|
"#{@name}(#{Node.trim_nil(@children).map {|n| n.to_s }.join(',')})"
|
||||||
|
@ -47,12 +47,14 @@ class NodeList
|
||||||
end
|
end
|
||||||
|
|
||||||
class DummyParser < Ripper
|
class DummyParser < Ripper
|
||||||
def hook(name)
|
def hook(*names)
|
||||||
class << self; self; end.class_eval do
|
class << self; self; end.class_eval do
|
||||||
define_method(name) do |*a, &b|
|
names.each do |name|
|
||||||
result = super(*a, &b)
|
define_method(name) do |*a, &b|
|
||||||
yield(*a)
|
result = super(*a, &b)
|
||||||
result
|
yield(name, *a)
|
||||||
|
result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self
|
self
|
||||||
|
|
|
@ -20,7 +20,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
||||||
|
|
||||||
def parse(str, nm = nil, &bl)
|
def parse(str, nm = nil, &bl)
|
||||||
dp = DummyParser.new(str)
|
dp = DummyParser.new(str)
|
||||||
dp.hook(nm, &bl) if nm
|
dp.hook(*nm, &bl) if nm
|
||||||
dp.parse.to_s
|
dp.parse.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -347,10 +347,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
||||||
assert_equal true, thru_heredoc_beg
|
assert_equal true, thru_heredoc_beg
|
||||||
assert_match(/string_content\(\),heredoc\n/, tree, bug1921)
|
assert_match(/string_content\(\),heredoc\n/, tree, bug1921)
|
||||||
heredoc = nil
|
heredoc = nil
|
||||||
parse("<<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|n, s| heredoc = s}
|
parse("<<EOS\nheredoc1\nheredoc2\nEOS\n", :on_string_add) {|e, n, s| heredoc = s}
|
||||||
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
|
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
|
||||||
heredoc = nil
|
heredoc = nil
|
||||||
parse("<<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|n, s| heredoc = s}
|
parse("<<-EOS\nheredoc1\nheredoc2\n\tEOS\n", :on_string_add) {|e, n, s| heredoc = s}
|
||||||
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
|
assert_equal("heredoc1\nheredoc2\n", heredoc, bug1921)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -676,6 +676,15 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
||||||
assert_equal true, thru_opassign
|
assert_equal true, thru_opassign
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_opassign_error
|
||||||
|
thru_opassign = []
|
||||||
|
events = [:on_opassign, :on_assign_error]
|
||||||
|
parse('a::X ||= c 1', events) {|a,*b|
|
||||||
|
thru_opassign << a
|
||||||
|
}
|
||||||
|
assert_equal events, thru_opassign
|
||||||
|
end
|
||||||
|
|
||||||
def test_param_error
|
def test_param_error
|
||||||
thru_param_error = false
|
thru_param_error = false
|
||||||
parse('def foo(A) end', :on_param_error) {thru_param_error = true}
|
parse('def foo(A) end', :on_param_error) {thru_param_error = true}
|
||||||
|
@ -1104,7 +1113,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_unterminated_regexp
|
def test_unterminated_regexp
|
||||||
compile_error = false
|
compile_error = false
|
||||||
parse('/', :compile_error) {|msg| compile_error = msg}
|
parse('/', :compile_error) {|e, msg| compile_error = msg}
|
||||||
assert_equal("unterminated regexp meets end of file", compile_error)
|
assert_equal("unterminated regexp meets end of file", compile_error)
|
||||||
end
|
end
|
||||||
end if ripper_test
|
end if ripper_test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define RUBY_VERSION "1.9.2"
|
#define RUBY_VERSION "1.9.2"
|
||||||
#define RUBY_PATCHLEVEL 140
|
#define RUBY_PATCHLEVEL 141
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
#define RUBY_VERSION_MINOR 9
|
#define RUBY_VERSION_MINOR 9
|
||||||
#define RUBY_VERSION_TEENY 1
|
#define RUBY_VERSION_TEENY 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue