2036 Commits

Author SHA1 Message Date
NAKAMURA Usaku
168ec2b1e5 Use %printer directive for Bison 3.8 (used release flow)
This is backport of fa05697e4832fbd67a4f91b9bb362471902faab3
2022-11-24 21:42:08 +09:00
nagachika
3d39ad2178 merge revision(s) 0036648a420f945624898568bb82bc5f83195d12: [Backport #17533]
Capture to reserved name variables if already defined [Bug #17533]

	---
	 parse.y                  |  5 +++--
	 test/ruby/test_regexp.rb | 11 +++++++++++
	 2 files changed, 14 insertions(+), 2 deletions(-)
2021-02-20 17:56:14 +09:00
nagachika
7332b3f367 merge revision(s) b091889ed67f278b1652ddde88596e2160d5aef0: [Backport #17582]
Removed YYUSE [Bug #17582]

	Although it was used just to suppress an "unsed argument" warning
	in the same manner as other bison-provided functions, it has been
	dropped since Bision 3.7.5.  And we always suppress that
	warnings.
	---
	 parse.y | 1 -
	 1 file changed, 1 deletion(-)
2021-01-30 20:52:15 +09:00
nagachika
27fca66207 Add leading arguments support to arguments forwarding
Implements [Feature #16378]
2020-12-31 15:19:16 +09:00
nagachika
b35bfa6abb merge revision(s) 35ba2783fe6b3316a6bbc6f00bf975ad7185d6e0,e8edc34f0abe176b24975a1fed1f2c3782f0a252: [Backport #16807]
Use a linked list to eliminate imemo tmp bufs for managing local
	 tables

	This patch changes local table memory to be managed by a linked list
	rather than via the garbage collector.  It reduces allocations from the
	GC and also fixes a use-after-free bug in the concurrent-with-sweep
	compactor I'm working on.

	Remove unused struct member

	I accidentally added this in 35ba2783fe6b3316a6bbc6f00bf975ad7185d6e0,
	and it's making the size of RVALUE be too big. I'm sorry! orz
2020-10-01 21:02:05 +09:00
nagachika
be359442cb merge revision(s) 71c166e11e761dcaaa943f9b94da38f86ada1bdb: [Backport #16854]
Fixed argument forwarding in reserved word method [Bug #16854]
2020-07-25 13:40:48 +09:00
Nobuyoshi Nakada
1ee1684a4a Bison 3.5.91 now defaults parse.error to "simple" 2020-07-10 08:50:41 +09:00
nagachika
d8a32b1465 merge revision(s) 263b941321c3de6afc8f9dafbc2625f866b7437e: [Backport #16981]
[ripper] fix mismatched indentations warning [Bug #16981]

	The scanner location has to be set from `lex.ptok` before it is
	flushed by dispatching the scanner event.
2020-06-27 12:20:36 +09:00
Nobuyoshi Nakada
44f7e3883e Preserve kwarg flag and fix up f5c904c2a9
(cherry picked from commit c8d0bf0156878df03a71fffc97c44abf7333d5d7)
2020-03-28 04:01:15 +09:00
Nobuyoshi Nakada
004c298738 Allow newlines inside braced pattern
(cherry picked from commit f5c904c2a907013e22ff74bc3686952c5448d493)
2020-03-27 14:57:42 +09:00
Kazuki Tsujimoto
93aaa0bcce Allow trailing comma in hash pattern
(cherry picked from commit d25a4f413dce6ad3a8baaf61591415b9a8cce082)
2020-03-27 14:57:36 +09:00
Nobuyoshi Nakada
eabf35a5d2 Fixed duplicated warning
As `command_rhs` is always a "value expression", `command_asgn`
does not need the same check. [Bug #16619]

(cherry picked from commit 6e6844320de989cb88a154e2ac75066ccea1bba2)
2020-03-14 16:12:44 +09:00
NARUSE, Yui
5bdbee96e4 Squashed commit of the following: [Backport #16516]
commit c98c492578d898dc07a04b8240d8d5b1508ffafa
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date:   Fri Jan 17 16:56:53 2020 +0900

    Added test for f38b3e8c707ebdcad05aa9485cf1760640b74fbb

commit f38b3e8c707ebdcad05aa9485cf1760640b74fbb
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date:   Thu Jan 16 18:34:31 2020 +0900

    Fixed the location of args node with numbered parameter
2020-03-13 21:51:06 +09:00
Nobuyoshi Nakada
56e002981f
Show the error line only when same as the current 2019-12-25 14:49:48 +09:00
Nobuyoshi Nakada
07e595fdbd
Added experimental warning category
[Feature #16420]
2019-12-20 23:48:15 +09:00
Nobuyoshi Nakada
dd7f0c87c9
Hoisted out new_case3 2019-12-20 23:43:38 +09:00
Nobuyoshi Nakada
7a94225e7d
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:58:51 +09:00
Nobuyoshi Nakada
a8bddb3a18
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:34:32 +09:00
Nobuyoshi Nakada
2898367b3a
Warn also numbered parameter like methods 2019-12-20 08:18:19 +09:00
Nobuyoshi Nakada
27ddb6e998
Warn also numbered parameter like parameters
[Feature #16433]
2019-12-20 01:25:34 +09:00
Yusuke Endoh
199bd851e4 parse.y: suppress "set but not used" warnings on ripper.y 2019-12-05 14:51:55 +09:00
Jeremy Evans
447d583536 Silence incorrect assigned but unused variable warnings in ripper
To only emit the warnings in correct cases would require tracking
local variable usage in ripper, which ripper currently does not do.

Fixes [Bug #15188]
2019-12-04 03:04:22 +02:00
Nobuyoshi Nakada
d1ef4fd08e
Make single line pattern matching void expression
Instead of returning `nil`, raise a syntax error if its value is
used.  [Feature #16355]
2019-11-30 00:15:29 +09:00
Nobuyoshi Nakada
8b4ee5d6ba
Raise NoMatchingPatternError when expr in pat doesn't match
* `expr in pattern` should raise `NoMatchingError` when unmatched
* `expr in pattern` should return `nil`. (this is unspecified, but
  this feature is experimental, at all)

[Feature #16355]
2019-11-28 13:47:14 +09:00
Nobuyoshi Nakada
9e01fcd0cb
[ripper] Fixed unique key check in pattern matching
Check keys
* by an internal table, instead of unstable dispatched results
* and by parsed key values, instead of escaped forms in the source
2019-11-26 22:54:35 +09:00
Nobuyoshi Nakada
22dfd14c17
Hoisted out push_pvtbl/pop_pvtbl 2019-11-26 21:57:00 +09:00
Nobuyoshi Nakada
497f13aea6
Wrap p_kw in an array at p_kwarg
Not in `p_kw` itself, which makes key and variable/expr pair only
now.
2019-11-26 21:57:00 +09:00
Nobuyoshi Nakada
26625bc33c
[ripper] Quoted label without expression must be a local variable
The difference from 0b8c73aa65add5c57b46b0cfdf4e661508802172 is to
add the result of `string_add` event to marking objects.

```C
			    RNODE($1)->nd_rval = add_mark_object(p, $$);
```
2019-11-25 17:42:59 +09:00
Nobuyoshi Nakada
61131edba7
Revert "[ripper] Quoted label without expression must be a local variable"
This reverts commit 0b8c73aa65add5c57b46b0cfdf4e661508802172, which
seems breaking RVALUE consistency check.
2019-11-20 00:56:04 +09:00
Nobuyoshi Nakada
0b8c73aa65
[ripper] Quoted label without expression must be a local variable 2019-11-19 17:18:27 +09:00
Jeremy Evans
c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
卜部昌平
c9ffe751d1 delete unused functions
Looking at the list of symbols inside of libruby-static.a, I found
hundreds of functions that are defined, but used from nowhere.

There can be reasons for each of them (e.g. some functions are
specific to some platform, some are useful when debugging, etc).
However it seems the functions deleted here exist for no reason.

This changeset reduces the size of ruby binary from 26,671,456
bytes to 26,592,864 bytes on my machine.
2019-11-14 20:35:48 +09:00
Nobuyoshi Nakada
4d615a0c8f
#@1 is no longer an embedded variable 2019-11-14 16:37:25 +09:00
Nobuyoshi Nakada
fb6a489af2
Revert "Method reference operator"
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
2019-11-12 17:24:48 +09:00
Nobuyoshi Nakada
a58b4eee25
Warn on ... at EOL 2019-11-12 17:14:14 +09:00
Nobuyoshi Nakada
7c22898a3a
Disable tOROP at EXPR_BEG
Both cannot appear there anyway.
2019-11-12 15:42:53 +09:00
Nobuyoshi Nakada
ed90ec3e0d
Clear current argument name at empty block argument [Bug #16343] 2019-11-12 09:40:18 +09:00
NARUSE, Yui
fd69f82675 Revert "Warn EOF char in comment"
This reverts commit 69ec3f70fab0c1c537c68fb135cc315181b1d750.
2019-11-11 17:37:21 +09:00
NARUSE, Yui
ba5b51ca59 Revert "Elaborated EOF char message a little"
This reverts commit 6eaac7cfac668d6669be694fd7b723c4982ed218.
2019-11-11 17:37:14 +09:00
Nobuyoshi Nakada
6eaac7cfac
Elaborated EOF char message a little 2019-11-11 12:57:40 +09:00
Nobuyoshi Nakada
69ec3f70fa
Warn EOF char in comment 2019-11-11 09:59:40 +09:00
Nobuyoshi Nakada
ade0388894
Fixed embedded document with EOF char 2019-11-11 09:38:14 +09:00
Kazuki Tsujimoto
6e70fa49b1
Disallow omission of parentheses/brackets in single line pattern matching [Feature #16182] 2019-11-10 22:34:49 +09:00
Kazuki Tsujimoto
a396bef8d8
Disallow duplicated pattern variable 2019-11-07 15:40:35 +09:00
Kazuki Tsujimoto
1e620c67af
Add missing semicolon 2019-11-07 13:20:11 +09:00
Nobuyoshi Nakada
2fd465540f
Numbered parameter is an ID_LOCAL now [Bug #16293] 2019-11-06 12:45:11 +09:00
Nobuyoshi Nakada
82e840ad15
Numbered parameter cannot appear outside block now [Bug #16293] 2019-11-06 12:44:50 +09:00
Kazuhiro NISHIYAMA
30a74aaef0
Fix a typo in WARN_EOL 2019-11-05 10:09:44 +09:00
Nobuyoshi Nakada
a087e027bf
Fixed conditional expressions with only one void side 2019-11-05 01:32:26 +09:00
Nobuyoshi Nakada
e91e3274be
Keep lex.pcur after looking_at_eol_p 2019-11-04 23:37:53 +09:00