Commit graph

2116 commits

Author SHA1 Message Date
nagachika
efa1ba15fd merge revision(s) fa05697e48: [Backport #18166]
Use `%printer` directive for Bison 3.8

	---
	 parse.y | 74 ++++++++++++++++++++++++++---------------------------------------
	 1 file changed, 29 insertions(+), 45 deletions(-)
2021-10-02 11:22:19 +09:00
nagachika
af9de56c6f merge revision(s) 110f242ef9: [Backport #17861]
Also `\U` after control/meta is invalid [Bug #17861]

	As well as `\u`, `\U` should be invalid there too.
	And highlight including `u`/`U` not only the backslash before it.
	---
	 parse.y                 | 12 ++++++++++--
	 test/ruby/test_parse.rb | 15 +++++++++++++++
	 2 files changed, 25 insertions(+), 2 deletions(-)
2021-05-22 16:47:24 +09:00
NARUSE, Yui
e9843cdaee merge revision(s) b091889ed6: [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-02-02 18:06:56 +09:00
NARUSE, Yui
42f02a0bac merge revision(s) 6bcc4664bdaebbf9b28a762ae63f476a1ec6cfb2,bb40c5cbe977de9f36a2a739e94e9b2fd4496b6e,c060bdc2b4ab8eeef5374f4174f5de48ab936d74: [Backport #17541]
Return new NODE_LIT

	As NODE_ZLIST/NODE_LIST are not markable, cannot be reused as
	NODE_LIT.
	---
	 parse.y | 7 ++-----
	 1 file changed, 2 insertions(+), 5 deletions(-)

	Ensure symbol list node is either NODE_STR or NODE_DSTR

	---
	 parse.y | 11 ++++++++---
	 1 file changed, 8 insertions(+), 3 deletions(-)

	NODE markability should not change by nd_set_type

	---
	 node.c | 31 +++++++++++++++++++++++++------
	 node.h | 12 ++++++++++++
	 2 files changed, 37 insertions(+), 6 deletions(-)
2021-02-01 19:21:03 +09:00
NARUSE, Yui
1b0622d7a9 merge revision(s) 0036648a42: [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-01 19:20:20 +09:00
Koichi Sasada
6f29716f9f shareable_constant_value: experimental_copy
"experimental_everything" makes the assigned value, it means
the assignment change the state of assigned value.
"experimental_copy" tries to make a deep copy and make copyied object
sharable.
2020-12-24 14:28:47 +09:00
Nobuyoshi Nakada
4a8ff22f0c
Reset paren_nest at tAREF and tASET [Bug #17431] 2020-12-24 01:39:52 +09:00
Nobuyoshi Nakada
8a1e12499b Ensure non-literal expressions shareable if leteral 2020-12-23 13:50:42 +09:00
Nobuyoshi Nakada
0c450b8647 begin ... end is not a literal 2020-12-23 13:50:42 +09:00
Nobuyoshi Nakada
7a094146e6 Changed shareable literal semantics [Feature #17397]
When `literal`, check if the literal about to be assigned to a
constant is ractor-shareable, otherwise raise `Ractor::Error` at
runtime instead of `SyntaxError`.
2020-12-23 13:50:42 +09:00
Nobuyoshi Nakada
733ed1e184 ripper: fix bad label parameter handling [Bug #17425] 2020-12-23 09:56:35 +09:00
Nobuyoshi Nakada
b2acae3274
Reduced ID caches
NEW_GASGN and NEW_GVAR evaluate `id` argument twice.
2020-12-20 03:10:30 +09:00
Jeremy Evans
7e2dbbda35 Use category: :experimental in warnings that are related to experimental features
This adds rb_category_compile_warn in order to emit compiler warnings
with categories.  Note that Ripper currently ignores the category
for these warnings, but by default it ignores the warnings completely,
so this shouldn't matter.
2020-12-18 09:54:11 -08:00
Nobuyoshi Nakada
19a98a8791
Fixed not to make non-literal expression shareable [Feature #17273]
Non-literal expression which is not a part of a literal expression
is not a subject of `shareable_literal_value: literal`.
2020-12-19 00:34:14 +09:00
Nobuyoshi Nakada
8e03e3b0ba
Drop token info also for endless singleton method definition 2020-12-18 15:16:30 +09:00
Nobuyoshi Nakada
9c859f4b3c
Ripper: Pass callback result to alias_error as well as other errors
[Bug #17345]
2020-12-16 22:53:43 +09:00
Nobuyoshi Nakada
47328ad217
Ripper: Fixed erred token on wrong alias [Bug #17345] 2020-12-16 21:08:33 +09:00
Nobuyoshi Nakada
e0bdd54348 Ripper: Refined error callbacks [Bug #17345] 2020-12-15 21:36:23 +09:00
Nobuyoshi Nakada
3323174727 Support shareable_constant_value: literal 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
89e489d51d Make shareable_constant_value tri-state 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
7060aeedbd shareable_constant_value: is effective only in comment-only line 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
070a990bcb Save and pass lex_context wholely 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
dc1cc33d69 Determine shareable-ness after assignment operator 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
60f0c376f7 Implemented shareable_constant_value op_asgn 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
65450e8f7d Call FrozenCore.make_shareable 2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
f43c71abe0 Implemented shareable_constant_value
It does shallow freeze only for now.
2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada
b1bd223085 Support shareable_constant_value pragma 2020-12-14 19:19:16 +09:00
Kazuki Tsujimoto
88f3ce12d3
Reintroduce expr in pat [Feature #17371] 2020-12-13 11:51:49 +09:00
Kazuki Tsujimoto
a8cf526ae9
Don't emit warning when the pattern of one-line pattern matching is just a variable pattern
https://github.com/ruby/dev-meeting-log/blob/master/DevelopersMeeting20201210Japan.md#feature-17371-reintroduce-expr-in-pat-ktsj
2020-12-13 11:51:49 +09:00
Koichi Sasada
5e3259ea74 fix public interface
To make some kind of Ractor related extensions, some functions
should be exposed.

* include/ruby/thread_native.h
  * rb_native_mutex_*
  * rb_native_cond_*
* include/ruby/ractor.h
  * RB_OBJ_SHAREABLE_P(obj)
  * rb_ractor_shareable_p(obj)
  * rb_ractor_std*()
  * rb_cRactor

and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
    (to avoid conflict with include/ruby/ractor.h)
2020-11-18 03:52:41 +09:00
Jeremy Evans
f5bb9115a7 Use more specific warning for ambiguous slash
Fixes [Bug #17124]
2020-11-15 15:25:32 -08:00
Nobuyoshi Nakada
79b242260b
ripper: Invalid pragma value warning 2020-11-02 22:49:42 +09:00
Nobuyoshi Nakada
539b89075a
Compare boolean values for parser pragma locale-insensitively 2020-11-02 18:24:45 +09:00
Kazuki Tsujimoto
e03e1982bd
Change NODE layout for pattern matching
I prefer pconst to be the first element of NODE.

  Before:

       | ARYPTN | FNDPTN | HSHPTN
    ---+--------+--------+-----------
    u1 | imemo  | imemo  | pkwargs
    u2 | pconst | pconst | pconst
    u3 | apinfo | fpinfo | pkwrestarg

  After:

       | ARYPTN | FNDPTN | HSHPTN
    ---+--------+--------+-----------
    u1 | pconst | pconst | pconst
    u2 | imemo  | imemo  | pkwargs
    u3 | apinfo | fpinfo | pkwrestarg
2020-11-01 16:19:07 +09:00
Kazuki Tsujimoto
b601532411
Pattern matching is no longer experimental 2020-11-01 13:33:58 +09:00
Nobuyoshi Nakada
bdd1d17ac2
Allow non-argument endless-def with a space instead of parentheses 2020-10-26 21:15:16 +09:00
Nobuyoshi Nakada
52c630da00
Assoc pattern matching (#3703)
[Feature #17260] One-line pattern matching using tASSOC

R-assignment is rejected instead.
2020-10-26 18:00:24 +09:00
Nobuyoshi Nakada
4ed0c33d13
Prohibit setter method names in all kinds of endless methods
Also unwrap NODE_RIPPER to check the method name.
2020-10-12 00:40:55 +09:00
Nobuyoshi Nakada
8d1b188864
Refactored lex_context management
Save and restore `lex_context` as-is wholely, and save in
`k_class` and `k_module` to workaround look-ahead reading.
2020-10-09 13:44:48 +09:00
Nobuyoshi Nakada
7b2bea42a2
Unfreeze string-literal-only interpolated string-literal
[Feature #17104]
2020-09-30 22:15:28 +09:00
Koichi Sasada
79df14c04b Introduce Ractor mechanism for parallel execution
This commit introduces Ractor mechanism to run Ruby program in
parallel. See doc/ractor.md for more details about Ractor.
See ticket [Feature #17100] to see the implementation details
and discussions.

[Feature #17100]

This commit does not complete the implementation. You can find
many bugs on using Ractor. Also the specification will be changed
so that this feature is experimental. You will see a warning when
you make the first Ractor with `Ractor.new`.

I hope this feature can help programmers from thread-safety issues.
2020-09-03 21:11:06 +09:00
Nobuyoshi Nakada
93b78abd77
new_dstr: hoisted out from literal_concat and evstr2dstr 2020-09-02 13:30:16 +09:00
Yusuke Endoh
53ba9fb74e Prohibit setter method names in endless method definition
https://bugs.ruby-lang.org/issues/16746#note-26
2020-08-31 20:30:27 +09:00
Nobuyoshi Nakada
445e5548c9
Fixed error messages at non-ascii %string terminator 2020-08-26 21:36:22 +09:00
Nobuyoshi Nakada
cc36b5d4ac
Removed a never-true condition 2020-08-26 21:16:51 +09:00
Kazuki Tsujimoto
fcdbdff631
rb_{ary,fnd}_pattern_info: Remove imemo member to reduce memory usage
This is a partial revert commit of 8f096226e1.

NODE layout:

  Before:

       | ARYPTN | FNDPTN | HSHPTN
    ---+--------+--------+-----------
    u1 | pconst | pconst | pconst
    u2 | unused | unused | pkwargs
    u3 | apinfo | fpinfo | pkwrestarg

  After:

       | ARYPTN | FNDPTN | HSHPTN
    ---+--------+--------+-----------
    u1 | imemo  | imemo  | pkwargs
    u2 | pconst | pconst | pconst
    u3 | apinfo | fpinfo | pkwrestarg
2020-08-02 01:04:06 +09:00
Aaron Patterson
35ba2783fe 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.
2020-07-27 12:40:01 -07:00
Jeremy Evans
d47e124857 Switch reserved for numbered parameter warning to SyntaxError 2020-07-22 08:34:51 -07:00
Nobuyoshi Nakada
3d8705dcfd
Drop token info for endless method definition
Because it does not have closing `end`.
2020-06-25 01:14:26 +09:00
Nobuyoshi Nakada
fe82f72951
AST.of needs SCRIPT_LINES__ filled with a newline 2020-06-25 00:14:31 +09:00