code-ruby 4.0.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/code/concerns/shared.rb +13 -13
- data/lib/code/object/decimal.rb +6 -4
- data/lib/code/object/list.rb +1 -1
- data/lib/code/object/range.rb +3 -5
- data/lib/code/parser.rb +33 -32
- metadata +31 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cf58797cc85a08488f3a8b34e55f03f2a6d76172b1af5acd440985b84652dda
|
|
4
|
+
data.tar.gz: 721c6ee890033cb5e174837b5fae19ff6fde3275a60cd4131c3feff1055eacc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a29ba0ce27a4fa35b5ca789bef6b27f4d92d8a0338d4560b423984ad98ad82b62f19238622f17c0ce68851aa8e105e04dbb712ec26e986220b526f67ed51913
|
|
7
|
+
data.tar.gz: 4d39906874334a806ce488dce62966a299e1bc382317d793cecc759affa4e7514392f8a1f007bd1e2379e2e855f5c0752abc98cf07ab2f1ab0ee4876fb77b527
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5.0.0
|
data/lib/code/concerns/shared.rb
CHANGED
|
@@ -5,19 +5,19 @@ class Code
|
|
|
5
5
|
module Shared
|
|
6
6
|
attr_accessor :raw, :functions
|
|
7
7
|
|
|
8
|
-
COMPOUND_ASSIGNMENT_OPERATORS =
|
|
9
|
-
+=
|
|
10
|
-
-=
|
|
11
|
-
*=
|
|
12
|
-
/=
|
|
13
|
-
%=
|
|
14
|
-
<<=
|
|
15
|
-
>>=
|
|
16
|
-
&=
|
|
17
|
-
|=
|
|
18
|
-
^=
|
|
19
|
-
||=
|
|
20
|
-
&&=
|
|
8
|
+
COMPOUND_ASSIGNMENT_OPERATORS = [
|
|
9
|
+
"+=",
|
|
10
|
+
"-=",
|
|
11
|
+
"*=",
|
|
12
|
+
"/=",
|
|
13
|
+
"%=",
|
|
14
|
+
"<<=",
|
|
15
|
+
">>=",
|
|
16
|
+
"&=",
|
|
17
|
+
"|=",
|
|
18
|
+
"^=",
|
|
19
|
+
"||=",
|
|
20
|
+
"&&="
|
|
21
21
|
].freeze
|
|
22
22
|
SHARED_OPERATORS = %w[
|
|
23
23
|
documentation
|
data/lib/code/object/decimal.rb
CHANGED
|
@@ -1541,10 +1541,12 @@ class Code
|
|
|
1541
1541
|
|
|
1542
1542
|
def code_to_precision(precision = nil)
|
|
1543
1543
|
code_precision = precision.to_code
|
|
1544
|
-
code_precision
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1544
|
+
if code_precision.nothing?
|
|
1545
|
+
code_precision =
|
|
1546
|
+
Integer.new(
|
|
1547
|
+
raw.to_s("F").delete(".-").length
|
|
1548
|
+
)
|
|
1549
|
+
end
|
|
1548
1550
|
|
|
1549
1551
|
String.new(format("%.#{code_precision.raw}g", raw))
|
|
1550
1552
|
end
|
data/lib/code/object/list.rb
CHANGED
data/lib/code/object/range.rb
CHANGED
|
@@ -660,12 +660,10 @@ class Code
|
|
|
660
660
|
else
|
|
661
661
|
code_element.code_less_or_equal(code_right)
|
|
662
662
|
end
|
|
663
|
+
elsif exclude_end?
|
|
664
|
+
code_element.code_greater(code_right)
|
|
663
665
|
else
|
|
664
|
-
|
|
665
|
-
code_element.code_greater(code_right)
|
|
666
|
-
else
|
|
667
|
-
code_element.code_greater_or_equal(code_right)
|
|
668
|
-
end
|
|
666
|
+
code_element.code_greater_or_equal(code_right)
|
|
669
667
|
end
|
|
670
668
|
|
|
671
669
|
break unless comparison.truthy?
|
data/lib/code/parser.rb
CHANGED
|
@@ -32,42 +32,43 @@ class Code
|
|
|
32
32
|
while
|
|
33
33
|
].freeze
|
|
34
34
|
|
|
35
|
-
MULTI_CHAR_OPERATORS =
|
|
36
|
-
&.
|
|
37
|
-
&&
|
|
38
|
-
&&=
|
|
39
|
-
**
|
|
40
|
-
*=
|
|
41
|
-
+=
|
|
42
|
-
-=
|
|
43
|
-
..
|
|
44
|
-
...
|
|
45
|
-
/=
|
|
46
|
-
::
|
|
47
|
-
<<=
|
|
48
|
-
<<
|
|
49
|
-
<=>
|
|
50
|
-
<=
|
|
51
|
-
===
|
|
52
|
-
==
|
|
53
|
-
=~
|
|
54
|
-
>=
|
|
55
|
-
>>=
|
|
56
|
-
>>
|
|
57
|
-
||=
|
|
58
|
-
||
|
|
59
|
-
|=
|
|
60
|
-
!==
|
|
61
|
-
!=
|
|
62
|
-
!~
|
|
63
|
-
%=
|
|
64
|
-
^=
|
|
65
|
-
=>
|
|
35
|
+
MULTI_CHAR_OPERATORS = [
|
|
36
|
+
"&.",
|
|
37
|
+
"&&",
|
|
38
|
+
"&&=",
|
|
39
|
+
"**",
|
|
40
|
+
"*=",
|
|
41
|
+
"+=",
|
|
42
|
+
"-=",
|
|
43
|
+
"..",
|
|
44
|
+
"...",
|
|
45
|
+
"/=",
|
|
46
|
+
"::",
|
|
47
|
+
"<<=",
|
|
48
|
+
"<<",
|
|
49
|
+
"<=>",
|
|
50
|
+
"<=",
|
|
51
|
+
"===",
|
|
52
|
+
"==",
|
|
53
|
+
"=~",
|
|
54
|
+
">=",
|
|
55
|
+
">>=",
|
|
56
|
+
">>",
|
|
57
|
+
"||=",
|
|
58
|
+
"||",
|
|
59
|
+
"|=",
|
|
60
|
+
"!==",
|
|
61
|
+
"!=",
|
|
62
|
+
"!~",
|
|
63
|
+
"%=",
|
|
64
|
+
"^=",
|
|
65
|
+
"=>"
|
|
66
66
|
].sort_by(&:length).reverse.freeze
|
|
67
67
|
CONTINUATION_KEYWORDS = %w[or and rescue].freeze
|
|
68
68
|
POSTFIX_CONTINUATIONS = %w[. :: &.].freeze
|
|
69
69
|
HORIZONTAL_WHITESPACE = [" ", "\t"].freeze
|
|
70
70
|
NEWLINE_CHARACTERS = ["\n", "\r"].freeze
|
|
71
|
+
QUOTE_CHARACTERS = ["'", '"'].freeze
|
|
71
72
|
PUNCTUATION_CHARACTERS = %w[( ) [ ] { } , ? :].freeze
|
|
72
73
|
OPERATOR_CHARACTERS = %w[. & | = ! ~ + - * / % < > ^ × ÷].freeze
|
|
73
74
|
SUFFIX_PUNCTUATION = %w[! ?].freeze
|
|
@@ -1266,7 +1267,7 @@ class Code
|
|
|
1266
1267
|
next
|
|
1267
1268
|
end
|
|
1268
1269
|
|
|
1269
|
-
if
|
|
1270
|
+
if QUOTE_CHARACTERS.include?(char)
|
|
1270
1271
|
quote = char
|
|
1271
1272
|
elsif char == "#"
|
|
1272
1273
|
while i < source.length && !NEWLINE_CHARACTERS.include?(source[i])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: code-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dorian Marié
|
|
@@ -15,7 +15,7 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 7.1.6
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
21
|
version: '9'
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
requirements:
|
|
26
26
|
- - ">="
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version:
|
|
28
|
+
version: 7.1.6
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '9'
|
|
@@ -35,7 +35,7 @@ dependencies:
|
|
|
35
35
|
requirements:
|
|
36
36
|
- - ">="
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
|
-
version:
|
|
38
|
+
version: 0.3.0
|
|
39
39
|
- - "<"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '1'
|
|
@@ -45,7 +45,7 @@ dependencies:
|
|
|
45
45
|
requirements:
|
|
46
46
|
- - ">="
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version:
|
|
48
|
+
version: 0.3.0
|
|
49
49
|
- - "<"
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
51
|
version: '1'
|
|
@@ -55,7 +55,7 @@ dependencies:
|
|
|
55
55
|
requirements:
|
|
56
56
|
- - ">="
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version:
|
|
58
|
+
version: 4.1.2
|
|
59
59
|
- - "<"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '5'
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
requirements:
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 4.1.2
|
|
69
69
|
- - "<"
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
71
|
version: '5'
|
|
@@ -75,7 +75,7 @@ dependencies:
|
|
|
75
75
|
requirements:
|
|
76
76
|
- - ">="
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
|
-
version:
|
|
78
|
+
version: 0.1.1
|
|
79
79
|
- - "<"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '1'
|
|
@@ -85,7 +85,7 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: 0.1.1
|
|
89
89
|
- - "<"
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
91
|
version: '1'
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
requirements:
|
|
96
96
|
- - ">="
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
|
-
version:
|
|
98
|
+
version: 1.2.3
|
|
99
99
|
- - "<"
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
101
|
version: '2'
|
|
@@ -105,7 +105,7 @@ dependencies:
|
|
|
105
105
|
requirements:
|
|
106
106
|
- - ">="
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version:
|
|
108
|
+
version: 1.2.3
|
|
109
109
|
- - "<"
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
111
|
version: '2'
|
|
@@ -115,7 +115,7 @@ dependencies:
|
|
|
115
115
|
requirements:
|
|
116
116
|
- - ">="
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
|
-
version:
|
|
118
|
+
version: 2.12.3
|
|
119
119
|
- - "<"
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
121
|
version: '3'
|
|
@@ -125,7 +125,7 @@ dependencies:
|
|
|
125
125
|
requirements:
|
|
126
126
|
- - ">="
|
|
127
127
|
- !ruby/object:Gem::Version
|
|
128
|
-
version:
|
|
128
|
+
version: 2.12.3
|
|
129
129
|
- - "<"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
131
|
version: '3'
|
|
@@ -135,7 +135,7 @@ dependencies:
|
|
|
135
135
|
requirements:
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version:
|
|
138
|
+
version: 2.20.0
|
|
139
139
|
- - "<"
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
version: '3'
|
|
@@ -145,7 +145,7 @@ dependencies:
|
|
|
145
145
|
requirements:
|
|
146
146
|
- - ">="
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
version:
|
|
148
|
+
version: 2.20.0
|
|
149
149
|
- - "<"
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
151
|
version: '3'
|
|
@@ -155,7 +155,7 @@ dependencies:
|
|
|
155
155
|
requirements:
|
|
156
156
|
- - ">="
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version:
|
|
158
|
+
version: 1.2.0
|
|
159
159
|
- - "<"
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
161
|
version: '2'
|
|
@@ -165,7 +165,7 @@ dependencies:
|
|
|
165
165
|
requirements:
|
|
166
166
|
- - ">="
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
|
-
version:
|
|
168
|
+
version: 1.2.0
|
|
169
169
|
- - "<"
|
|
170
170
|
- !ruby/object:Gem::Version
|
|
171
171
|
version: '2'
|
|
@@ -175,7 +175,7 @@ dependencies:
|
|
|
175
175
|
requirements:
|
|
176
176
|
- - ">="
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version:
|
|
178
|
+
version: 2.9.0
|
|
179
179
|
- - "<"
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '3'
|
|
@@ -185,7 +185,7 @@ dependencies:
|
|
|
185
185
|
requirements:
|
|
186
186
|
- - ">="
|
|
187
187
|
- !ruby/object:Gem::Version
|
|
188
|
-
version:
|
|
188
|
+
version: 2.9.0
|
|
189
189
|
- - "<"
|
|
190
190
|
- !ruby/object:Gem::Version
|
|
191
191
|
version: '3'
|
|
@@ -195,7 +195,7 @@ dependencies:
|
|
|
195
195
|
requirements:
|
|
196
196
|
- - ">="
|
|
197
197
|
- !ruby/object:Gem::Version
|
|
198
|
-
version:
|
|
198
|
+
version: 0.9.1
|
|
199
199
|
- - "<"
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
201
|
version: '1'
|
|
@@ -205,7 +205,7 @@ dependencies:
|
|
|
205
205
|
requirements:
|
|
206
206
|
- - ">="
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version:
|
|
208
|
+
version: 0.9.1
|
|
209
209
|
- - "<"
|
|
210
210
|
- !ruby/object:Gem::Version
|
|
211
211
|
version: '1'
|
|
@@ -215,7 +215,7 @@ dependencies:
|
|
|
215
215
|
requirements:
|
|
216
216
|
- - ">="
|
|
217
217
|
- !ruby/object:Gem::Version
|
|
218
|
-
version:
|
|
218
|
+
version: 0.5.1
|
|
219
219
|
- - "<"
|
|
220
220
|
- !ruby/object:Gem::Version
|
|
221
221
|
version: '1'
|
|
@@ -225,7 +225,7 @@ dependencies:
|
|
|
225
225
|
requirements:
|
|
226
226
|
- - ">="
|
|
227
227
|
- !ruby/object:Gem::Version
|
|
228
|
-
version:
|
|
228
|
+
version: 0.5.1
|
|
229
229
|
- - "<"
|
|
230
230
|
- !ruby/object:Gem::Version
|
|
231
231
|
version: '1'
|
|
@@ -235,7 +235,7 @@ dependencies:
|
|
|
235
235
|
requirements:
|
|
236
236
|
- - ">="
|
|
237
237
|
- !ruby/object:Gem::Version
|
|
238
|
-
version:
|
|
238
|
+
version: 1.17.2
|
|
239
239
|
- - "<"
|
|
240
240
|
- !ruby/object:Gem::Version
|
|
241
241
|
version: '2'
|
|
@@ -245,7 +245,7 @@ dependencies:
|
|
|
245
245
|
requirements:
|
|
246
246
|
- - ">="
|
|
247
247
|
- !ruby/object:Gem::Version
|
|
248
|
-
version:
|
|
248
|
+
version: 1.17.2
|
|
249
249
|
- - "<"
|
|
250
250
|
- !ruby/object:Gem::Version
|
|
251
251
|
version: '2'
|
|
@@ -255,7 +255,7 @@ dependencies:
|
|
|
255
255
|
requirements:
|
|
256
256
|
- - ">="
|
|
257
257
|
- !ruby/object:Gem::Version
|
|
258
|
-
version:
|
|
258
|
+
version: 1.1.1
|
|
259
259
|
- - "<"
|
|
260
260
|
- !ruby/object:Gem::Version
|
|
261
261
|
version: '2'
|
|
@@ -265,7 +265,7 @@ dependencies:
|
|
|
265
265
|
requirements:
|
|
266
266
|
- - ">="
|
|
267
267
|
- !ruby/object:Gem::Version
|
|
268
|
-
version:
|
|
268
|
+
version: 1.1.1
|
|
269
269
|
- - "<"
|
|
270
270
|
- !ruby/object:Gem::Version
|
|
271
271
|
version: '2'
|
|
@@ -275,7 +275,7 @@ dependencies:
|
|
|
275
275
|
requirements:
|
|
276
276
|
- - ">="
|
|
277
277
|
- !ruby/object:Gem::Version
|
|
278
|
-
version:
|
|
278
|
+
version: 2.6.18
|
|
279
279
|
- - "<"
|
|
280
280
|
- !ruby/object:Gem::Version
|
|
281
281
|
version: '3'
|
|
@@ -285,7 +285,7 @@ dependencies:
|
|
|
285
285
|
requirements:
|
|
286
286
|
- - ">="
|
|
287
287
|
- !ruby/object:Gem::Version
|
|
288
|
-
version:
|
|
288
|
+
version: 2.6.18
|
|
289
289
|
- - "<"
|
|
290
290
|
- !ruby/object:Gem::Version
|
|
291
291
|
version: '3'
|
|
@@ -401,14 +401,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
401
401
|
requirements:
|
|
402
402
|
- - ">="
|
|
403
403
|
- !ruby/object:Gem::Version
|
|
404
|
-
version: '
|
|
404
|
+
version: '4.0'
|
|
405
405
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
406
406
|
requirements:
|
|
407
407
|
- - ">="
|
|
408
408
|
- !ruby/object:Gem::Version
|
|
409
409
|
version: '0'
|
|
410
410
|
requirements: []
|
|
411
|
-
rubygems_version:
|
|
411
|
+
rubygems_version: 4.0.15
|
|
412
412
|
specification_version: 4
|
|
413
413
|
summary: a programming language for the internet
|
|
414
414
|
test_files: []
|