ruby-next-core 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/lib/.rbnext/2.7/ruby-next/language/paco_parsers/string_literals.rb +11 -7
- data/lib/.rbnext/3.2/ruby-next/rubocop.rb +1 -1
- data/lib/ruby-next/language/paco_parsers/string_literals.rb +11 -7
- data/lib/ruby-next/rubocop.rb +1 -1
- data/lib/ruby-next/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d760d668ee7358474931d4a69ebff41ff99aa2d7e300fdbe58aa023e38644422
|
4
|
+
data.tar.gz: f7a982bae326176fb4ac5b991f8b61be10648efe5cfc501a4d81f14b974bc55b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5093c8523a20d95a073254f09e2226e766df69e9ba48692686f34693ba132fe2d5f6d5b08a558d9ef7f7be2842784aded96a181903577d9fbcef060dc8f8c108
|
7
|
+
data.tar.gz: 17df494938c41ce179f64776cb6ce13a966c97ac3ba3f6ac32e0d1d6da7fc38ee7689dc65ef4f6480208ba5190d288f292b03830bcec43756911c0e2092b6669
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -565,6 +565,9 @@ Wonder what would happen if Ruby get a null coalescing operator (`??=`) or some
|
|
565
565
|
|
566
566
|
Ruby Next allows you to write your own syntax rewriters. Full-featured rewriters (used by Ruby Next itself) operate on AST and usually require parser modifications. However, we also support text-based rewriters which can be used to experiment with new syntax much quicker without dealing with grammars, parsers and syntax trees.
|
567
567
|
|
568
|
+
> [!TIP]
|
569
|
+
> You can experiment with Ruby Next rewriters at our [online playground][playground]!
|
570
|
+
|
568
571
|
To implement a text-based rewriter, you need to create a new class inherited from `RubyNext::Language::Rewriters::Text` and implementing either `#rewrite` or `#safe_rewrite` method. For example, the method reference operator (`.:`) could be implemented as follows:
|
569
572
|
|
570
573
|
```ruby
|
@@ -704,3 +707,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
704
707
|
[require-hooks]: https://github.com/ruby-next/require-hooks
|
705
708
|
[Natalie]: https://natalie-lang.org
|
706
709
|
[Paco]: https://github.com/ruby-next/paco
|
710
|
+
[playground]: https://ruby-next.github.io
|
@@ -4,7 +4,7 @@ module RubyNext
|
|
4
4
|
module Language
|
5
5
|
module PacoParsers
|
6
6
|
class StringLiterals < Base
|
7
|
-
PAIRS = {"[" => "]", "{" => "}", "
|
7
|
+
PAIRS = {"[" => "]", "{" => "}", "(" => ")"}.freeze
|
8
8
|
|
9
9
|
def default
|
10
10
|
all_strings.fmap do |result|
|
@@ -24,11 +24,15 @@ module RubyNext
|
|
24
24
|
# heredoc_expanded
|
25
25
|
end
|
26
26
|
|
27
|
+
def literal_start
|
28
|
+
alt(string("{"), string("("), string("["))
|
29
|
+
end
|
30
|
+
|
27
31
|
def quoted
|
28
32
|
seq(
|
29
|
-
string("%q"),
|
30
|
-
|
31
|
-
end_symbol = string(PAIRS
|
33
|
+
alt(string("%q"), string("%s"), string("%r"), string("%i"), string("%w")),
|
34
|
+
literal_start.bind do |char|
|
35
|
+
end_symbol = string(PAIRS.fetch(char))
|
32
36
|
escapable_string(succeed(char), end_symbol)
|
33
37
|
end
|
34
38
|
)
|
@@ -40,9 +44,9 @@ module RubyNext
|
|
40
44
|
|
41
45
|
def quoted_expanded
|
42
46
|
seq(
|
43
|
-
alt(string("%Q"), string("%")),
|
44
|
-
|
45
|
-
end_symbol = string(PAIRS
|
47
|
+
alt(string("%Q"), string("%"), string("%W"), string("%I")),
|
48
|
+
literal_start.bind do |char|
|
49
|
+
end_symbol = string(PAIRS.fetch(char))
|
46
50
|
escapable_string(succeed(char), end_symbol, interpolate: true)
|
47
51
|
end
|
48
52
|
)
|
@@ -4,7 +4,7 @@ module RubyNext
|
|
4
4
|
module Language
|
5
5
|
module PacoParsers
|
6
6
|
class StringLiterals < Base
|
7
|
-
PAIRS = {"[" => "]", "{" => "}", "
|
7
|
+
PAIRS = {"[" => "]", "{" => "}", "(" => ")"}.freeze
|
8
8
|
|
9
9
|
def default
|
10
10
|
all_strings.fmap do |result|
|
@@ -24,11 +24,15 @@ module RubyNext
|
|
24
24
|
# heredoc_expanded
|
25
25
|
end
|
26
26
|
|
27
|
+
def literal_start
|
28
|
+
alt(string("{"), string("("), string("["))
|
29
|
+
end
|
30
|
+
|
27
31
|
def quoted
|
28
32
|
seq(
|
29
|
-
string("%q"),
|
30
|
-
|
31
|
-
end_symbol = string(PAIRS
|
33
|
+
alt(string("%q"), string("%s"), string("%r"), string("%i"), string("%w")),
|
34
|
+
literal_start.bind do |char|
|
35
|
+
end_symbol = string(PAIRS.fetch(char))
|
32
36
|
escapable_string(succeed(char), end_symbol)
|
33
37
|
end
|
34
38
|
)
|
@@ -40,9 +44,9 @@ module RubyNext
|
|
40
44
|
|
41
45
|
def quoted_expanded
|
42
46
|
seq(
|
43
|
-
alt(string("%Q"), string("%")),
|
44
|
-
|
45
|
-
end_symbol = string(PAIRS
|
47
|
+
alt(string("%Q"), string("%"), string("%W"), string("%I")),
|
48
|
+
literal_start.bind do |char|
|
49
|
+
end_symbol = string(PAIRS.fetch(char))
|
46
50
|
escapable_string(succeed(char), end_symbol, interpolate: true)
|
47
51
|
end
|
48
52
|
)
|
data/lib/ruby-next/rubocop.rb
CHANGED
data/lib/ruby-next/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-next-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require-hooks
|
@@ -209,7 +209,7 @@ metadata:
|
|
209
209
|
homepage_uri: https://github.com/ruby-next/ruby-next
|
210
210
|
source_code_uri: https://github.com/ruby-next/ruby-next
|
211
211
|
funding_uri: https://github.com/sponsors/palkan
|
212
|
-
post_install_message:
|
212
|
+
post_install_message:
|
213
213
|
rdoc_options: []
|
214
214
|
require_paths:
|
215
215
|
- lib
|
@@ -224,8 +224,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
- !ruby/object:Gem::Version
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
|
-
rubygems_version: 3.4.
|
228
|
-
signing_key:
|
227
|
+
rubygems_version: 3.4.19
|
228
|
+
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: Ruby Next core functionality
|
231
231
|
test_files: []
|