Commit graph

2230 commits

Author SHA1 Message Date
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
Nobuyoshi Nakada
263b941321
[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-24 19:53:14 +09:00
Kazuki Tsujimoto
97614c5521
apinfo/fpinfo should always be non-NULL 2020-06-14 13:16:16 +09:00
Kazuki Tsujimoto
ddded1157a
Introduce find pattern [Feature #16828] 2020-06-14 09:24:36 +09:00
Kazuki Tsujimoto
f7906a7e31
push_pktbl is needed for hash pattern, not for array pattern 2020-06-14 09:23:43 +09:00
Nobuyoshi Nakada
2496bdb28f
Extracted argument forwarding staffs 2020-06-13 23:33:40 +09:00
Nobuyoshi Nakada
8e5352569b
[ripper] use Ripper DSL 2020-06-13 23:33:40 +09:00
Nobuyoshi Nakada
c0ba35f334
Differentiate ... in lambda arguments 2020-06-07 18:44:07 +09:00
Jeremy Evans
f8b4340fa2 Add leading arguments support to arguments forwarding
The idFWD_KWREST sections may be wrong. However, the existing
idFWD_KWREST sections for ... without leading arguments are already
broken.

Implements [Feature #16378]
2020-06-06 17:07:11 -07:00
Nobuyoshi Nakada
27bef64862
Include the entire lambda expression in lambda rule 2020-06-02 09:06:49 +09:00
Nobuyoshi Nakada
cadd2245f7
Extracted excessed_comma to unify ripper and make the order stable 2020-06-01 18:26:34 +09:00
Nobuyoshi Nakada
71c166e11e
Fixed argument forwarding in reserved word method [Bug #16854] 2020-05-15 14:59:11 +09:00
Nobuyoshi Nakada
d7d0d01401 Endless method definition including rescue modifier 2020-05-14 19:58:44 +09:00
卜部昌平
9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平
d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Nobuyoshi Nakada
5c2508060b
Bison 3.5.91 now defaults parse.error to "simple" 2020-05-04 18:10:02 +09:00
Nobuyoshi Nakada
1997e10f6c
Made parentheses mandatory in endless method defition
Even for empty argument list, not to be confusing with a writer
method name.
2020-04-22 20:44:46 +09:00
Nobuyoshi Nakada
02ad393cd6
Revert "Allow simple R-assign in endless def"
This reverts commit 67bcac879a.
2020-04-22 18:56:06 +09:00
Nobuyoshi Nakada
478135f480
Disallow line-continuation before R-assign 2020-04-15 10:33:11 +09:00
Nobuyoshi Nakada
a520ee4763
Removed duplicate value_expr checks
`arg_rhs` has the same check and is always a non-void value
expression.
2020-04-14 19:47:17 +09:00
Nobuyoshi Nakada
67bcac879a Allow simple R-assign in endless def 2020-04-13 21:51:34 +09:00
Nobuyoshi Nakada
022c7bbea9
Relaxed of R-assign value to arg 2020-04-12 00:07:57 +09:00
Nobuyoshi Nakada
e8f53692ca
Endless method definition [Feature #16746] 2020-04-10 18:02:15 +09:00
Nobuyoshi Nakada
1b2d351b21
Rightward-assign by ASSOC
[Feature #15921]
2020-04-10 15:03:58 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada
2544bf9452
New macro NEW_RIPPER instead of NEW_CDECL 2020-04-03 01:16:57 +09:00
Nobuyoshi Nakada
f020d340f4
parse.y: hoisted out new_nil_at
new_nil_at: create NEW_NIL node with zero-width location.
2020-03-11 18:13:40 +09:00
Nobuyoshi Nakada
276859e03e
parse.y: unified kwrest and no-kwrest 2020-03-11 18:13:29 +09:00
Nobuyoshi Nakada
7d05f98a84
Renamed lex_flags as lex_context 2020-03-05 17:19:17 +09:00
Nobuyoshi Nakada
c8d0bf0156
Preserve kwarg flag and fix up f5c904c2a9 2020-03-03 16:19:49 +09:00
Nobuyoshi Nakada
85620ffaa6
Reduced parser stack usage by merging non-result actions 2020-03-02 16:45:46 +09:00
Nobuyoshi Nakada
20a2ab0825
Packed stacked bit flags into one struct 2020-03-02 16:34:33 +09:00
Nobuyoshi Nakada
f5c904c2a9
Allow newlines inside braced pattern 2020-03-02 15:49:03 +09:00
Kazuki Tsujimoto
d25a4f413d
Allow trailing comma in hash pattern 2020-03-01 14:35:48 +09:00
Nobuyoshi Nakada
403675e8dc
Named tLABEL token 2020-02-29 21:42:38 +09:00
Nobuyoshi Nakada
07f27383b7
Refined argument name 2020-02-28 20:10:46 +09:00
Nobuyoshi Nakada
6e6844320d Fixed duplicated warning
As `command_rhs` is always a "value expression", `command_asgn`
does not need the same check.
2020-02-10 14:00:40 +09:00