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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4443807269930ca7780ac7dea378b206922ceb64efd2c67268faf6dc4019ec3
4
- data.tar.gz: f02f48a5adf807a5d02e95906946161b005b0899ebf94be4707add11fccbdfb0
3
+ metadata.gz: bf105ec027258dabb4bca7a9b2246a1babc47f5557a47bc885fe9ddf1fea3bc7
4
+ data.tar.gz: 1976ef6aee479a4adfc402c58cbba49fbf175561a28d69784ccd7818ad13664d
5
5
  SHA512:
6
- metadata.gz: f940cbc1443f45503c5200eec011b9e75057ef6cafd8519884432de7600d2137afc6559e1e5e96f616a6476910b1ace98558e2eba2260cbfac16f1819fde198b
7
- data.tar.gz: 8ca5252fdf014aecf582d52f0bf95a23ff74f34d96ac763c438d88cffd9f02add548303a5502462294f6d823328e4e0e3132313b57d014e358b6de5601ec351e
6
+ metadata.gz: 68677a0f868274367d97fa0692b6f289a3ed90533b7fa5c104be5c84275e241791111ad5191004ac7fa88de3faf4a0331a064fa6e403ad1b1d18e8283847f030
7
+ data.tar.gz: 17615b062f51e946d979b84da8e05d9c48d711a909c29bae426576a973336b8b3b7858b2d484692e33caf58be5d931dfde69a61b763cf39c5616141d60b6f71e
@@ -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
- code
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
- (whitespace? << element << (whitespace? << comma).maybe).repeat <<
42
+ element.repeat <<
38
43
  (whitespace? << closing_square_bracket.ignore).maybe
39
44
  ).aka(:list) | String
40
45
  end
@@ -108,7 +108,7 @@ class Code
108
108
  end
109
109
 
110
110
  def separator
111
- special_character
111
+ special_character | any.absent
112
112
  end
113
113
 
114
114
  def root
data/lib/code/version.rb CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative "../code"
4
4
 
5
- Code::Version = Gem::Version.new("0.7.2")
5
+ Code::Version = Gem::Version.new("0.7.3")
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.2
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 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal