mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (args, mrhs): flattens literal array splats.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a10ded3ba0
commit
126297de15
2 changed files with 61 additions and 22 deletions
40
ChangeLog
40
ChangeLog
|
@ -1,24 +1,28 @@
|
|||
Tue Feb 12 16:18:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (args, mrhs): flattens literal array splats.
|
||||
|
||||
Tue Feb 12 15:27:19 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
|
||||
instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
|
||||
mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
|
||||
test/ruby/test_stringchar.rb: fixes arround String#gsub.
|
||||
instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
|
||||
mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
|
||||
test/ruby/test_stringchar.rb: fixes arround String#gsub.
|
||||
|
||||
|
||||
Tue Feb 12 15:11:47 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/json/lib/json/pure/generator.rb,
|
||||
ext/json/lib/json/pure/parser.rb, ext/openssl/lib/openssl/x509.rb,
|
||||
ext/win32ole/sample/olegen.rb, lib/date/format.rb, lib/irb/context.rb,
|
||||
lib/irb/workspace.rb, lib/net/http.rb, lib/net/imap.rb,
|
||||
lib/rdoc/generator.rb, lib/rdoc/markup/to_html.rb,
|
||||
lib/rdoc/markup/to_latex.rb, lib/rdoc/parsers/parse_c.rb,
|
||||
lib/rdoc/ri/formatter.rb, lib/rexml/parsers/baseparser.rb,
|
||||
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rss/parser.rb,
|
||||
lib/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.rb,
|
||||
lib/webrick/httpservlet/filehandler.rb, lib/yaml/baseemitter.rb,
|
||||
lib/yaml/encoding.rb: performance tuning arround String#gsub.
|
||||
ext/json/lib/json/pure/parser.rb, ext/openssl/lib/openssl/x509.rb,
|
||||
ext/win32ole/sample/olegen.rb, lib/date/format.rb, lib/irb/context.rb,
|
||||
lib/irb/workspace.rb, lib/net/http.rb, lib/net/imap.rb,
|
||||
lib/rdoc/generator.rb, lib/rdoc/markup/to_html.rb,
|
||||
lib/rdoc/markup/to_latex.rb, lib/rdoc/parsers/parse_c.rb,
|
||||
lib/rdoc/ri/formatter.rb, lib/rexml/parsers/baseparser.rb,
|
||||
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rss/parser.rb,
|
||||
lib/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.rb,
|
||||
lib/webrick/httpservlet/filehandler.rb, lib/yaml/baseemitter.rb,
|
||||
lib/yaml/encoding.rb: performance tuning arround String#gsub.
|
||||
|
||||
Tue Feb 12 12:16:45 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
|
@ -87,12 +91,12 @@ Mon Feb 11 17:21:18 2008 Kouhei Sutou <kou@cozmixng.org>
|
|||
0.2.3 -> 0.2.4.
|
||||
|
||||
* lib/rss/maker.rb, lib/rss/maker/, test/rss/test_maker_2.0.rb:
|
||||
fixed a bug that RSS::Maker.make("0.9")'s item doesn't make some
|
||||
elements if description is missed.
|
||||
Reported by Michael Auzenne. Thanks!!!
|
||||
fixed a bug that RSS::Maker.make("0.9")'s item doesn't make some
|
||||
elements if description is missed.
|
||||
Reported by Michael Auzenne. Thanks!!!
|
||||
|
||||
* lib/rss/maker/0.9.rb, test/rss/test_maker_0.9.rb:
|
||||
RSS::Maker.make("0.9") generates RSS 0.92 not RSS 0.91.
|
||||
RSS::Maker.make("0.9") generates RSS 0.92 not RSS 0.91.
|
||||
|
||||
Mon Feb 11 10:43:31 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
|
@ -126,7 +130,7 @@ Sun Feb 10 21:58:32 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
|||
Sun Feb 10 16:58:20 2008 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rubygems*, test/rubygems*, gem_prelude.rb: Import RubyGems
|
||||
* r1601. [ruby-core:15381]
|
||||
r1601. [ruby-core:15381]
|
||||
|
||||
Sun Feb 10 15:07:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
|
|
43
parse.y
43
parse.y
|
@ -369,6 +369,7 @@ static NODE *new_evstr_gen(struct parser_params*,NODE*);
|
|||
#define new_evstr(n) new_evstr_gen(parser,n)
|
||||
static NODE *evstr2dstr_gen(struct parser_params*,NODE*);
|
||||
#define evstr2dstr(n) evstr2dstr_gen(parser,n)
|
||||
static NODE *splat_array(NODE*);
|
||||
|
||||
static NODE *call_bin_op_gen(struct parser_params*,NODE*,ID,NODE*);
|
||||
#define call_bin_op(recv,id,arg1) call_bin_op_gen(parser, recv,id,arg1)
|
||||
|
@ -2445,7 +2446,13 @@ args : arg_value
|
|||
| args ',' arg_value
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = arg_append($1, $3);
|
||||
NODE *n1;
|
||||
if ((n1 = splat_array($1)) != 0) {
|
||||
$$ = list_append(n1, $3);
|
||||
}
|
||||
else {
|
||||
$$ = arg_append($1, $3);
|
||||
}
|
||||
/*%
|
||||
$$ = arg_add($1, $3);
|
||||
%*/
|
||||
|
@ -2453,7 +2460,14 @@ args : arg_value
|
|||
| args ',' tSTAR arg_value
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = arg_concat($1, $4);
|
||||
NODE *n1;
|
||||
if (nd_type($4) == NODE_ARRAY &&
|
||||
(n1 = splat_array($1)) != 0) {
|
||||
$$ = list_concat(n1, $4);
|
||||
}
|
||||
else {
|
||||
$$ = arg_concat($1, $4);
|
||||
}
|
||||
/*%
|
||||
$$ = arg_add_star($1, $4);
|
||||
%*/
|
||||
|
@ -2463,7 +2477,13 @@ args : arg_value
|
|||
mrhs : args ',' arg_value
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = arg_append($1, $3);
|
||||
NODE *n1;
|
||||
if ((n1 = splat_array($1)) != 0) {
|
||||
$$ = list_append(n1, $3);
|
||||
}
|
||||
else {
|
||||
$$ = arg_append($1, $3);
|
||||
}
|
||||
/*%
|
||||
$$ = mrhs_add(args2mrhs($1), $3);
|
||||
%*/
|
||||
|
@ -2471,7 +2491,14 @@ mrhs : args ',' arg_value
|
|||
| args ',' tSTAR arg_value
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = arg_concat($1, $4);
|
||||
NODE *n1;
|
||||
if (nd_type($4) == NODE_ARRAY &&
|
||||
(n1 = splat_array($1)) != 0) {
|
||||
$$ = list_concat(n1, $4);
|
||||
}
|
||||
else {
|
||||
$$ = arg_concat($1, $4);
|
||||
}
|
||||
/*%
|
||||
$$ = mrhs_add_star(args2mrhs($1), $4);
|
||||
%*/
|
||||
|
@ -7798,6 +7825,14 @@ arg_add_gen(struct parser_params *parser, NODE *node1, NODE *node2)
|
|||
}
|
||||
}
|
||||
|
||||
static NODE *
|
||||
splat_array(NODE* node)
|
||||
{
|
||||
if (nd_type(node) == NODE_SPLAT) node = node->nd_head;
|
||||
if (nd_type(node) == NODE_ARRAY) return node;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static NODE *
|
||||
node_assign_gen(struct parser_params *parser, NODE *lhs, NODE *rhs)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue