aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* parse.y: reorder conditionsnobu2015-09-291-11/+4
| | | | | | | * 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
* parse.y: token lengthnobu2015-09-291-14/+16
| | | | | | | * 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
* parse.y: fix memory leaknobu2015-09-291-0/+9
| | | | | | | * 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
* * parse.y: fix minor typo. [ci skip][fix GH-1038].eregon2015-09-291-1/+1
| | | | | | Patch by @ltratt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: marknobu2015-09-291-0/+1
| | | | | | * 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
* fronzen-string-literal pragmanobu2015-09-271-2/+36
| | | | | | | | | | | | | * 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
* parse.y: fix tokennobu2015-09-241-2/+2
| | | | | | | * 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
* parse.y: simplify ripper_id2symnobu2015-09-191-1/+1
| | | | | | | | * 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
* parse.y: keep literal encodingnobu2015-09-101-2/+2
| | | | | | | | * 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
* parse.y: fix labelargnobu2015-08-181-2/+2
| | | | | | | * 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
* parse.y: fix block after conditionalnobu2015-08-171-22/+37
| | | | | | | | * 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
* parse.y: revert arg in r47649nobu2015-08-171-13/+3
| | | | | | * 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
* rb_parser_compile_*: remove volatile argnormal2015-08-111-7/+7
| | | | | | | | | | | | | | | 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
* parse.y: optional superclassnobu2015-08-111-12/+2
| | | | | | | * 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
* parse.y: shrink parser_paramsnobu2015-08-071-18/+19
| | | | | | | * 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
* parse.y: remove prefixesnobu2015-08-071-133/+135
| | | | | | * parse.y (parser_params): remove redundant prefixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: require pure parsernobu2015-08-071-14/+6
| | | | | | | * 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
* parse.y: pop cmdargnobu2015-07-231-0/+1
| | | | | | | * 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
* parse.y: call rb_intern2nobu2015-07-221-1/+1
| | | | | | | * 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
* parse.y (parser_initialize): avoid redundant zero-ingnormal2015-07-201-34/+2
| | | | | | | | | | | | | 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
* parse.y (ripper_initialize): fixup r51302normal2015-07-201-1/+1
| | | | | | | 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
* parse.y (struct parser_params): pack to 4 cache lines on x86-64normal2015-07-201-17/+17
| | | | | | | | | | | 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
* * parse.y: Improve duplicate key warning with patch by @andremedeiroszzak2015-07-091-2/+2
| | | | | | | [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
* * method.h: split rb_method_definition_t::flag to several flags.ko12015-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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
* parse.y: check NTH_REF rangenobu2015-05-291-5/+22
| | | | | | | | | | * 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
* allocate structs with wrappernobu2015-05-161-17/+7
| | | | | | | | | | | | | | * 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
* parse.y: refine message for gvar w/o identitirsnobu2015-05-131-2/+7
| | | | | | | * 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
* Revert "support ES6-like hash literals."shugo2015-05-081-72/+17
| | | | | | This reverts commit 0d3797f8b62394f5634f4b2b529d28cb46bebf8a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* support ES6-like hash literals.shugo2015-05-081-17/+72
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: %-string cannot be a labelnobu2015-04-301-3/+4
| | | | | | | * 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
* parse.y: push cmdarg_stacknobu2015-04-301-2/+7
| | | | | | | * 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
* parse.y: simplifiednobu2015-04-291-15/+15
| | | | | | | * 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
* compile.c: move expansion of massignnobu2015-04-291-19/+1
| | | | | | | | * 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
* parse.y: null by syntax errornobu2015-04-121-2/+2
| | | | | | | * 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
* parse.y: empty parennobu2015-03-131-2/+2
| | | | | | | * 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
* * internal.h: use T_IMEMO to represent `struct MEMO' value.ko12015-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* use rb_funcallvnobu2015-02-161-1/+1
| | | | | | | * 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
* parse.y: no optimization in defined?nobu2015-01-291-2/+2
| | | | | | | * 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
* parse.y: condition nodenobu2015-01-291-1/+0
| | | | | | * 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
* parse.y: optimize conditionsnobu2015-01-291-5/+43
| | | | | | | * 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
* parse.y: eliminate empty hashesnobu2015-01-091-13/+23
| | | | | | | | * 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
* parse.y: fix f_label resultnobu2015-01-041-2/+2
| | | | | | | * 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/trunk@49140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: disable past scope warningsnobu2014-12-311-8/+46
| | | | | | | | * 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/trunk@49082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: fix internal IDs conflictnobu2014-12-281-1/+3
| | | | | | | | | | * 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/trunk@49041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: warn past scope variablenobu2014-12-251-2/+25
| | | | | | | * 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
* parse.y: warn reference after method definitionnobu2014-12-141-0/+4
| | | | | | | | * 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
* parse.y: fix lex_state after tLABEL_ENDnobu2014-12-051-1/+1
| | | | | | | | * 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
* parse.y: preserve tSTRING_CONTENT resultsnobu2014-12-011-3/+6
| | | | | | | * 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
* parse.y: check single regexp onlynobu2014-12-011-4/+3
| | | | | | | | * 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
* parse.y: remove garbagenobu2014-12-011-1/+0
| | | | | | | * 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