summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2016-10-22parse.y: append to buffernobu
* parse.y (reg_compile_gen): always append error message to the error buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01compile.c: literal rangenobu
* compile.c (iseq_compile_each): move numeric literal range optimization from fixup_nodes() in parse.y. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-29parse.y: deferred_dots_gennobu
* parse.y (deferred_dots_gen): extract for tDOT2 and tDOT3. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27parse.y: fix up r56198nobu
* parse.y (symbol, dsym, parser_set_number_literal): set state to ENDARG, so that `do` after a literal should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] * parse.y (parse_ident): revert r56198. * parse.y (warn_balanced): the state of symbol and numeric literals is now EXPR_ENDARG, do not exclude it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: preserve cmdarg_stacknobu
* parse.y (brace_body, do_body): preserve cmdarg_stack so that `do` after cmdarg in a block should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: do after cmdarg in parennobu
* parse.y: `do` after cmdarg in parentheses should be `do_block` and bound to the outer method. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: remove spaces [ci skip]nobu
* parse.y (cmd_brace_block, do_block): remove spaces before tab in indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21parse.y: block bodiesnobu
* parse.y (brace_body, do_body): extract block bodies. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: heredoc tokennobu
* parse.y (parser_heredoc_identifier): gather branches by quote char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: STR_TERM_ENDnobu
* parse.y (parser_parse_string): store the end of string literal mark in nd_term instead of nd_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: parser_string_termnobu
* parse.y (parser_string_term): return the token of string or regexp literal terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: reset indent in heredoc_dedentnobu
* parse.y (parser_heredoc_dedent): reset heredoc_indent and return the dedented node. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: new_string1nobu
* parse.y (new_string1): extract from the rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: new_xstring_gennobu
* parse.y (new_xstring_gen): extract from the rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26parse.y: new_regexp_gennobu
* parse.y (new_regexp_gen): extract from the rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-19parse.y: lparen_arg statementnobu
* parse.y (primary): allow parenthesised statement as a method argument. [Feature #12686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13parse.y: chained assignmentsnobu
* parse.y (command_asgn, arg): fix syntax errors with chained assignment with op assign. [Bug #12669] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13parse.y: rescue modifier in rhs of op asgnnobu
* parse.y (stmt, arg): rescue modifier in command op assignment should be limited to rhs only. [ruby-core:75621] [Bug #12402] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12parse.y: const_decl_gennobu
* parse.y (const_decl_gen): extract as a function as well as ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12parse.y: assign_errornobu
* parse.y (assign_error_gen): [ripper] rename without backref. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11parse.y: node_assignnobu
* parse.y (stmt, command_asgn): unifiy parser and ripper code by node_assign macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11parse.y: backref_assign_errornobu
* parse.y (backref_assign_error): unify parser and ripper code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11parse.y: const declaration macronobu
* parse.y (const_decl): unify parser and ripper code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11parse.y: const field macrosnobu
* parse.y (const_path_field, top_const_field): unify parser and ripper code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10parse.y: rhs with rescue modifiernobu
* parse.y (command_rhs, arg_rhs): introduce new rules to reduce repeated rules with rescue modifier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10parse.y: rescue modifier in rhsnobu
* parse.y (command_asgn): rescue modifier in command assignment should be limited to rhs only. [ruby-core:75621] [Bug #12402] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03parse.y: reg_fragment_enc_errornobu
* parse.y (reg_fragment_enc_error): compile_error is different between parser and ripper. [ruby-core:76397] [Bug #12651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-26Coverage on non-positive linesnobu
* 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/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13parse.y: no named capture conflict warningsnobu
* parse.y (reg_named_capture_assign_iter): remove named capture conflict warnings. it is just annoying rather than useful. [ruby-core:75416] [Bug #12359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03parse.y: trace elsifnobu
* 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/trunk@54893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20error.c: SyntaxError#initializenobu
* error.c (syntax_error_initialize): move the default message, "compile error", from parse.y. the default parameter should belong to the class definition. * parse.y (yycompile0): use the default parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20refactor syntax errornobu
* compile.c (append_compile_error): use rb_syntax_error_append. * error.c (rb_syntax_error_append): append messages into a SyntaxError exception instance. * parse.y (yycompile0): make new SyntaxError instance in main mode, otherwize error_buffer should be a SyntaxError if error has occurred. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19refactor parser errornobu
* error.c (err_vcatf): rename, and separate appending message from creating a string buffer. * error.c (rb_syntax_error_append): merge rb_error_vsprintf and rb_compile_err_append. * parse.y (parser_compile_error): use rb_syntax_error_append. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13parse.y: massign in condnobu
* parse.y (assign_in_cond): allow multiple assignment in conditional expression. [Feature #10617] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-30parse.y: get rid of ISASCII on IDnobu
* parse.y (ripper_id2sym): do not call ISASCII() on ID, rb_isascii is restricted to int now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-28remove rb_thread_t::parse_in_evalnobu
* parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23remove SIGN_EXTEND_CHAR macronobu
* marshal.c (r_long): cast to `signed char`, which is used already, instead of SIGN_EXTEND_CHAR. * parse.y: SIGN_EXTEND_CHAR is no longer used. [Fix GH-1302] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-22parse.y: lambda indentation checknobu
* parse.y (lambda_body, parser_yylex): warn mismatched indentation of lambda block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19SyntaxError message at iseq compilenobu
* iseq.c (rb_iseq_compile_with_option): make the parser in mild error. * load.c (rb_load_internal0): ditto. * parse.y (yycompile0): return the error message within the error to be raised. [Feature #11951] * parse.y (parser_compile_error): accumulate error messages in the error_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18parse.y: mark debug_buffernobu
* parse.y (parser_mark): mark debug_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18parse.y: Fix for nth_ref_maxnobu
* 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/trunk@54172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16parse.y: symbol literals for alias/undefnobu
* 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/trunk@54131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14optimize named capture assignmentnobu
* compile.c (compile_named_capture_assign): optimize named capture assignments, by replacing repeating global variable accesses with `dup`, and by returning the matched result instead of re-getting it from the MatchData. * parse.y (reg_named_capture_assign_gen): build just assignment nodes for the optimization. ex. `/(?<x>.)/ =~ "bar"` - old ``` 0000 putstring "bar" 0002 opt_regexpmatch1 /(?<x>.)/ 0004 pop 0005 getglobal $~ 0007 branchunless 25 0009 getglobal $~ 0011 putobject :x 0013 opt_aref <callinfo!mid:[], argc:1, ARGS_SIMPLE> 0016 setlocal_OP__WC__0 2 0018 getglobal $~ 0020 putobject_OP_INT2FIX_O_0_C_ 0021 opt_send_without_block <callinfo!mid:begin, argc:1, ARGS_SIMPLE> 0024 leave 0025 putobject nil 0027 setlocal_OP__WC__0 2 0029 putobject nil 0031 leave ``` - new ``` 0000 putstring "bar" 0002 opt_regexpmatch1 /(?<x>.)/ 0004 getglobal $~ 0006 dup 0007 branchunless 14 0009 putobject :x 0011 opt_aref <callinfo!mid:[], argc:1, ARGS_SIMPLE> 0014 setlocal_OP__WC__0 2 0016 leave ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-13parse.y: adjust indentnobu
* parse.y: adjust indent and tabify spaces after tabs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-10iseq.h: coverage_enabled flagnobu
* iseq.c (prepare_iseq_build): enable coverage by coverage_enabled option, not by parse_in_eval flag in the thread context. * iseq.h (rb_compile_option_struct): add coverage_enabled flag. * parse.y (yycompile0): set coverage_enabled flag if coverage array is made. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-05parse.y: optimize negate_litnobu
* parse.y (negate_lit): optimize bignum, rational, and complex negation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-03parse.y: split nextcnobu
* parse.y (parser_nextline, parser_cr): split less frequent paths from parser_nextc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-03parse.y: cr_seen flagnobu
* parse.y (parser_params): turn last_cr_line into cr_seen flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24parse without $.nobu
* io.c (rb_io_gets_internal): read one line from an IO without setting ARGF.lineno. * parse.y (lex_io_gets): use rb_io_gets_internal not to affect $. global variable. * ruby.c (load_file): no longer reset $. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e