From 71f8ca8bc4131a1c3e638a3af7842f4176f1adc2 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 29 Jun 2007 06:27:49 +0000 Subject: * parse.y (assoc_list): remove expanded hash literal (no splat). * lib/webrick/httpstatus.rb (WEBrick::HTTPStatus::EOFError): adapt to new syntax. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++ lib/webrick/httpstatus.rb | 80 +++++++++++++++++++++++------------------------ parse.y | 11 ------- sample/test.rb | 17 +++++----- 4 files changed, 55 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00f37a1954..7958a0ec04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 29 14:51:24 2007 Yukihiro Matsumoto + + * parse.y (assoc_list): remove expanded hash literal (no splat). + + * lib/webrick/httpstatus.rb (WEBrick::HTTPStatus::EOFError): adapt + to new syntax. + Fri Jun 29 14:48:18 2007 Koichi Sasada * tool/insns2vm.rb, lib/vm/instruction.rb: move process body diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb index 0b22c992b3..a4b42f5a90 100644 --- a/lib/webrick/httpstatus.rb +++ b/lib/webrick/httpstatus.rb @@ -23,46 +23,46 @@ module WEBrick class EOFError < StandardError; end StatusMessage = { - 100, 'Continue', - 101, 'Switching Protocols', - 200, 'OK', - 201, 'Created', - 202, 'Accepted', - 203, 'Non-Authoritative Information', - 204, 'No Content', - 205, 'Reset Content', - 206, 'Partial Content', - 300, 'Multiple Choices', - 301, 'Moved Permanently', - 302, 'Found', - 303, 'See Other', - 304, 'Not Modified', - 305, 'Use Proxy', - 307, 'Temporary Redirect', - 400, 'Bad Request', - 401, 'Unauthorized', - 402, 'Payment Required', - 403, 'Forbidden', - 404, 'Not Found', - 405, 'Method Not Allowed', - 406, 'Not Acceptable', - 407, 'Proxy Authentication Required', - 408, 'Request Timeout', - 409, 'Conflict', - 410, 'Gone', - 411, 'Length Required', - 412, 'Precondition Failed', - 413, 'Request Entity Too Large', - 414, 'Request-URI Too Large', - 415, 'Unsupported Media Type', - 416, 'Request Range Not Satisfiable', - 417, 'Expectation Failed', - 500, 'Internal Server Error', - 501, 'Not Implemented', - 502, 'Bad Gateway', - 503, 'Service Unavailable', - 504, 'Gateway Timeout', - 505, 'HTTP Version Not Supported' + 100 => 'Continue', + 101 => 'Switching Protocols', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Request Range Not Satisfiable', + 417 => 'Expectation Failed', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported' } CodeToError = {} diff --git a/parse.y b/parse.y index 51c1b792c5..a76f30d15d 100644 --- a/parse.y +++ b/parse.y @@ -4326,17 +4326,6 @@ assoc_list : none $$ = dispatch1(assoclist_from_args, $1); %*/ } - | args trailer - { - /*%%%*/ - if (nd_type($1) == NODE_ARRAY && $1->nd_alen%2 != 0) { - yyerror("odd number list for Hash"); - } - $$ = $1; - /*% - $$ = dispatch1(assoclist_from_args, $1); - %*/ - } ; assocs : assoc diff --git a/sample/test.rb b/sample/test.rb index 18c914d5b3..bda0d1837c 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -750,12 +750,11 @@ test_ok($x == [1,2,3,1,2,3]) test_check "hash" $x = {1=>2, 2=>4, 3=>6} -$y = {1, 2, 2, 4, 3, 6} test_ok($x[1] == 2) test_ok(begin - for k,v in $y + for k,v in $x raise if k*2 != v end true @@ -769,19 +768,19 @@ test_ok($x.has_value?(4)) test_ok($x.values_at(2,3) == [4,6]) test_ok($x == {1=>2, 2=>4, 3=>6}) -$z = $y.keys.sort.join(":") +$z = $x.keys.sort.join(":") test_ok($z == "1:2:3") -$z = $y.values.sort.join(":") +$z = $x.values.sort.join(":") test_ok($z == "2:4:6") -test_ok($x == $y) +test_ok($x == $x) -$y.shift -test_ok($y.length == 2) +$x.shift +test_ok($x.length == 2) $z = [1,2] -$y[$z] = 256 -test_ok($y[$z] == 256) +$x[$z] = 256 +test_ok($x[$z] == 256) $x = Hash.new(0) $x[1] = 1 -- cgit v1.2.3