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

1851 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 54eac83b2a
Hide internal IDs
* parse.y (internal_id): number the ID serial for internal use by
  counting down from the neary maximum value, not to accidentally
  match permanent IDs.

[Bug #15768]
2019-04-26 09:33:48 +09:00
Nobuyoshi Nakada 2272cb00ea
Ripper does not use internal IDs directly 2019-04-25 20:33:18 +09:00
Nobuyoshi Nakada 89271d4a37
Adjusted indents 2019-04-23 20:27:24 +09:00
Seiei Miyagi 6ca9e7cc07
Disallow numbered parameter as the default value of optional argument
[Fix GH-2139] [Bug #15783]
2019-04-23 12:16:15 +09:00
Seiei Miyagi ae07b66aaa
Fix internal error of `->x:@2{}`
[Fix GH-2139] [Bug #15783]
2019-04-23 12:16:14 +09:00
Nobuyoshi Nakada 9cdb736672
Missing semicolon 2019-04-23 10:24:31 +09:00
ktsj 243842f68a Avoid usage of the dummy empty BEGIN node
Use NODE_SPECIAL_NO_NAME_REST instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 03:37:22 +00:00
nobu c3c4e411eb parse.y: suppress warning
* parse.y (parser_append_options): explicitly pass $; when auto
  splitting, to suppress the warning for non-nil $;.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-18 22:24:03 +00:00
ktsj 9738f96fcf Introduce pattern matching [EXPERIMENTAL]
[ruby-core:87945] [Feature #14912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17 06:48:03 +00:00
nobu d8442c4306 parse.y: fix fatal messages
* parse.y (rb_parser_fatal): fix "parser" in the message which was
  replaced accidentally.  it is not the argument name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 12:43:32 +00:00
kazu 25c1fd3b90 Reverting all commits from r67479 to r67496 because of CI failures
Because hard to specify commits related to r67479 only.
So please commit again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 09:15:21 +00:00
nobu cc02df324f parse.y: fix fatal messages
* parse.y (rb_parser_fatal): fix "parser" in the message which was
  replaced accidentally.  it is not the argument name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 05:12:33 +00:00
mame 95f7992b89 Introduce beginless range [Feature#14799]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-03 08:11:41 +00:00
nobu ee5b54822c parse.y: show error line separately
* parse.y: show compile error and the error line separately,
  instead of building the error message by snprintf then yyerror.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28 10:19:08 +00:00
nobu 740248425c parse.y: make tNUMPARAM id
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-20 00:31:02 +00:00
nobu afa1505ca8 parse.y: removed redundant number_arg parser event
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-19 06:23:36 +00:00
nobu fa66569afa parse.y: fix var_ref of numbered param in ripper
* parse.y (string_dvar, user_variable): register numbered
  parameter in ripper for var_ref.
  [ruby-core:91867] [Bug #15673]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-19 06:01:21 +00:00
nobu e39f7e64b7 parse.y: fix segv with Ripper#yydebug
* parse.y (parser_token_value_print): in ripper, ID values are
  wrapped in NODE_RIPPER at set_yylval_name(), so print the Symbol
  wrapped together.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-19 02:35:50 +00:00
nobu ae5d9a7664 Added Ripper#debug_output
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-19 02:25:15 +00:00
nobu 964bbc1686 parse.y: numbered parameter in lambda
* parse.y (lambda): support numbered parameters, only when no
  argument list including empty parentheses, like empty vertical
  bars.  [ruby-core:91859] [Bug #15672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-18 12:48:18 +00:00
nobu 17018d4c31 parse.y: continue after invalid name
* parse.y (set_yylval_noname): continue after an invalid global,
  instance, class variable name, without "unexpected end-of-file"
  error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-18 06:42:19 +00:00
nobu d0e25ed277 parse.y: parser_numbered_param
* parse.y (parser_numbered_param): hoisted out the contextual
  check for numbered parameters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-18 01:18:25 +00:00
nobu 12acc751e3 Numbered parameters [Feature #4475]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-17 05:21:18 +00:00
ktsj 7006fdecf2 dsym should be treated as string [ruby-core:91852] [Bug #15670]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-16 04:00:14 +00:00
nobu 3134b20a01 Show the source line at an invalid class/instance variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-15 00:44:51 +00:00
nobu 9800fc26b0 parse.y: no punctuation instance/class variables
* parse.y (parse_atmark): exclude punctuation follows @ marks,
  whereas it is inclusive after $ mark as some punctuation global
  variables exist.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 08:13:46 +00:00
nobu 9c077bbed9 parse.y: show invalid global variable line
* parse.y (parse_gvar): show the source line erred by invalid
  global variable, and indicate the variable including the wrong
  punctuation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 05:57:42 +00:00
nobu ccc933d4a6 Hoisted out ruby_show_error_line
* parse.y (ruby_show_error_line): hoisted out from parser_yyerror.

* parse.y (regx_options): revert r67226 and show the error line
  separately.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 05:32:30 +00:00
nobu 86c5806c6a More initializations of YYLTYPE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-14 02:18:05 +00:00
nobu 8415df619e Remove unnecessary local variable
newline is always "\n" when it is used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-13 01:44:34 +00:00
nobu b6468b01f7 Show unkwon regexp option line
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-12 04:23:17 +00:00
nobu e5d10cda07 Flush erred token
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-12 04:11:41 +00:00
nobu bda6df356a parse.y: moved excessed_comma
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-11 12:47:02 +00:00
nobu 60023cf452 parse.y: trim newline in erred code
* parse.y (parser_yyerror): trim a newline at the end of the erred
  code which was replaced with an extra space in the succeeding
  cursor line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-26 13:43:32 +00:00
nobu 6375c68f88 parse.y: function parser_mixed_error & parser_mixed_escape
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-24 12:36:04 +00:00
nobu 7e68efbc95 parse.y: remove an extra error message
* parse.y (parse_string): bail out when word-list meets end of
  input not to show an extra "unexpected" error message after the
  preceding error.

      $ ruby -e "%w["
      -e:1: unterminated string meets end of file
      -e:1: syntax error, unexpected terminator, expecting ' '

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-24 11:43:11 +00:00
nobu c56f61161a parse.y: token name of tSTRING_DEND
* parse.y (rb_yytnamerr): show single-quoted single char as-is, to
  show a quoted closing brace as tSTRING_DEND.  e.g.:

      $ ./ruby -e '"#{true'
      -e:1: syntax error, unexpected end-of-input, expecting '}'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-23 09:39:45 +00:00
nobu 71342a46ac parse.y: token names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-23 09:08:22 +00:00
nobu bcf85587b1 parse.y: literal add_mark_object
* parse.y (set_yylval_str, set_yylval_literal): always imply
  add_mark_object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-22 23:21:58 +00:00
nobu 4e64c54728 ripper.y: get rid of compile error
yystpcpy is always used by yysyntax_error in bison 2.3, but may
not used by other than yytnamerr in newer bison.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-22 07:25:08 +00:00
nobu 59a6215af6 parse.y: enclose keyword token names by quotes
* parse.y (rb_yytnamerr): strip enclosing double-quotes, same as
  the default yytnamerr except for that single-quotes matching
  back-quotes do not stop stripping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-22 06:24:59 +00:00
nobu 62ec5eb018 parse.y: more token names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21 10:24:56 +00:00
nobu 9cbb4dde74 parse.y: refactored symbol rules
* parse.y (symbol): turned into a node, as well as `numeric`, for
  a symbol literal, and includes `dsym` now.

* parse.y (ssym): previous `symbol`.  renamed as the counterpart
  of `dsym`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05 13:15:07 +00:00
nobu 59f59f82d4 parse.y: refine error messages
* parse.y: refine error messages for tSYMBEG and tSTRING_BEG, which
  can appear at invalid places.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05 11:35:24 +00:00
nobu 67c5747369 Method reference operator
Introduce the new operator for method reference, `.:`.
[Feature #12125] [Feature #13581]
[EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31 15:00:37 +00:00
nobu f89238ec0d parse.y: ignore constant name captures
* parse.y (reg_named_capture_assign_iter): ignore non-local name
  captures, including non-ASCII constant names.
  [ruby-dev:50719] [Bug #15437]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-20 05:43:15 +00:00
yui-knk dd78257919 Fix locations of NODE_UNDEF in undef with multiple args
* parse.y: Fix the beginning position of trailing NODE_UNDEF.

  e.g. The location of the NODE_UNDEF for `b` is fixed:

  ```
  undef a, b
  ```

  * Before

  ```
  NODE_UNDEF (line: 1, location: (1,6)-(1,10))
  ```

  * After

  ```
  NODE_UNDEF (line: 1, location: (1,9)-(1,10))
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-25 12:31:35 +00:00
nobu 87b03e8c3c parser: improve error messages
[Fix GH-2011]

From: Akim Demaille <akim.demaille@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-25 08:31:40 +00:00
nobu f800c5fc8e Constified ruby_sourcefile
which usually refers ruby_sourcefile_string and is not freed
directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 12:04:18 +00:00
nobu 6e610f5ea7 Parse the source in SCRIPT_LINES__ as array
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-10 11:40:33 +00:00