2415 Commits
Author SHA1 Message Date
nagachika 770060f766 merge revision(s) 1acfb29015: [Backport #21186]
[Bug #21186] multibyte char literal should be a single letter word
2025-03-29 15:32:49 +09:00
Jean byroot BoussierandJean Boussier 65cca99b30 parse.y: const_decl_path don't replace destination node by a literal (#11314)
[Bug #20668]

The `dest` node is assumed to be a `CDECL`, so overwriting it with
a `LIT` cause a crash on the next iteration.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-08-06 10:34:39 -07:00
Takashi Kokubun 23f4b78ad8 merge revision(s) 27321290: [Backport #20521]
[Bug #20521] ripper: Clean up strterm
2024-06-11 11:17:32 -07:00
Peter Zhu 4c50d23245 Raise SyntaxError on invalid encoding symbol (#10967)
[Bug #20280]

Backport of #10014.
2024-06-11 11:01:29 -07:00
Takashi Kokubun 1ff55bb09d merge revision(s) 05553cf22d: [Backport #20517]
[Bug #20517] Make a multibyte character one token at meta escape
2024-06-04 14:58:37 -07:00
Takashi Kokubun 0044b6aefc merge revision(s) bc002971b6: [Backport #20094]
[Bug #20094] Distinguish `begin` and parentheses
2024-05-29 16:35:18 -07:00
NARUSE, Yui 2a84aaf4a8 Fix test session reuse but expire (#9824) (#10250)
merge revision(s) 596db9c1f4: [Backport #20090]

	[Feature #19370] Blocks without anonymous parameters should not
	 affect

	---
	 parse.y                  | 4 ++--
	 test/ruby/test_syntax.rb | 7 +++++++
	 2 files changed, 9 insertions(+), 2 deletions(-)
2024-03-14 09:55:52 +00:00
NARUSE, Yui f8f0d342e4 merge revision(s) 3d19409637: [Backport #20090]
Use index for referring to symbols in `args` rule instead of named
	 references

	In `args: args ',' arg_splat`, `args` is not unique name.
	Currently the associated rule is interpreted as
	`$$ = rest_arg_append(p, $$, $3, &@$);`.
	The action works as expected because `$$` is initialized with
	`$1` before each action is executed.
	However it's misleading then change to use index.
	---
	 parse.y | 4 ++--
	 1 file changed, 2 insertions(+), 2 deletions(-)
2024-01-30 18:57:00 +09:00
NARUSE, Yui 9f18cbd796 Revert "merge revision(s) bc002971b6: [Backport #20094]"
This reverts commit d4b780e84e.
2024-01-30 18:00:47 +09:00
NARUSE, Yui d4b780e84e merge revision(s) bc002971b6: [Backport #20094]
[Bug #20094] Distinguish `begin` and parentheses

	---
	 compile.c                    |  1 +
	 parse.y                      | 36 +++++++++++++++++++++---------------
	 test/ruby/test_whileuntil.rb | 18 ++++++++++++++++++
	 3 files changed, 40 insertions(+), 15 deletions(-)
2024-01-30 17:41:31 +09:00
Nobuyoshi Nakada a9f0961831 [Feature #19370] Prohibit nesting anonymous parameter forwarding 2023-12-25 14:44:04 +09:00
Nobuyoshi Nakada 40e3f782dd Extract forwarding_arg_check function 2023-12-22 23:08:10 +09:00
Nobuyoshi Nakada 11c2aa035b Extract arg_splat nonterminal symbol 2023-12-22 23:08:10 +09:00
Nobuyoshi Nakada 92b10f5be7 [Bug #20062] Fixed numbered parameter syntax error
At the method definition, the local scope that saves the context of
the numbered parameters needs to be pushed before saving.
2023-12-16 02:11:51 +09:00
Nobuyoshi Nakada 9b7a964318 [Bug #19877] Flip-flop needs to be direct condition 2023-12-08 12:53:47 +09:00
Takashi Kokubun c6eb355e04 Revert "Warn it only with -W:deprecated"
This reverts commit 5458252bb0.

Revert "Fallback rb_warn_deprecated for UNIVERSAL_PARSER"

This reverts commit 680be886f4.

matz actually preferred always warning `it`.
2023-12-07 00:03:03 -08:00
Takashi Kokubun 680be886f4 Fallback rb_warn_deprecated for UNIVERSAL_PARSER 2023-12-07 00:00:36 -08:00
Takashi Kokubun 5458252bb0 Warn it only with -W:deprecated 2023-12-06 23:44:02 -08:00
Takashi Kokubun ae76c8a11e Warn it (#9152)
https://bugs.ruby-lang.org/issues/18980
2023-12-07 07:14:59 +00:00
Nobuyoshi Nakada a607d62d8c [Bug #20033] Dynamic regexp should not assign captures 2023-12-02 03:57:41 +09:00
Nobuyoshi Nakada e5e1f9813e [Bug #19838] Flush delayed token nonconsecutive with the next token 2023-12-02 02:41:39 +09:00
Nobuyoshi Nakada add0ab07e8 Extract end_with_newline_p 2023-12-02 02:41:39 +09:00
Nobuyoshi Nakada 6e2b10d456 Prefer proper enum over bare int 2023-12-02 02:41:39 +09:00
Nobuyoshi Nakada e36b9760fd Dispatch invalid hex escape content too 2023-12-01 15:04:30 +09:00
Nobuyoshi Nakada d503e1b95a [Bug #20030] dispatch invalid escaped character without ignoring it 2023-12-01 15:04:30 +09:00
Nobuyoshi Nakada 1802d14ca8 [Bug #19877] Assign captures for direct regexp literal only 2023-11-30 21:40:22 +09:00
TSUYUSATO Kitsune fe746747b4 Reject 'class << (return); end` by "void value expression" 2023-11-21 14:07:47 +09:00
yui-knk 51149f335e Keep unused literal nodes
For static analysis, it’s better to keep unused literal nodes.
If simply change `block_append` to fall through, both "unused literal ignored"
and "possibly useless use of a literal in void context" warnings
are shown for the same line. But it’s verbose then remove
"unused literal ignored" warning.

This kind of optimization is already implemented on compile.c.
`compile_block` calls `iseq_compile_each0` with `popped = 1` when NODE_BLOCK
has next.
2023-10-31 17:49:12 +09:00
Nobuyoshi Nakada 13c9cbe09e Embed rb_args_info in rb_node_args_t 2023-10-30 00:19:43 +09:00
Nobuyoshi Nakada c8d162c889 [Bug #19973] Warn duplicated keyword arguments after keyword splat 2023-10-26 14:28:39 +09:00
Nobuyoshi Nakada 2f8a719b6a Removed unused argument
Eventually, `read_escape` does not use `encp`.
2023-10-25 21:40:41 +09:00
Nobuyoshi Nakada 839b763119 Use named reference for dyna_push 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 7e80f0b5a2 Extract p_in_kwarg to save and update lexer contexts 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 428f9f5dc0 Move push_pvtbl and push_pktbl in nterms 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 3b05238289 Extract p_assoc and p_in to save lexer contexts 2023-10-23 17:40:33 +09:00
yui-knk 08e25985d1 Expand OP_ASGN1 nd_args to nd_index and nd_rvalue
ARGSCAT has been used for nd_args to hold index and rvalue,
because there was limitation on the number of members for Node.
We can easily change structure of node now, let's expand it.
2023-10-20 07:56:20 +09:00
yui-knk 606452d1a9 Remove not used fields from STR 2023-10-15 16:16:06 +09:00
yui-knk 5342dbf00b Check node type before accessing nd_next
This is also a preparation for removing not_used members from
STR NODE. Current codes work without node type check because NODE_STR
has not_used2 member corresponding to nd_next of NODE_LIST and
NODE_DSTR. However it causes problme once not_used members are
removed from NODE_STR.
2023-10-15 16:16:06 +09:00
yui-knk e7e31d7784 Stop updating node type from NODE_STR to NODE_DSTR
This is a preparation for removing not_used members from STR NODE.
Once not_used members are removed from STR NODE, STR NODE is smaller than
DSTR NODE. Therefore allocate NODE_DSTR instead of reusing NODE_STR.
2023-10-15 16:16:06 +09:00
yui-knk a4e3d595cd Remove not used fields from XSTR 2023-10-15 16:16:06 +09:00
yui-knk cab67d227a Remove not used fields from LIT 2023-10-15 16:16:06 +09:00
yui-knk 25072d2e87 Fix node type casts
Use new node type set by nd_set_type.
2023-10-14 11:12:20 +09:00
Nobuyoshi Nakada a405b28e85 Delete heredoc line mark references 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada 5fc9810bf3 Shorten rb_strterm_literal_t members 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada a075c55d0c Manage rb_strterm_t without imemo 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada cb06b6632a Remove unions in rb_strterm structs for alignment 2023-10-14 11:08:43 +09:00
yui-knk 2794a8fef6 [Bug #19919] Warn class variable assignment and constant declaration in condition 2023-10-13 07:35:24 +09:00
Nobuyoshi Nakada 81399a5c46 Use lex_eol macros 2023-10-13 02:32:45 +09:00
Nobuyoshi Nakada 17b0643392 [Bug #19924] Source code should be unsigned char stream
Use `peekc` or `nextc` to fetch the next character, instead of reading
from `lex.pcur` directly, for compilers that plain char is signed.
2023-10-13 02:28:35 +09:00
yui-knk f9fe7aeef4 Extract NODE_FL_NEWLINE access to macro 2023-10-11 19:22:34 +09:00