summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2015-10-28parse.y: fix op_assign typenobu
* parse.y (new_attr_op_assign): fix op_assign type, which is already an ID since r52284. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-26parse.y: fix rippernobu
* parse.y (call_op, call_op2): fix values on ripper. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-26parse.y: call_op2nobu
* parse.y (call_op2): separate from call_op and also allow "::", while dot_or_colon should not allow ".?". [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23parse.y: canonical namenobu
* parse.y (parser_magic_comment): intern canonical name. InstructionSequence.compile_options are case-sensitive while pragma names are case-insensitive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23safe navigation attrsetnobu
* compile.c (iseq_compile_each): support safe navigation of simple attribute assignment. [Feature #11537] * parse.y (mlhs_node, lhs, attrset_gen): ditto. keep mid non-attrset as the sign of safe navigation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22Safe navigation operatornobu
* compile.c (iseq_peephole_optimize): peephole optimization for branchnil jumps. * compile.c (iseq_compile_each): generate save navigation operator code. * insns.def (branchnil): new opcode to pop the tos and branch if it is nil. * parse.y (NEW_QCALL, call_op, parser_yylex): parse token '.?'. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-21parse.y: magic comment w/o indicatorsnobu
* parse.y (parser_magic_comment): allow a sole magic comment without indicators, neither other non-space comments. [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-14parse.y: fix ripper warningsnobu
* parse.y (parser_nextc): send a warning to ripper, not to STDERR always. * parse.y (rb_warn1, rb_warning1): move argument conversions to callers. PRIsVALUE is not valid in String#%. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-12parse.y: move ripper_id2symnobu
* parse.y (new_attr_op_assign): move ripper_id2sym from each rules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29parse.y: reorder conditionsnobu
* parse.y (token_info_pop): scan lex buffer only when token info is enabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29parse.y: token lengthnobu
* parse.y (token_info_push, token_info_push): add token length parameter instead of strlen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29parse.y: fix memory leaknobu
* parse.y (parser_free): fix memory leak at syntax error when warn-indent is enabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29* parse.y: fix minor typo. [ci skip][fix GH-1038].eregon
Patch by @ltratt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29parse.y: marknobu
* parse.y (parser_mark): mark compile option hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-27fronzen-string-literal pragmanobu
* compile.c (iseq_compile_each): override compile option by option given by pragma. * iseq.c (rb_iseq_make_compile_option): extract a function to overwrite rb_compile_option_t. * parse.y (parser_set_compile_option_flag): introduce pragma to override compile options. * parse.y (magic_comments): new pragma "fronzen-string-literal". [Feature #8976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-24parse.y: fix tokennobu
* 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
2015-09-19parse.y: simplify ripper_id2symnobu
* parse.y (ripper_id2sym): remove unnecessary comparison as rb_ispunct has stricter condition, and cast explicitly to suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-10parse.y: keep literal encodingnobu
* 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/trunk@51820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-18parse.y: fix labelargnobu
* 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/trunk@51624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-17parse.y: fix block after conditionalnobu
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-17parse.y: revert arg in r47649nobu
* parse.y (arg): revert a part of r47649. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11rb_parser_compile_*: remove volatile argnormal
RB_GC_GUARD is sufficient to prevent tail call optimization from making the object invisible from GC., and we don't need to encourage more volatile usage. * parse.y (rb_parser_compile_cstr): remove volatile arg (rb_parser_compile_string): ditto (rb_parser_compile_file): ditto (rb_parser_compile_string_path): ditto (rb_parser_compile_file_path): ditto [ruby-core:70323] [Misc #11431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11parse.y: optional superclassnobu
* parse.y (superclass): make superclass rule optional and allow any contents without a terminator. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-07parse.y: shrink parser_paramsnobu
* parse.y (parser_params): turn in_def and in_single into bit flags and reduce the size by 2-words. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-07parse.y: remove prefixesnobu
* parse.y (parser_params): remove redundant prefixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-07parse.y: require pure parsernobu
* parse.y (yylex): non-pure parser has not been supported since merger of ripper. change argument types from void pointers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-23parse.y: pop cmdargnobu
* 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/trunk@51350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-22parse.y: call rb_intern2nobu
* parse.y (parse_ident): call rb_intern2 with the known length instead of strlen(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-20parse.y (parser_initialize): avoid redundant zero-ingnormal
TypedData_Make_Struct already initializes fields to zero by default, so there's no need to waste code re-zeroing them. Size reduction on 32-bit x86: text data bss dec hex filename 187231 2372 80 189683 2e4f3 parse.o.before 186939 2372 80 189391 2e3cf parse.o git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-20parse.y (ripper_initialize): fixup r51302normal
Missed eofp bitfield change in ripper_initialize in r51302 :x ("parse.y (struct parser_params): pack to 4 cache lines on x86-64") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-20parse.y (struct parser_params): pack to 4 cache lines on x86-64normal
This reduces the struct from 256 (from 288) bytes on my x86-64 system, allowing the struct to fit cleanly into 4 cache lines (if a malloc implementation allows it). * parse.y (struct parser_params): pack: 88 => 256 bytes on 64-bit [ruby-core:70034] [Feature #11371] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-09* parse.y: Improve duplicate key warning with patch by @andremedeiroszzak
[Fix GH-938] https://github.com/ruby/ruby/pull/938 [Bug #11327] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* method.h: split rb_method_definition_t::flag to several flags.ko1
`flag' contains several categories of attributes and it makes us confusion (at least, I had confused). * rb_method_visibility_t (flags::visi) * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0 * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1 * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2 * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3 * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits) * NOEX_BASIC -> basic (flags::basic, 1 bit) * NOEX_MODFUNC -> rb_scope_visibility_t in CREF * NOEX_SUPER -> MISSING_SUPER (enum missing_reason) * NOEX_VCALL -> MISSING_VCALL (enum missing_reason) * NOEX_RESPONDS -> BOUND_RESPONDS (macro) Now, NOEX_NOREDEF is not supported (I'm not sure it is needed). Background: I did not know what "NOEX" stands for. I asked Matz (who made this name) and his answer was "Nothing". "At first, it meant NO EXport (private), but the original meaning was gone." This is why I remove the mysterious word "NOEX" from MRI. * vm_core.h: introduce `enum missing_reason' to represent method_missing (NoMethodError) reason. * eval_intern.h: introduce rb_scope_visibility_t to represent scope visibility. It has 3 method visibilities (public/private/protected) and `module_function`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-29parse.y: check NTH_REF rangenobu
* 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/trunk@50671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16allocate structs with wrappernobu
* parse.y (rb_parser_new, ripper_s_allocate): allocate structs with making new wrapper objects and get rid of potential memory leak. * variable.c (rb_autoload): ditto. * ext/digest/digest.c (rb_digest_base_alloc): ditto. * ext/strscan/strscan.c (strscan_s_allocate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-13parse.y: refine message for gvar w/o identitirsnobu
* parse.y (parse_gvar): separate message for gvar without non-space characters from message for invalid identitirs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-08Revert "support ES6-like hash literals."shugo
This reverts commit 0d3797f8b62394f5634f4b2b529d28cb46bebf8a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-08support ES6-like hash literals.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-30parse.y: %-string cannot be a labelnobu
* parse.y (parser_yylex): %-string cannot be a label even if terminated by single/double quotes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-30parse.y: push cmdarg_stacknobu
* 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/trunk@50402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-29parse.y: simplifiednobu
* parse.y (primary): turned nested if-else blocks into a switch statement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-29compile.c: move expansion of massignnobu
* compile.c (iseq_compile_each): move expansion for massign to variable of for-loop from the parser, to reduce method calls on intermediate objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12parse.y: null by syntax errornobu
* 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/trunk@50265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-13parse.y: empty parennobu
* parse.y (primary): empty parentheses at cmdarg can be null. [ruby-core:68477] [Bug #10957] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* internal.h: use T_IMEMO to represent `struct MEMO' value.ko1
memo->v1 and memo->v2 is WB protected values. So use MEMO_V1/V2_SET() macros to set these values. memo->u3 is ambiguous (sometimes a VALUE, sometimes an integer value), so use gc_mark_maybe() in gc.c to mark it. Rename NEW_MEMO() to MEMO_NEW(). Move MEMO_FOR and NEW_MEMO_FOF macros from node.h. Export a rb_imemo_new() function for ext/ripper. * node.h: remove NODE_MEMO. * enum.c: catch up these change. * enumerator.c: ditto. * load.c: ditto. * ext/objspace/objspace.c (count_nodes): ditto. * gc.c (gc_mark_children): mark imemo_memo type. * parse.y (new_args_gen): use T_IMEMO. (I'm not sure it is working correctly...) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16use rb_funcallvnobu
* use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-29parse.y: no optimization in defined?nobu
* parse.y (logop_gen): no needs for optimization in defined? operator. literal conditions are optimized away eventually. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-29parse.y: condition nodenobu
* parse.y (logop_gen): keep non-null condition node. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-29parse.y: optimize conditionsnobu
* parse.y (new_if_gen, logop_gen): simplify constant conditional expressions to help the optimizer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-09parse.y: eliminate empty hashesnobu
* 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/trunk@49193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e