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

1879 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 92ecf58b1e
parse.y: adjust here-doc error token
* parse.y (here_document): adjust token to the here-doc identifier
  in compile_error when a here-document misses the closing
  identifier.
2019-05-30 22:03:33 +09:00
Nobuyoshi Nakada 4a31c1e45d
parse.y: continue after heredoc error
* parse.y: continue parsing the rest of the here-document starting
  line, after the terminator was not found.
2019-05-30 12:38:50 +09:00
Nobuyoshi Nakada 1da5c73932
parse.y: fix state after ivar/cvar
* parse.y (parse_atmark): return EXPR_END or EXPR_ENDFN, depending
  on the previous state, even incomplete names consistently.
2019-05-29 21:42:58 +09:00
Nobuyoshi Nakada cc66272e50
parse.y: flush invalid char 2019-05-29 13:24:24 +09:00
Nobuyoshi Nakada c730c25354
parse.y: warn escaped whitespace
* parse.y (warn_space_char_code): warn whitespace characters
  escaped with meta/control prefix.
2019-05-29 00:00:26 +09:00
Nobuyoshi Nakada 62b3d4c721
Skip following all digits after `@@` 2019-05-28 14:36:29 +09:00
Nobuyoshi Nakada 1cdaa17a06
parse.y: numbered parameter symbol
* parse.y (parse_atmark): numbered parameter name is not allowed
  as a symbol regardless the context.
2019-05-28 09:00:02 +09:00
Nobuyoshi Nakada b4365e75fd
Do not make an incomplete escape a valid char 2019-05-27 23:08:48 +09:00
Nobuyoshi Nakada c40003da25
Ripper#token
* parse.y (ripper_token): added Ripper#token which returns the
  current token string.  [EXPERIMENTAL]
2019-05-27 23:08:45 +09:00
Nobuyoshi Nakada ea6e284d86
parse.y: removed "parser_" prefix from tokadd_utf8 2019-05-27 13:58:41 +09:00
Nobuyoshi Nakada a43c637660
parse.y: broke the terminator condition down
* parse.y (here_document): broke the terminator condition down
  into each piece, the positional condition, resetting the
  dedented here-document indentation, and matching identifier.
  suppress a false warning by icc.
2019-05-27 00:40:30 +09:00
Nobuyoshi Nakada 2ce6365f9c
parse.y: adjust error indicator
* parse.y (parser_yylex): adjust the error indicator of unexpected
  fraction part.

before:
~~~
1.2.3
^~~
~~~

after:
~~~
1.2.3
   ^~
~~~
2019-05-26 18:47:52 +09:00
Nobuyoshi Nakada 02b39daef8
Fix scanner event at invalid syntax
* parse.y (parser_yyerror, parser_compile_error): revert
  r67224 (e5d10cda07) "Flush erred
  token".
2019-05-26 16:24:33 +09:00
Nobuyoshi Nakada 2893550452
Mixed encoding error can continue to parse 2019-05-24 16:12:17 +09:00
Jeremy Evans c05eaa9325 Fix mixed encoding in heredoc
Heredocs are parsed line-by-line, so we need to keep track of the
temporary encoding of the string.  Previously, a heredoc would
only detect mixed encoding errors if they were on the same line,
this changes things so they will be caught on different lines.

Fixes [Bug #15839]
2019-05-22 21:52:20 -07:00
Nobuyoshi Nakada 7ef548c0ac
Mixed encoding error can continue to parse 2019-05-20 12:43:52 +09:00
Nobuyoshi Nakada 0ed9bdfc13
Pack struct rb_strterm_heredoc_struct on 32-bit platforms 2019-05-16 18:25:16 +09:00
Nobuyoshi Nakada e9bb30d47e
Expect no conflict in the parser 2019-05-12 00:13:52 +09:00
Nobuyoshi Nakada 79931dddba
Propagate parser_params to rb_yytnamerr 2019-05-10 22:02:54 +09:00
Hiroshi SHIBATA aa52464efd
15f45ae4d1 and 56528da3e broke the darwin environment.
Revert "Propagate parser_params to rb_yytnamerr"

This reverts commit 15f45ae4d1.
2019-05-10 21:48:02 +09:00
Nobuyoshi Nakada 15f45ae4d1
Propagate parser_params to rb_yytnamerr 2019-05-10 16:40:34 +09:00
Jeremy Evans bb4ac7a650
Fix use of numbered parameter inside proc that is default value of optarg
This allows cases such as:

```ruby
m ->(a = ->{@1}) {a}
m.call.call(1)

m2 ->(a: ->{@1}) {a}
m2.call.call(2)
```

Previously, this would cause a syntax error.

[Bug#15789]
2019-05-05 16:32:45 +09:00
Jeremy Evans b8f3be295b
Fix a case where numbered parameters should not be allowed
Because `proc{|| @1}` is a syntax error, the following should
also be syntax errors:

```ruby
proc { |
| @1}
```

```ruby
proc { |; a| @1 }
```

This fixes both cases.

[Bug #15825]
2019-05-05 14:46:39 +09:00
Nobuyoshi Nakada ff21e75d32
parse.y: duplicated when clause warning
* parse.y (case_args): moved "duplicated when clause" warning from
  compile phase, so that `ruby -wc` shows them.
2019-05-05 00:29:12 +09:00
Nobuyoshi Nakada 6a3165e19d
Fixed HERETERM_LENGTH_MAX on IL32LLP64 2019-04-29 18:32:21 +09:00
Nobuyoshi Nakada c7f780c155
Refactored rb_strterm_heredoc_t 2019-04-29 17:45:58 +09:00
Nobuyoshi Nakada 1432471a75
Disallow also CR in here-doc identifier
* parse.y (heredoc_identifier): CR in here-document identifier
  might or might not result in a syntax error, by the EOL code.
  make a syntax error regardless of the EOL code.
2019-04-29 13:47:20 +09:00
Nobuyoshi Nakada 330b376133
parse.y: fix here-doc identifier with newline
* parse.y (heredoc_identifier): quoted here-document identifier
  must end within the same line.

  the only corner case that here-document identifier can contain a
  newline is that the closing qoute is placed at the beginning of
  the next line, and has been warned since 2.4.

  ```ruby
  <<"EOS
  " # warning: here document identifier ends with a newline
  EOS
  ```
2019-04-29 12:49:59 +09:00
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