tomlrb 1.1.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -2
- data/benchmarks/bench.rb +22 -0
- data/lib/tomlrb.rb +12 -0
- data/lib/tomlrb/generated_parser.rb +129 -111
- data/lib/tomlrb/parser.y +2 -0
- data/lib/tomlrb/version.rb +1 -1
- data/tomlrb.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21a84cd729f768805a6d87dfcb4fe3f9f8101883
|
4
|
+
data.tar.gz: f10d3fe2e68cc831ad06befd5849c52bab2e6053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513910102b04380af2d7bdc56918b241ebcfbf60f39da0046112ee6296932616a4f95539db886dc4f9737570e5c80cf07f0a2cbae8c3580656f3990109053e0f
|
7
|
+
data.tar.gz: d75ce7bfb8f665dbac1aeddba1096f88312cb269cdd44c33e0e9c387d3d5383b03e796b839d1954b9c191239393332e098992e65926da9350d32af0a33554bdc
|
data/README.md
CHANGED
@@ -7,7 +7,6 @@ A Racc based [TOML](https://github.com/toml-lang/toml) Ruby parser supporting th
|
|
7
7
|
|
8
8
|
## TODO
|
9
9
|
|
10
|
-
* YARD documentation
|
11
10
|
* Better tests
|
12
11
|
* Dumper
|
13
12
|
|
@@ -39,6 +38,26 @@ or
|
|
39
38
|
Tomlrb.load_file('my_file', symbolize_keys: true)
|
40
39
|
```
|
41
40
|
|
41
|
+
## Benchmark
|
42
|
+
|
43
|
+
You can run the benchmark against the only other v0.4.0 compliant parser to my knowledge with `ruby benchmarks/bench.rb`.
|
44
|
+
|
45
|
+
Here are the results on my machine:
|
46
|
+
|
47
|
+
```
|
48
|
+
Calculating -------------------------------------
|
49
|
+
emancu/toml-rb 1.000 i/100ms
|
50
|
+
fbernier/tomlrb 46.000 i/100ms
|
51
|
+
-------------------------------------------------
|
52
|
+
emancu/toml-rb 13.657 (± 7.3%) i/s - 69.000
|
53
|
+
fbernier/tomlrb 486.095 (± 3.5%) i/s - 2.438k
|
54
|
+
|
55
|
+
Comparison:
|
56
|
+
fbernier/tomlrb: 486.1 i/s
|
57
|
+
emancu/toml-rb: 13.7 i/s - 35.59x slower
|
58
|
+
|
59
|
+
```
|
60
|
+
|
42
61
|
## Development
|
43
62
|
|
44
63
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -57,6 +76,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
57
76
|
4. Push to the branch (`git push origin my-new-feature`)
|
58
77
|
5. Create a new Pull Request
|
59
78
|
|
60
|
-
|
79
|
+
## Thanks
|
61
80
|
|
62
81
|
Thanks to [@jpbougie](https://github.com/jpbougie) for the crash course on the Chomsky hierarchy and general tips.
|
data/benchmarks/bench.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'benchmark/ips'
|
2
|
+
require_relative '../lib/tomlrb'
|
3
|
+
begin
|
4
|
+
require 'toml'
|
5
|
+
rescue LoadError
|
6
|
+
puts "Install toml-rb using 'gem install toml-rb' first."
|
7
|
+
end
|
8
|
+
|
9
|
+
data = File.read(File.join(__dir__, '../test/example-v0.4.0.toml'))
|
10
|
+
|
11
|
+
Benchmark.ips do |x|
|
12
|
+
|
13
|
+
x.report("emancu/toml-rb") do
|
14
|
+
TOML.parse(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
x.report("fbernier/tomlrb") do
|
18
|
+
Tomlrb.parse(data)
|
19
|
+
end
|
20
|
+
|
21
|
+
x.compare!
|
22
|
+
end
|
data/lib/tomlrb.rb
CHANGED
@@ -9,6 +9,12 @@ require "tomlrb/handler"
|
|
9
9
|
module Tomlrb
|
10
10
|
class ParseError < StandardError; end
|
11
11
|
|
12
|
+
# Parses a valid TOML string into its Ruby data structure
|
13
|
+
#
|
14
|
+
# @param string_or_io [String, StringIO] the content
|
15
|
+
# @param options [Hash] the options hash
|
16
|
+
# @option options [Boolean] :symbolize_keys (false) whether to return the keys as symbols or strings
|
17
|
+
# @return [Hash] the Ruby data structure represented by the input
|
12
18
|
def self.parse(string_or_io, **options)
|
13
19
|
io = string_or_io.is_a?(String) ? StringIO.new(string_or_io) : string_or_io
|
14
20
|
scanner = Scanner.new(io)
|
@@ -22,6 +28,12 @@ module Tomlrb
|
|
22
28
|
handler.output
|
23
29
|
end
|
24
30
|
|
31
|
+
# Reads a file content and parses it into its Ruby data structure
|
32
|
+
#
|
33
|
+
# @param path [String] the path to the file
|
34
|
+
# @param options [Hash] the options hash
|
35
|
+
# @option options [Boolean] :symbolize_keys (false) whether to return the keys as symbols or strings
|
36
|
+
# @return [Hash] the Ruby data structure represented by the input
|
25
37
|
def self.load_file(path, **options)
|
26
38
|
Tomlrb.parse(File.read(path), options)
|
27
39
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.4.
|
3
|
+
# This file is automatically generated by Racc 1.4.13
|
4
4
|
# from Racc grammer file "".
|
5
5
|
#
|
6
6
|
|
@@ -10,70 +10,72 @@ module Tomlrb
|
|
10
10
|
##### State transition tables begin ###
|
11
11
|
|
12
12
|
racc_action_table = [
|
13
|
-
2,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
44,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
2, 54, 11, 25, 12, 25, 65, 18, 13, 19,
|
14
|
+
66, 34, 8, 20, 28, 10, 27, 23, 16, 23,
|
15
|
+
48, 49, 50, 51, 47, 44, 43, 45, 46, 37,
|
16
|
+
31, 32, 10, 48, 49, 50, 51, 47, 44, 43,
|
17
|
+
45, 46, 37, 61, 26, 10, 48, 49, 50, 51,
|
18
|
+
47, 44, 43, 45, 46, 37, 61, 14, 10, 48,
|
19
|
+
49, 50, 51, 47, 44, 43, 45, 46, 37, 57,
|
20
|
+
58, 10, 48, 49, 50, 51, 47, 44, 43, 45,
|
21
|
+
46, 37, 29, 21, 10, 48, 49, 50, 51, 47,
|
22
|
+
44, 43, 45, 46, 37, nil, 18, 10, 19, nil,
|
23
|
+
nil, nil, 20, nil, nil, nil, nil, 16 ]
|
23
24
|
|
24
25
|
racc_action_check = [
|
25
|
-
1,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
1, 31, 1, 58, 1, 9, 62, 7, 1, 7,
|
27
|
+
62, 24, 1, 7, 13, 1, 12, 58, 7, 9,
|
28
|
+
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
29
|
+
17, 17, 26, 66, 66, 66, 66, 66, 66, 66,
|
30
|
+
66, 66, 66, 66, 11, 66, 36, 36, 36, 36,
|
31
|
+
36, 36, 36, 36, 36, 36, 36, 2, 36, 34,
|
32
|
+
34, 34, 34, 34, 34, 34, 34, 34, 34, 33,
|
33
|
+
33, 34, 27, 27, 27, 27, 27, 27, 27, 27,
|
34
|
+
27, 27, 16, 8, 27, 28, 28, 28, 28, 28,
|
35
|
+
28, 28, 28, 28, 28, nil, 32, 28, 32, nil,
|
36
|
+
nil, nil, 32, nil, nil, nil, nil, 32 ]
|
35
37
|
|
36
38
|
racc_action_pointer = [
|
37
|
-
nil, 0,
|
38
|
-
nil,
|
39
|
-
nil, nil,
|
40
|
-
|
39
|
+
nil, 0, 57, nil, nil, nil, nil, 5, 71, 3,
|
40
|
+
nil, 26, -2, -4, nil, nil, 69, 17, nil, nil,
|
41
|
+
nil, nil, nil, nil, -7, nil, 17, 69, 82, nil,
|
42
|
+
nil, -12, 94, 53, 56, nil, 43, nil, nil, nil,
|
41
43
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
42
|
-
nil, nil, nil, nil,
|
43
|
-
nil, nil,
|
44
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 1, nil,
|
45
|
+
nil, nil, -7, nil, nil, nil, 30, nil ]
|
44
46
|
|
45
47
|
racc_action_default = [
|
46
|
-
-1, -
|
47
|
-
-
|
48
|
-
-17,
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-29, -30, -
|
48
|
+
-1, -50, -50, -2, -3, -4, -5, -50, -8, -50,
|
49
|
+
-19, -50, -50, -50, 68, -6, -10, -50, -15, -16,
|
50
|
+
-17, -7, -18, -20, -50, -24, -40, -40, -40, -9,
|
51
|
+
-11, -13, -50, -50, -40, -26, -40, -34, -35, -36,
|
52
|
+
-37, -38, -39, -41, -42, -43, -44, -45, -46, -47,
|
53
|
+
-48, -49, -27, -28, -12, -14, -21, -22, -50, -25,
|
54
|
+
-29, -30, -50, -23, -31, -32, -40, -33 ]
|
53
55
|
|
54
56
|
racc_goto_table = [
|
55
|
-
|
56
|
-
|
57
|
-
nil, nil, nil, nil,
|
58
|
-
|
59
|
-
nil, nil, nil, nil, nil,
|
57
|
+
22, 60, 15, 35, 52, 53, 30, 7, 1, 6,
|
58
|
+
5, 59, 33, 56, 4, 3, 64, nil, nil, nil,
|
59
|
+
nil, nil, nil, nil, nil, nil, nil, 55, nil, nil,
|
60
|
+
nil, 67, nil, nil, nil, nil, nil, nil, nil, nil,
|
61
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 63 ]
|
60
62
|
|
61
63
|
racc_goto_check = [
|
62
|
-
11, 18, 7, 15, 15,
|
63
|
-
15,
|
64
|
-
nil, nil, nil, nil,
|
65
|
-
18, nil, nil, nil, nil, nil, nil, nil, nil,
|
66
|
-
nil, nil, nil, nil, nil, 11 ]
|
64
|
+
11, 18, 7, 15, 15, 15, 9, 6, 1, 5,
|
65
|
+
4, 15, 13, 14, 3, 2, 19, nil, nil, nil,
|
66
|
+
nil, nil, nil, nil, nil, nil, nil, 7, nil, nil,
|
67
|
+
nil, 18, nil, nil, nil, nil, nil, nil, nil, nil,
|
68
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 11 ]
|
67
69
|
|
68
70
|
racc_goto_pointer = [
|
69
|
-
nil,
|
70
|
-
nil, -9, nil,
|
71
|
+
nil, 8, 14, 13, 9, 8, 6, -5, nil, -11,
|
72
|
+
nil, -9, nil, -12, -20, -23, nil, nil, -35, -46,
|
71
73
|
nil, nil, nil ]
|
72
74
|
|
73
75
|
racc_goto_default = [
|
74
|
-
nil, nil, nil, nil, nil,
|
75
|
-
9, nil,
|
76
|
-
|
76
|
+
nil, nil, nil, nil, nil, 40, nil, nil, 17, nil,
|
77
|
+
9, nil, 24, nil, nil, 62, 39, 36, nil, nil,
|
78
|
+
38, 41, 42 ]
|
77
79
|
|
78
80
|
racc_reduce_table = [
|
79
81
|
0, 0, :racc_error,
|
@@ -93,41 +95,43 @@ racc_reduce_table = [
|
|
93
95
|
2, 28, :_reduce_none,
|
94
96
|
1, 27, :_reduce_15,
|
95
97
|
1, 27, :_reduce_16,
|
98
|
+
1, 27, :_reduce_17,
|
96
99
|
2, 24, :_reduce_none,
|
97
|
-
1, 29, :
|
98
|
-
1, 30, :
|
100
|
+
1, 29, :_reduce_19,
|
101
|
+
1, 30, :_reduce_20,
|
99
102
|
3, 30, :_reduce_none,
|
100
|
-
1, 33, :
|
103
|
+
1, 33, :_reduce_22,
|
101
104
|
2, 33, :_reduce_none,
|
102
|
-
1, 31, :
|
105
|
+
1, 31, :_reduce_24,
|
103
106
|
2, 32, :_reduce_none,
|
104
|
-
3, 23, :_reduce_25,
|
105
107
|
3, 23, :_reduce_26,
|
108
|
+
3, 23, :_reduce_27,
|
109
|
+
3, 23, :_reduce_28,
|
106
110
|
2, 35, :_reduce_none,
|
107
|
-
1, 37, :
|
111
|
+
1, 37, :_reduce_30,
|
108
112
|
2, 37, :_reduce_none,
|
109
|
-
1, 38, :
|
113
|
+
1, 38, :_reduce_32,
|
110
114
|
2, 38, :_reduce_none,
|
111
|
-
1, 36, :
|
112
|
-
1, 34, :
|
115
|
+
1, 36, :_reduce_34,
|
116
|
+
1, 34, :_reduce_35,
|
113
117
|
1, 34, :_reduce_none,
|
114
118
|
1, 34, :_reduce_none,
|
115
119
|
1, 39, :_reduce_none,
|
116
120
|
1, 39, :_reduce_none,
|
117
121
|
0, 41, :_reduce_none,
|
118
|
-
1, 41, :_reduce_39,
|
119
|
-
1, 41, :_reduce_40,
|
120
122
|
1, 41, :_reduce_41,
|
121
123
|
1, 41, :_reduce_42,
|
122
124
|
1, 41, :_reduce_43,
|
123
|
-
1,
|
124
|
-
1,
|
125
|
+
1, 41, :_reduce_44,
|
126
|
+
1, 41, :_reduce_45,
|
125
127
|
1, 40, :_reduce_46,
|
126
|
-
1, 40, :_reduce_47
|
128
|
+
1, 40, :_reduce_47,
|
129
|
+
1, 40, :_reduce_48,
|
130
|
+
1, 40, :_reduce_49 ]
|
127
131
|
|
128
|
-
racc_reduce_n =
|
132
|
+
racc_reduce_n = 50
|
129
133
|
|
130
|
-
racc_shift_n =
|
134
|
+
racc_shift_n = 68
|
131
135
|
|
132
136
|
racc_token_table = {
|
133
137
|
false => 0,
|
@@ -292,68 +296,73 @@ module_eval(<<'.,.,', 'parser.y', 30)
|
|
292
296
|
end
|
293
297
|
.,.,
|
294
298
|
|
295
|
-
|
299
|
+
module_eval(<<'.,.,', 'parser.y', 31)
|
300
|
+
def _reduce_17(val, _values, result)
|
301
|
+
@handler.push(val[0])
|
302
|
+
result
|
303
|
+
end
|
304
|
+
.,.,
|
305
|
+
|
306
|
+
# reduce 18 omitted
|
296
307
|
|
297
|
-
module_eval(<<'.,.,', 'parser.y',
|
298
|
-
def
|
308
|
+
module_eval(<<'.,.,', 'parser.y', 37)
|
309
|
+
def _reduce_19(val, _values, result)
|
299
310
|
@handler.start_(:inline)
|
300
311
|
result
|
301
312
|
end
|
302
313
|
.,.,
|
303
314
|
|
304
|
-
module_eval(<<'.,.,', 'parser.y',
|
305
|
-
def
|
315
|
+
module_eval(<<'.,.,', 'parser.y', 40)
|
316
|
+
def _reduce_20(val, _values, result)
|
306
317
|
array = @handler.end_(:inline); @handler.push(Hash[*array])
|
307
318
|
result
|
308
319
|
end
|
309
320
|
.,.,
|
310
321
|
|
311
|
-
# reduce
|
322
|
+
# reduce 21 omitted
|
312
323
|
|
313
|
-
module_eval(<<'.,.,', 'parser.y',
|
314
|
-
def
|
324
|
+
module_eval(<<'.,.,', 'parser.y', 44)
|
325
|
+
def _reduce_22(val, _values, result)
|
315
326
|
array = @handler.end_(:inline); @handler.push(Hash[*array])
|
316
327
|
result
|
317
328
|
end
|
318
329
|
.,.,
|
319
330
|
|
320
|
-
# reduce
|
331
|
+
# reduce 23 omitted
|
321
332
|
|
322
|
-
module_eval(<<'.,.,', 'parser.y',
|
323
|
-
def
|
333
|
+
module_eval(<<'.,.,', 'parser.y', 48)
|
334
|
+
def _reduce_24(val, _values, result)
|
324
335
|
@handler.push(val[0])
|
325
336
|
result
|
326
337
|
end
|
327
338
|
.,.,
|
328
339
|
|
329
|
-
# reduce
|
340
|
+
# reduce 25 omitted
|
330
341
|
|
331
|
-
module_eval(<<'.,.,', 'parser.y',
|
332
|
-
def
|
342
|
+
module_eval(<<'.,.,', 'parser.y', 54)
|
343
|
+
def _reduce_26(val, _values, result)
|
333
344
|
@handler.assign(val[0])
|
334
345
|
result
|
335
346
|
end
|
336
347
|
.,.,
|
337
348
|
|
338
|
-
module_eval(<<'.,.,', 'parser.y',
|
339
|
-
def
|
349
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
350
|
+
def _reduce_27(val, _values, result)
|
340
351
|
@handler.assign(val[0])
|
341
352
|
result
|
342
353
|
end
|
343
354
|
.,.,
|
344
355
|
|
345
|
-
|
346
|
-
|
347
|
-
module_eval(<<'.,.,', 'parser.y', 60)
|
356
|
+
module_eval(<<'.,.,', 'parser.y', 56)
|
348
357
|
def _reduce_28(val, _values, result)
|
349
|
-
|
358
|
+
@handler.assign(val[0])
|
350
359
|
result
|
351
360
|
end
|
352
361
|
.,.,
|
353
362
|
|
354
363
|
# reduce 29 omitted
|
355
364
|
|
356
|
-
module_eval(<<'.,.,', 'parser.y',
|
365
|
+
module_eval(<<'.,.,', 'parser.y', 62)
|
357
366
|
def _reduce_30(val, _values, result)
|
358
367
|
array = @handler.end_(:array); @handler.push(array)
|
359
368
|
result
|
@@ -362,88 +371,97 @@ module_eval(<<'.,.,', 'parser.y', 64)
|
|
362
371
|
|
363
372
|
# reduce 31 omitted
|
364
373
|
|
365
|
-
module_eval(<<'.,.,', 'parser.y',
|
374
|
+
module_eval(<<'.,.,', 'parser.y', 66)
|
366
375
|
def _reduce_32(val, _values, result)
|
376
|
+
array = @handler.end_(:array); @handler.push(array)
|
377
|
+
result
|
378
|
+
end
|
379
|
+
.,.,
|
380
|
+
|
381
|
+
# reduce 33 omitted
|
382
|
+
|
383
|
+
module_eval(<<'.,.,', 'parser.y', 70)
|
384
|
+
def _reduce_34(val, _values, result)
|
367
385
|
@handler.start_(:array)
|
368
386
|
result
|
369
387
|
end
|
370
388
|
.,.,
|
371
389
|
|
372
|
-
module_eval(<<'.,.,', 'parser.y',
|
373
|
-
def
|
390
|
+
module_eval(<<'.,.,', 'parser.y', 73)
|
391
|
+
def _reduce_35(val, _values, result)
|
374
392
|
@handler.push(val[0])
|
375
393
|
result
|
376
394
|
end
|
377
395
|
.,.,
|
378
396
|
|
379
|
-
# reduce 34 omitted
|
380
|
-
|
381
|
-
# reduce 35 omitted
|
382
|
-
|
383
397
|
# reduce 36 omitted
|
384
398
|
|
385
399
|
# reduce 37 omitted
|
386
400
|
|
387
401
|
# reduce 38 omitted
|
388
402
|
|
389
|
-
|
390
|
-
|
403
|
+
# reduce 39 omitted
|
404
|
+
|
405
|
+
# reduce 40 omitted
|
406
|
+
|
407
|
+
module_eval(<<'.,.,', 'parser.y', 82)
|
408
|
+
def _reduce_41(val, _values, result)
|
391
409
|
result = val[0].to_f
|
392
410
|
result
|
393
411
|
end
|
394
412
|
.,.,
|
395
413
|
|
396
|
-
module_eval(<<'.,.,', 'parser.y',
|
397
|
-
def
|
414
|
+
module_eval(<<'.,.,', 'parser.y', 83)
|
415
|
+
def _reduce_42(val, _values, result)
|
398
416
|
result = val[0].to_i
|
399
417
|
result
|
400
418
|
end
|
401
419
|
.,.,
|
402
420
|
|
403
|
-
module_eval(<<'.,.,', 'parser.y',
|
404
|
-
def
|
421
|
+
module_eval(<<'.,.,', 'parser.y', 84)
|
422
|
+
def _reduce_43(val, _values, result)
|
405
423
|
result = true
|
406
424
|
result
|
407
425
|
end
|
408
426
|
.,.,
|
409
427
|
|
410
|
-
module_eval(<<'.,.,', 'parser.y',
|
411
|
-
def
|
428
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
429
|
+
def _reduce_44(val, _values, result)
|
412
430
|
result = false
|
413
431
|
result
|
414
432
|
end
|
415
433
|
.,.,
|
416
434
|
|
417
|
-
module_eval(<<'.,.,', 'parser.y',
|
418
|
-
def
|
435
|
+
module_eval(<<'.,.,', 'parser.y', 86)
|
436
|
+
def _reduce_45(val, _values, result)
|
419
437
|
result = Time.new(*val[0])
|
420
438
|
result
|
421
439
|
end
|
422
440
|
.,.,
|
423
441
|
|
424
|
-
module_eval(<<'.,.,', 'parser.y',
|
425
|
-
def
|
442
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
443
|
+
def _reduce_46(val, _values, result)
|
426
444
|
result = StringUtils.replace_escaped_chars(StringUtils.multiline_replacements(val[0]))
|
427
445
|
result
|
428
446
|
end
|
429
447
|
.,.,
|
430
448
|
|
431
|
-
module_eval(<<'.,.,', 'parser.y',
|
432
|
-
def
|
449
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
450
|
+
def _reduce_47(val, _values, result)
|
433
451
|
result = StringUtils.replace_escaped_chars(val[0])
|
434
452
|
result
|
435
453
|
end
|
436
454
|
.,.,
|
437
455
|
|
438
|
-
module_eval(<<'.,.,', 'parser.y',
|
439
|
-
def
|
456
|
+
module_eval(<<'.,.,', 'parser.y', 91)
|
457
|
+
def _reduce_48(val, _values, result)
|
440
458
|
result = StringUtils.replace_escaped_chars(StringUtils.strip_spaces(val[0]))
|
441
459
|
result
|
442
460
|
end
|
443
461
|
.,.,
|
444
462
|
|
445
|
-
module_eval(<<'.,.,', 'parser.y',
|
446
|
-
def
|
463
|
+
module_eval(<<'.,.,', 'parser.y', 92)
|
464
|
+
def _reduce_49(val, _values, result)
|
447
465
|
result = StringUtils.strip_spaces(val[0])
|
448
466
|
result
|
449
467
|
end
|
data/lib/tomlrb/parser.y
CHANGED
@@ -29,6 +29,7 @@ rule
|
|
29
29
|
table_identifier
|
30
30
|
: IDENTIFIER { @handler.push(val[0]) }
|
31
31
|
| STRING_BASIC { @handler.push(val[0]) }
|
32
|
+
| INTEGER { @handler.push(val[0]) }
|
32
33
|
;
|
33
34
|
inline_table
|
34
35
|
: inline_table_start inline_continued
|
@@ -53,6 +54,7 @@ rule
|
|
53
54
|
assignment
|
54
55
|
: IDENTIFIER '=' value { @handler.assign(val[0]) }
|
55
56
|
| STRING_BASIC '=' value { @handler.assign(val[0]) }
|
57
|
+
| INTEGER '=' value { @handler.assign(val[0]) }
|
56
58
|
;
|
57
59
|
array
|
58
60
|
: start_array array_continued
|
data/lib/tomlrb/version.rb
CHANGED
data/tomlrb.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomlrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Bernier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: benchmark-ips
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: A racc based toml parser
|
112
126
|
email:
|
113
127
|
- frankbernier@gmail.com
|
@@ -121,6 +135,7 @@ files:
|
|
121
135
|
- LICENSE.txt
|
122
136
|
- README.md
|
123
137
|
- Rakefile
|
138
|
+
- benchmarks/bench.rb
|
124
139
|
- bin/console
|
125
140
|
- bin/setup
|
126
141
|
- lib/tomlrb.rb
|
@@ -152,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
167
|
version: '0'
|
153
168
|
requirements: []
|
154
169
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.4.5
|
170
|
+
rubygems_version: 2.4.5.1
|
156
171
|
signing_key:
|
157
172
|
specification_version: 4
|
158
173
|
summary: A racc based toml parser
|