code-ruby 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/code/parser/list.rb +7 -2
- data/lib/code/parser/name.rb +1 -1
- data/lib/code/version.rb +1 -1
- data/spec/code_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf105ec027258dabb4bca7a9b2246a1babc47f5557a47bc885fe9ddf1fea3bc7
|
4
|
+
data.tar.gz: 1976ef6aee479a4adfc402c58cbba49fbf175561a28d69784ccd7818ad13664d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68677a0f868274367d97fa0692b6f289a3ed90533b7fa5c104be5c84275e241791111ad5191004ac7fa88de3faf4a0331a064fa6e403ad1b1d18e8283847f030
|
7
|
+
data.tar.gz: 17615b062f51e946d979b84da8e05d9c48d711a909c29bae426576a973336b8b3b7858b2d484692e33caf58be5d931dfde69a61b763cf39c5616141d60b6f71e
|
data/lib/code/parser/list.rb
CHANGED
@@ -4,6 +4,10 @@ class Code
|
|
4
4
|
class Parser
|
5
5
|
class List < Language
|
6
6
|
def code
|
7
|
+
Code
|
8
|
+
end
|
9
|
+
|
10
|
+
def code_present
|
7
11
|
Code.new.present
|
8
12
|
end
|
9
13
|
|
@@ -28,13 +32,14 @@ class Code
|
|
28
32
|
end
|
29
33
|
|
30
34
|
def element
|
31
|
-
|
35
|
+
(whitespace? << code_present << (whitespace? << comma).maybe) |
|
36
|
+
(whitespace? << code << whitespace? << comma)
|
32
37
|
end
|
33
38
|
|
34
39
|
def root
|
35
40
|
(
|
36
41
|
opening_square_bracket.ignore << whitespace? <<
|
37
|
-
|
42
|
+
element.repeat <<
|
38
43
|
(whitespace? << closing_square_bracket.ignore).maybe
|
39
44
|
).aka(:list) | String
|
40
45
|
end
|
data/lib/code/parser/name.rb
CHANGED
data/lib/code/version.rb
CHANGED
data/spec/code_spec.rb
CHANGED
@@ -68,6 +68,11 @@ RSpec.describe Code do
|
|
68
68
|
["[1, 2, 3]", "[1, 2, 3]"],
|
69
69
|
["[1, 2, 3].include?(2)", "true"],
|
70
70
|
["[1, 2, 3].include?(4)", "false"],
|
71
|
+
["[1, 2, 3,].include?(4)", "false"],
|
72
|
+
["[1, 2, 3, \n ].include?(4)", "false"],
|
73
|
+
["[1].each do end", "[1]"],
|
74
|
+
["[,].include?(4)", "false"],
|
75
|
+
["[,,].include?(4)", "false"],
|
71
76
|
["[[true]]", "[[true]]"],
|
72
77
|
["2 * 3", "6"],
|
73
78
|
["2 * 3 + 2", "8"],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|