summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2016-08-16merge revision(s) 53424,55509: [Backport #12517]usa
* test/coverage/test_coverage.rb: ignored test when enabled to coverage. It lead to crash with `make test-all`. * compile.c (ADD_TRACE): ignore trace instruction on non-positive line. * parse.y (coverage): get rid of ArgumentError when the starting line number is not positive. [ruby-core:76141] [Bug #12517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10merge revision(s) 54893: [Backport #10763]usa
* parse.y (new_if_gen): set newline flag to NODE_IF to trace all if/elsif statements. [ruby-core:67720] [Bug #10763] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22merge revision(s) 54131: [Backport #8851]usa
* defs/keywords (alias, undef): symbol literals are allowed. * parse.y (parse_percent): should parse symbol literals for alias and undef. [ruby-dev:47681] [Bug #8851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22merge revision(s) 53834,53835,53836: [Backport #12073]usa
parse.y: simplify local ID condition * parse.y (tokenize_ident, parse_ident): ident in tokenize_ident() can be a local id only when called from parse_ident(), but never from parse_gvar() and parse_atmark(). * parse.y (parse_ident): allow keyword arguments just after a method where the same name local variable is defined. [ruby-core:73816] [Bug#12073] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-28merge revision(s) 54172: [Backport #12192]nagachika
* parse.y (parse_numvar): NTH_REF must be less than a half of INT_MAX, as it is left-shifted to be ORed with back-ref flag. [ruby-core:74444] [Bug#12192] [Fix GH-1296] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-14merge revision(s) 53411,53425: [Backport #11932]nagachika
* parse.y (regexp): set_yylval_num sets u1, should use nd_tag instead of nd_state. [ruby-core:72638] [Bug #11932] * parse.y (set_yylval_num): should be used as nd_state, set to u3. [ruby-core:72638] [Bug #11932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22merge revision(s) 53214,53215: [Backport #11849]nagachika
* parse.y (parser_yylex): allow here documents in labeled argument. [ruby-core:72396] [Bug #11849] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22merge revision(s) 53092,53093: [Backport #11812] [Backport #11833]nagachika
* parse.y (parse_percent): Allow %-literals in labeled arg as r51624 did for parentheses. Fixes [ruby-core:72084] [Bug #11812]. * test/ruby/test_syntax.rb: fix typo in test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01merge revision(s) 52777: [Backport #11748]nagachika
* parse.y (parser_here_document): store dispatched result of on_tstring_content at the last fragment of a here document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-27merge revision(s) 51820: [Backport #11519]nagachika
* parse.y (literal_concat_gen, evstr2dstr_gen): keep literal encoding beginning with an interpolation same as the source file encoding. [ruby-core:70703] [Bug #11519] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24merge revision(s) 52461: [Backport #11663]nagachika
* parse.y (kwd_append): fix segv after invalid keyword argument, preceding keyword list is NULL when syntax error is there. [ruby-core:71356] [Bug #11663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05merge revision(s) 50409,51616,51617,51624: [Backport #10653] [Backport #11456]nagachika
parse.y: %-string cannot be a label * parse.y (parser_yylex): %-string cannot be a label even if terminated by single/double quotes. * parse.y: fix syntax error at do-block after a conditional operator. separate label-allowed and after-a-label states from others as bit flags. [ruby-dev:48790] [Bug #10653] * parse.y (IS_BEG): include labeled argument state, which was EXPR_LABELARG. [ruby-dev:49221] [Bug #11456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-10merge revision(s) 51350: [Backport #11380] [Backport #11389]nagachika
* parse.y (lambda_body): pop cmdarg stack for lookahead token. [ruby-core:70067] [Bug #11380] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03merge revision(s) 50671: [Backport #11192]nagachika
* compile.c (iseq_compile_each): out of range NTH_REF is always nil. * parse.y (parse_numvar): check overflow of NTH_REF and range. [ruby-core:69393] [Bug #11192] * util.c (ruby_scan_digits): make public and add length parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-13merge revision(s) 50402: [Backport #11107]nagachika
* parse.y (lambda): push and reset cmdarg_stack in lambda body. [ruby-core:69017] [Bug #11107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12merge revision(s) 49964,50265: [Backport #11047] [Backport #10957]nagachika
* parse.y (primary): empty parentheses at cmdarg can be null. [ruby-core:68477] [Bug #10957] * parse.y (arg): fix segfault by null caused by syntax error. [ruby-core:68851] [Bug #10957] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05merge revision(s) 49082: [Backport #10661]naruse
* parse.y (gettable_gen): disable warnings of possible reference to a local variable defined in a past scope. [ruby-core:67162] [Bug #10661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-17merge revision(s) 49193: [Backport #10719]naruse
* parse.y (assocs, assoc): eliminate splatting empty literal hashes. [ruby-core:67446] [Bug #10719] * compile.c (compile_array_): supprt splatted hash in hash type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-16merge revision(s) 49140: [Backport #10693]naruse
* parse.y (f_label): return tLABEL value as it is. [ruby-core:67315] [Bug #10693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-31merge revision(s) 49041: [Backport #10659]naruse
* parse.y (f_kwrest, new_args_tail_gen): unnamed rest keyword and keywords bits arguments should be unique. since internal IDs depend on the local variable index in the current scope, new ID should be made before popping those vtables. [ruby-core:67157] [Bug #10659] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25parse.y: warn past scope variablenobu
* parse.y (gettable_gen): warn possible reference to a local variable defined in a past scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-14parse.y: warn reference after method definitionnobu
* parse.y (primary): restore current_arg so that circular reference after a method definition is also warned. [ruby-core:61299] [Bug #9593] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-05parse.y: fix lex_state after tLABEL_ENDnobu
* parse.y (parser_yylex): fix lex_state after tLABEL_END, should be EXPR_LABELARG to be followed by "paren with arg". [ruby-core:66705] [Feature #4935] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01parse.y: preserve tSTRING_CONTENT resultsnobu
* parse.y (ripper_flush_string_content): preserve the dispatched results at tSTRING_CONTENT. [ruby-dev:48714] [Bug #10437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01parse.y: check single regexp onlynobu
* parse.y (regexp_contents): check in ripper only if the whole content is a single regexp without interpolation. [ruby-dev:48714] [Bug #10437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01parse.y: remove garbagenobu
* parse.y (parser_magic_comment): remove a garbage line inserted at previous ripper fix, r48668. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01parse.y: enable encoding pragma in rippernobu
* parse.y (magic_comment_encoding): enable in ripper, since the encoding is necessary to parse non-default encoding scripts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01use 0 for reservednobu
use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-30parse.y: fix a typonobu
* parse.y (regexp_contents): fix a typo. pointed out by wanabe. [ruby-dev:48741] [Bug #10543] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-26parse.y: fix invalid keyword argumentnobu
* parse.y (f_label, f_kw, formal_argument_gen): ignore invalid formal argument in keyword argument definition. [ruby-dev:48742] [Bug #10545] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-23parse.y: replace with TOK_INTERNnobu
* parse.y (parse_gvar): replace with equivalent macro, TOK_INTERN, as well as other places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19parse.y: shrink parser_paramsnobu
* parse.y (struct parser_params): reduce size by reordering members and an unused member. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19parse.y: regexp error in rippernobu
* parse.y (ripper_flush_string_content, parser_parse_string): preserve parsed string content. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19parse.y: ripper_new_yylvalnobu
* parse.y (ripper_new_yylval): abstract function to create ripper wrapper, and make it able to hold another object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19parse.y: predefined IDnobu
* parse.y (reg_named_capture_assign_gen): use predefined ID instead of rb_intern. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19parse.y: append directly to delayed contentnobu
* parse.y (parser_here_document): append byte sequence directly to the delayed content instead of creating an intermediate string object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18parse.y: fix literal symbol list node typenobu
* parse.y (symbol_list): fix the node type of literal symbol list with no interpolation. [ruby-core:66343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* rewrite method/block parameter fitting logic to optimizeko1
keyword arguments/parameters and a splat argument. [Feature #10440] (Details are described in this ticket) Most of complex part is moved to vm_args.c. Now, ISeq#to_a does not catch up new instruction format. * vm_core.h: change iseq data structures. * introduce rb_call_info_kw_arg_t to represent keyword arguments. * add rb_call_info_t::kw_arg. * rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num. * rename rb_iseq_t::arg_keywords to arg_keyword_num. * rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits. to represent keyword bitmap parameter index. This bitmap parameter shows that which keyword parameters are given or not given (0 for given). It is refered by `checkkeyword' instruction described bellow. * rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest to represent keyword rest parameter index. * add rb_iseq_t::arg_keyword_default_values to represent default keyword values. * rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE to represent (ci->flag & (SPLAT|BLOCKARG)) && ci->blockiseq == NULL && ci->kw_arg == NULL. * vm_insnhelper.c, vm_args.c: rewrite with refactoring. * rewrite splat argument code. * rewrite keyword arguments/parameters code. * merge method and block parameter fitting code into one code base. * vm.c, vm_eval.c: catch up these changes. * compile.c (new_callinfo): callinfo requires kw_arg parameter. * compile.c (compile_array_): check the last argument Hash object or not. If Hash object and all keys are Symbol literals, they are compiled to keyword arguments. * insns.def (checkkeyword): add new instruction. This instruction check the availability of corresponding keyword. For example, a method "def foo k1: 'v1'; end" is cimpiled to the following instructions. 0000 checkkeyword 2, 0 # check k1 is given. 0003 branchif 9 # if given, jump to address #9 0005 putstring "v1" 0007 setlocal_OP__WC__0 3 # k1 = 'v1' 0009 trace 8 0011 putnil 0012 trace 16 0014 leave * insns.def (opt_send_simple): removed and add new instruction "opt_send_without_block". * parse.y (new_args_tail_gen): reorder variables. Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)" has parameter variables "k1, kr1, k2, &b, internal_id, krest", but this patch reorders to "kr1, k1, k2, internal_id, krest, &b". (locate a block variable at last) * parse.y (vtable_pop): added. This function remove latest `n' variables from vtable. * iseq.c: catch up iseq data changes. * proc.c: ditto. * class.c (keyword_error): export as rb_keyword_error(). * common.mk: depend vm_args.c for vm.o. * hash.c (rb_hash_has_key): export. * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01parse.y: separate error messagesnobu
* parse.y (parse_atmark): separate error messages for sigil types, and make more descriptive git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-01parse.y: invalid instance/class variable namesnobu
* parse.y (parse_atmark): mere atmark and two atmarks without succeeding identifiers are invalid as instance/class variable names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29parse.y: reset current_arg after block varnobu
* parse.y (block_param_def): reset current_arg after block parameter definition, not to warn references in that block body. [ruby-core:65990] [Bug #10314] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29parse.y: warn iside a blocknobu
* parse.y (gettable_gen): also warn circular argument reference even inside a block. [ruby-core:65990] [Bug #10314] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29parse.y: warn circular argument referencenobu
* parse.y (gettable_gen): warn circular argument reference, for transition from 2.1 and earlier. [ruby-core:65990] [Bug #10314] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29parse.y: unused membernobu
* parse.y (parser_params): remove unused member `cur_mid`. this has been taken over by `in_def` since 1.6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27ripper/tools/generate.rb: shorten generated sourcenobu
* ext/ripper/tools/generate.rb (generate_eventids1): shorten generated source. * ext/ripper/tools/generate.rb (generate_eventids2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27id.h.tmpl: ANDOP and OROPnobu
* template/id.h.tmpl (token_op_ids): define && and || for ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27parse.y: optimize IDs in rippernobu
* parse.y: optimize ripper_intern calls, ::, **, -@, +@, <=>, >=, <=, ==, ===, !=, =~, !~, <<, >>, and call. * parse.y: use initialized IDs, warn and warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-26parse.y: Ripper.sexp returns errornobu
* ext/ripper/lib/ripper/sexp.rb (Ripper.sexp, Ripper.sexp_raw): return nil on error. [ruby-dev:48678] [Bug #10405] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-24parse.y: fix fluent interface identifiernobu
* parse.y (parser_yylex): dispatch newline and space at fluent interface, so that the following identifier does not include the space. [ruby-dev:48684] [Bug #10411] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-24parse.y: indentnobu
* parse.y (parser_yylex): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e