Граф коммитов

1465 Коммитов

Автор SHA1 Сообщение Дата
nobu 99871095e6 parse.y: brace after literal arg
* parse.y (symbol, dsym, parser_set_number_literal, parser_yylex):
  set state to END too not only ENDARG and after a literal, so
  that a left brace after it should be a primary block bound to
  the literal, which causes syntax error.
  [ruby-core:81037] [Bug #13547]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:20:00 +00:00
nobu 046c94380b parse.y: do after cmdarg in paren
* parse.y (parser_yylex): set state to ENDARG after a string
  literal, so that `do` after a literal should be `do_block` and
  bound to the outer method, as well as a numeric/symbol literal.
  [ruby-core:72482] [Bug #11873]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 17:12:43 +00:00
nobu ac08e59b02 parse.y: export rb_parser_fatal for ripper
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 14:03:52 +00:00
nobu 9133f6648d parse.y: make shared string modifiable
* parse.y (dedent_string): ensure that the string is modifiable,
  not to set the length of shared string.
  [ruby-core:80987] [Bug #13540]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-04 06:54:11 +00:00
nobu 191be8057d parse.y: set_line_body is not used in ripper
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-28 09:50:43 +00:00
nobu 7d085cca4b parse.y: fix line in rescue
* parse.y (set_line_body, primary): fix line number of bodystmt as
  the beginning of the block.  [ruby-core:79388] [Bug #13181]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-28 08:06:33 +00:00
nobu 80f5067478 parse.y: args tail at error
* parse.y (new_args_tail_gen): abandon parsing arguments after
  error.  reported by ilsani Martino Sani (ilsani) at
  https://hackerone.com/reports/221201

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24 06:17:55 +00:00
nobu 7c23609e60 parse.y: rb_parser_fatal
* parse.y (rb_parser_fatal): abort compilation on internal parser
  error.  rb_bug() is generic use but not useful for debugging the
  parser.  this function dumps internal states, and continues with
  enabling yydebug output to stderr for the parser stack dump.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24 06:17:54 +00:00
nobu 5b3c9fc962 Get rid of unnecessary GCC extension
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24 04:20:02 +00:00
nobu 27ed9f1d29 parse.y: fix compile_error format
* parse.y (ripper_compile_error, parser_compile_error): declare as
  PRINTF_ARGS attribute.

* parse.y (id_is_var_gen): fix format specifier for string value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-22 08:32:33 +00:00
nobu 158c742b51 parse.y: fix for empty `__VA_ARGS__`
* parse.y (WARN_CALL, WARNING_CALL): need `##` between a comman
  and `__VA_ARGS__` in the case it is empty, not to end arguments
  with a comma.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 01:35:54 +00:00
nobu 0472578b26 ruby.h: check argc to rb_funcall
* include/ruby/ruby.h (rb_funcall): check if argc matches the
  number of variadic arguments, and replace with rb_funcallv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-15 02:09:27 +00:00
nobu 733f6496e4 parse.y: ID for logop
* parse.y (logop): use ID instead of token values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-05 00:12:43 +00:00
nobu 6b43aa5f67 parse.y: use idGE for tGEQ
* parse.y (arg): use ID directly for '>=' operator, without
  TOKEN2ID macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-04 23:42:00 +00:00
nobu e317813625 parse.y: share with ripper
* parse.y (rb_parser_trace_lex_state, rb_parser_show_bitstack):
  share with ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-04 14:19:04 +00:00
nobu 3672fc84a4 parse.y: flush debug buffer
* parse.y (rb_parser_trace_lex_state, rb_parser_show_bitstack):
  flush debug buffer before traces of lex_state and bitstack.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-04 14:13:46 +00:00
nobu b6639a8409 parse.y: dot_or_colon
* parse.y (dot_or_colon): use the default action without type
  casts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-29 05:54:14 +00:00
nobu cb64ef240b parse.y: unterminated content token
* parse.y (parser_parse_string): defer the end token to next
  reading, to yield tSTRING_CONTENT with the unterminated content.
  [Bug #13363]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 07:13:43 +00:00
nobu e5600caf2c keep line number after unterminated string literal
* parse.y (parser_parse_string): keep line number even after an
  unterminated string literal.  it does not matter in the parser,
  ripper needs this value after this error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 01:07:35 +00:00
nobu 8179835101 parse.y: relax `&' warning
* parse.y (parser_yylex): disable "`&' interpreted as argument
  prefix" warning when just followed by a symbol literal.
  [ruby-core:79926] [Misc #13283]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 08:38:12 +00:00
nobu 249fd9e0b7 parse.y: remove trace
* parse.y (reg_named_capture_assign_iter): do not insert trace
  instructions before local variable assinments.  putobject is
  expected at first.  [ruby-core:79940] [Bug #13287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-07 10:56:22 +00:00
nobu 9b1f2b073f kwrest arg name
* compile.c (iseq_set_arguments_keywords): make keyword rest
  argument name nd_vid consistently, regardless of whether other
  keyword arguments are present.  [Fix GH-1529]

* parse.y (new_args_tail_gen): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-27 13:52:07 +00:00
nobu 6c0f395c01 parse.y: indent at invalid identifier
* parse.y (parser_heredoc_identifier): set indent only when valid
  identifier, not to dedent non-existent contents later.
  [ruby-core:79772] [Bug #13253]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-26 00:33:06 +00:00
naruse c022a09773 Cast as VALUE to suppress type warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 10:59:10 +00:00
naruse 1220638f5b They are enum yytokentype, need cast
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 10:59:09 +00:00
nobu f28de8c06a parse.y: new_qcall
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 05:35:57 +00:00
nobu 35ac7cc09f parse.y: ID2VAL
* parse.y (ID2VAL): split from TOKEN2VAL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20 05:35:56 +00:00
nobu 425d52df7e parse.y: ripper_intern is no longer used
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-12 08:43:43 +00:00
nobu 2c51dc5053 parse.y: logop
* defs/id.def (predefined): add keywords `and` and `or`.

* parse.y (log_op): unify parser and ripper, and use tokens
  instead of node types and symbols.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-12 08:33:33 +00:00
nobu 737d6f3680 parse.y: call_bin_op
* parse.y (call_bin_op): unify parser and ripper, and use IDs
  instead of tokens.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-12 04:23:16 +00:00
nobu a062d030eb parse.y: call_uni_op
* defs/id.def (predefined): add keyword `not`.

* parse.y (call_uni_op): unify parser and ripper, and use IDs
  instead of tokens.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-12 04:20:35 +00:00
nobu 549a3b74c4 ripper: fix %-op on_operator_ambiguous
* parse.y (ambiguous_operator): separate token and string
  representation of operators, to fix %-operator argument.  in a
  warning message, needs to be escaped by '%' but the symbol
  should not be.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-12 03:15:34 +00:00
nobu 58e97c4e6d parse.y: TOKEN2ID
* parse.y (TOKEN2ID): add macro which maps static tokens to IDs.

* template/id.h.tmpl (TOKEN2*ID, DEFINE_*ID_FROM_TOKEN): separate
  into macros, token to ID mapping and enum definitions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11 02:14:06 +00:00
nobu 715094c2de parse.y: fix idCOLON2
* defs/id.def: remove idDSTAR and idCOLON3.

* parse.y (tCOLON2): make same as id.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-09 07:53:52 +00:00
nobu b4ac19f743 parse.y: named caputre into match_op_gen
* parse.y (match_op_gen): move making named capture assignment
  nodes.  remove repeated conditions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-08 07:06:37 +00:00
nobu 7bf450d0c3 parse.y (parser_yylex): remove wrong warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-24 07:52:41 +00:00
nobu 0ec889d7ed parse.y: rescue/else/ensure in do-end
* parse.y (do_body): allow rescue/else/ensure inside do/end
  blocks.  [Feature #12906]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19 09:54:58 +00:00
nobu af9a151f0b parse.y: chomp by -l
* parse.y (rb_parser_while_loop): should chomp but not chop by -l
  option.  [ruby-core:78099] [Bug #12926]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19 07:18:23 +00:00
nobu 6dccc53368 parse.y: warn space
* parse.y (parser_yylex): warn parentheses after space.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19 01:38:59 +00:00
nobu b4aa884f06 parse.y: preserve cmdarg stack
* parse.y (do_body): preserve cmdarg stack around do/end block.
  [ruby-core:78837] [Bug #13073]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26 13:31:03 +00:00
nobu 9c89812664 fix r57089
* parse.y (parser_heredoc_identifier): fix multiline here document
  identifier condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-16 22:57:01 +00:00
nobu d25faa4ed2 multiline heredoc identifier
* parse.y (parser_heredoc_identifier): reject multiline here
  document identifier, which never matches single line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-16 01:27:47 +00:00
nobu 2d6538a7c8 parse.y: newline in heredoc identifier
* parse.y (parser_heredoc_identifier): warn newline in here
  document identifier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-15 12:58:59 +00:00
nobu b53456731e parse.y: one warning, one line [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-15 06:22:09 +00:00
nobu 07e7981d42 parse.y: curtail scanning
* parse.y (parser_yyerror): curtail scanning range, not to exceed
  the max margin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-14 07:30:41 +00:00
nobu bc44acb5a3 parse.y: fix yyerror message
* parse.y (parser_yyerror): show the error line even if the error
  is at the end.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-14 04:35:28 +00:00
nobu 7e8b910a56 parse.y: zero codepoints
* parse.y (parser_tokadd_utf8): relax restriction to allow zero or
  more codepoints.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-11 09:20:27 +00:00
nobu 510f0ec869 parse.y: ripper generic input
* parse.y (ripper_initialize): allow generic input as source, if
  it has #gets method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08 00:45:13 +00:00
nobu 8130ee5c9d parse.y: simplify parsing utf-8 string
* parse.y (parser_tokadd_codepoint): move error checks and add
  char.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-02 03:33:54 +00:00
nobu 80045bc2a9 parse.y: relax spaces
* parse.y (parser_tokadd_utf8): relax restriction spaces inside
  "\u{...}".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-02 02:47:11 +00:00
nobu 74495cfa11 parse.y: reject invalid codepoint
* parse.y (parser_tokadd_codepoint): reject invalid codepoint,
  surrogate blocks and surrogate pair, as well as mruby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01 08:26:39 +00:00
nobu 88b745f0ca parse.y: refine error message
* parse.y (parser_tokadd_utf8): refine error message at bad char
  in unicode escape, "invalid" instead of "unterminated".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 14:43:43 +00:00
nobu 5e4b845522 parse.y: parser_tokadd_codepoint
* parse.y (parser_tokadd_codepoint): extract from
  parser_tokadd_utf8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 13:09:51 +00:00
nobu 94715bc666 parse.y: brace constants
* parse.y (parser_tokadd_utf8): make open/close braces constant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 13:09:50 +00:00
nobu 22c0994bc8 parse.y: no warning for lambda
* parse.y (parser_yylex): do not warn parentheses of lambda
  argument list, because there is no name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 01:40:11 +00:00
nobu 65e27c8b13 parse.y: ambiguous parentheses
* parse.y (parser_yylex): warn ambiguous parentheses after a space
  in method definitions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29 10:47:43 +00:00
nobu 4992c02095 parse.y: warn ? followed by a word
* parse.y (parse_qmark): warn `?` with unbalanced space, which is
  interpreted as a conditional operator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22 23:32:44 +00:00
nobu 3c93545a16 Revert r56856
* parse.y: tCHAR can be concatenated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21 22:45:26 +00:00
nobu 41d9e6dd54 parse.y: tCHAR cannot be concatenated
* parse.y (strings): tCHAR is not a subject of string literal
  concatenation and string interpolation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21 03:13:59 +00:00
nobu 04a4fd8957 parse.y: new_attr_op_assign in ripper needs symbol
* parse.y (command_asgn, arg): new_attr_op_assign in ripper
  expects a Symbol VALUE as the operator, not an ID, so convert
  literal IDs to Symbols.  [ruby-core:78069] [Bug #12916]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10 07:47:44 +00:00
nobu 8a5512b4bf parse.y: fix restored cmdarg_stack
* parse.y (brace_body, do_body): since cmdarg_stack is saved in
  VALUE val, should restore from the same member.  on big-endian
  platforms where VALUE is larger than int, it restored 0 in the
  upper word.  [ruby-core:77920] [Bug #12900]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 05:17:22 +00:00
nobu e981862fc9 parse.y: !-operator warning
* parse.y (cond0): !-operator is a method call, no warning for
  literal in condition.  [ruby-core:77801] [Bug #12881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29 10:59:39 +00:00
nobu 2adba2dc5e parse.y: append to buffer
* 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-22 14:33:58 +00:00
nobu 1b94420174 compile.c: literal range
* 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-10-01 13:17:51 +00:00
nobu 46bbb62bed parse.y: deferred_dots_gen
* 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-29 11:33:03 +00:00
nobu 3d2e45d319 parse.y: fix up r56198
* 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-27 14:22:33 +00:00
nobu f4ac0d75d9 parse.y: preserve cmdarg_stack
* 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-21 04:47:35 +00:00
nobu c924e2db96 parse.y: do after cmdarg in paren
* 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-21 04:38:46 +00:00
nobu b458aef0f0 parse.y: remove spaces [ci skip]
* 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-21 04:36:32 +00:00
nobu 7b4b01bf05 parse.y: block bodies
* 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-09-21 04:32:03 +00:00
nobu 0783f55cf8 parse.y: heredoc token
* 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-26 23:26:03 +00:00
nobu 70da28c185 parse.y: STR_TERM_END
* 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-26 15:11:32 +00:00
nobu 49b884941a parse.y: parser_string_term
* 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-26 15:07:51 +00:00
nobu 504908996c parse.y: reset indent in heredoc_dedent
* 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-26 08:29:23 +00:00
nobu dcaeea4f6b parse.y: new_string1
* 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-26 08:29:22 +00:00
nobu cb1ebf84cc parse.y: new_xstring_gen
* 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-26 08:29:18 +00:00
nobu 1451785609 parse.y: new_regexp_gen
* 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-26 08:29:17 +00:00
nobu ec8f8fa4c8 parse.y: lparen_arg statement
* 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-19 02:39:09 +00:00
nobu 90d9255ec2 parse.y: chained assignments
* 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-13 02:10:11 +00:00
nobu 5245e31426 parse.y: rescue modifier in rhs of op asgn
* 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-13 01:52:22 +00:00
nobu d63802b375 parse.y: const_decl_gen
* 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-12 03:29:50 +00:00
nobu 777f15a3b2 parse.y: assign_error
* 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-12 03:29:49 +00:00
nobu c93875e6e3 parse.y: node_assign
* 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-11 02:32:19 +00:00
nobu a2b06fe444 parse.y: backref_assign_error
* 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-11 02:20:34 +00:00
nobu 76e8f883d8 parse.y: const declaration macro
* 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-11 02:12:57 +00:00
nobu 0859c42b77 parse.y: const field macros
* 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-11 01:24:24 +00:00
nobu 3433653240 parse.y: rhs with rescue modifier
* 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-10 13:37:03 +00:00
nobu 064ed74be4 parse.y: rescue modifier in rhs
* 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-10 08:26:46 +00:00
nobu 18cf70ebf6 parse.y: reg_fragment_enc_error
* 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-08-03 12:31:25 +00:00
ko1 9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[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-07-28 11:02:30 +00:00
nobu f540475134 Coverage on non-positive lines
* 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-26 23:56:57 +00:00
nobu 75a68057c7 parse.y: no named capture conflict warnings
* 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-06-13 11:50:09 +00:00
nobu e0611820df parse.y: trace elsif
* 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-05-03 05:19:20 +00:00
nobu 86b1179a03 error.c: SyntaxError#initialize
* 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-20 06:52:30 +00:00
nobu 97177a2d99 refactor syntax error
* 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-20 01:25:55 +00:00
nobu 51c195948f refactor parser error
* 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-19 08:42:50 +00:00
nobu 134d1ce892 parse.y: massign in cond
* 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-04-13 05:36:26 +00:00
nobu 028f3801f8 parse.y: get rid of ISASCII on ID
* 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-30 13:14:31 +00:00
nobu d7935475fc remove rb_thread_t::parse_in_eval
* 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-28 21:39:24 +00:00
nobu 7bfeb1c2ae remove SIGN_EXTEND_CHAR macro
* 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-23 02:44:54 +00:00