tomlrb 1.1.3 → 1.2.0

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
  SHA1:
3
- metadata.gz: 21a84cd729f768805a6d87dfcb4fe3f9f8101883
4
- data.tar.gz: f10d3fe2e68cc831ad06befd5849c52bab2e6053
3
+ metadata.gz: 12dad2a5be7aad4016c49bbaeefb4b7b714ba4eb
4
+ data.tar.gz: f7531b3f857e1a57ae69641068905425d6bf7c9d
5
5
  SHA512:
6
- metadata.gz: 513910102b04380af2d7bdc56918b241ebcfbf60f39da0046112ee6296932616a4f95539db886dc4f9737570e5c80cf07f0a2cbae8c3580656f3990109053e0f
7
- data.tar.gz: d75ce7bfb8f665dbac1aeddba1096f88312cb269cdd44c33e0e9c387d3d5383b03e796b839d1954b9c191239393332e098992e65926da9350d32af0a33554bdc
6
+ metadata.gz: 2f7d1a1fa6d07c7b8e56d43c19d116be4e240c33c7c3a89c53333446a6a91bef145d3eb57b196313d2f5484127aacb60ea897eb6a516b0783cc096c3fabe4864
7
+ data.tar.gz: 049ce3a8c57d5e90b637af3db7585daff1eb39db77572ec4f707176f916fd0c45489dcc370f422f85533ec2250665376463fbcaaef8224575813ef61977e8b22
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 1.1.3 - 2015-11-24
2
+
3
+ * Bare integers can be used as keys as per the spec
@@ -10,39 +10,39 @@ module Tomlrb
10
10
  ##### State transition tables begin ###
11
11
 
12
12
  racc_action_table = [
13
- 2, 54, 11, 25, 12, 25, 65, 18, 13, 19,
14
- 66, 34, 8, 20, 28, 10, 27, 23, 16, 23,
13
+ 2, 14, 11, 25, 12, 25, 65, 18, 13, 19,
14
+ 66, 34, 8, 20, 29, 10, 21, 23, 16, 23,
15
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,
16
+ 61, 26, 10, 48, 49, 50, 51, 47, 44, 43,
17
+ 45, 46, 37, 31, 32, 10, 48, 49, 50, 51,
18
+ 47, 44, 43, 45, 46, 37, 57, 58, 10, 48,
19
+ 49, 50, 51, 47, 44, 43, 45, 46, 37, 27,
20
+ 28, 10, 48, 49, 50, 51, 47, 44, 43, 45,
21
+ 46, 37, 54, nil, 10, 48, 49, 50, 51, 47,
22
+ 44, 43, 45, 46, 37, 61, 18, 10, 19, nil,
23
23
  nil, nil, 20, nil, nil, nil, nil, 16 ]
24
24
 
25
25
  racc_action_check = [
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,
26
+ 1, 2, 1, 9, 1, 58, 62, 7, 1, 7,
27
+ 62, 24, 1, 7, 16, 1, 8, 9, 7, 58,
28
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
29
+ 66, 11, 66, 26, 26, 26, 26, 26, 26, 26,
30
+ 26, 26, 26, 17, 17, 26, 27, 27, 27, 27,
31
+ 27, 27, 27, 27, 27, 27, 33, 33, 27, 28,
32
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 12,
33
+ 13, 28, 34, 34, 34, 34, 34, 34, 34, 34,
34
+ 34, 34, 31, nil, 34, 36, 36, 36, 36, 36,
35
+ 36, 36, 36, 36, 36, 36, 32, 36, 32, nil,
36
36
  nil, nil, 32, nil, nil, nil, nil, 32 ]
37
37
 
38
38
  racc_action_pointer = [
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,
39
+ nil, 0, 1, nil, nil, nil, nil, 5, 4, 1,
40
+ nil, 13, 51, 52, nil, nil, 1, 30, nil, nil,
41
+ nil, nil, nil, nil, -7, nil, 30, 43, 56, nil,
42
+ nil, 69, 94, 40, 69, nil, 82, nil, nil, nil,
43
43
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
44
- nil, nil, nil, nil, nil, nil, nil, nil, 1, nil,
45
- nil, nil, -7, nil, nil, nil, 30, nil ]
44
+ nil, nil, nil, nil, nil, nil, nil, nil, 3, nil,
45
+ nil, nil, -7, nil, nil, nil, 17, nil ]
46
46
 
47
47
  racc_action_default = [
48
48
  -1, -50, -50, -2, -3, -4, -5, -50, -8, -50,
@@ -54,22 +54,22 @@ racc_action_default = [
54
54
  -29, -30, -50, -23, -31, -32, -40, -33 ]
55
55
 
56
56
  racc_goto_table = [
57
- 22, 60, 15, 35, 52, 53, 30, 7, 1, 6,
58
- 5, 59, 33, 56, 4, 3, 64, nil, nil, nil,
57
+ 22, 60, 15, 35, 52, 53, 6, 7, 30, 33,
58
+ 56, 59, 1, 64, 3, 4, 5, nil, nil, nil,
59
59
  nil, nil, nil, nil, nil, nil, nil, 55, nil, nil,
60
60
  nil, 67, nil, nil, nil, nil, nil, nil, nil, nil,
61
61
  nil, nil, nil, nil, nil, nil, nil, nil, nil, 63 ]
62
62
 
63
63
  racc_goto_check = [
64
- 11, 18, 7, 15, 15, 15, 9, 6, 1, 5,
65
- 4, 15, 13, 14, 3, 2, 19, nil, nil, nil,
64
+ 11, 18, 7, 15, 15, 15, 5, 6, 9, 13,
65
+ 14, 15, 1, 19, 2, 3, 4, nil, nil, nil,
66
66
  nil, nil, nil, nil, nil, nil, nil, 7, nil, nil,
67
67
  nil, 18, nil, nil, nil, nil, nil, nil, nil, nil,
68
68
  nil, nil, nil, nil, nil, nil, nil, nil, nil, 11 ]
69
69
 
70
70
  racc_goto_pointer = [
71
- nil, 8, 14, 13, 9, 8, 6, -5, nil, -11,
72
- nil, -9, nil, -12, -20, -23, nil, nil, -35, -46,
71
+ nil, 12, 13, 14, 15, 5, 6, -5, nil, -9,
72
+ nil, -9, nil, -15, -23, -23, nil, nil, -35, -49,
73
73
  nil, nil, nil ]
74
74
 
75
75
  racc_goto_default = [
@@ -321,16 +321,19 @@ module_eval(<<'.,.,', 'parser.y', 40)
321
321
 
322
322
  # reduce 21 omitted
323
323
 
324
- module_eval(<<'.,.,', 'parser.y', 44)
324
+ module_eval(<<'.,.,', 'parser.y', 45)
325
325
  def _reduce_22(val, _values, result)
326
- array = @handler.end_(:inline); @handler.push(Hash[*array])
326
+ array = @handler.end_(:inline)
327
+ array.map!.with_index{ |n,i| i.even? ? n.to_sym : n } if @handler.symbolize_keys
328
+ @handler.push(Hash[*array])
329
+
327
330
  result
328
331
  end
329
332
  .,.,
330
333
 
331
334
  # reduce 23 omitted
332
335
 
333
- module_eval(<<'.,.,', 'parser.y', 48)
336
+ module_eval(<<'.,.,', 'parser.y', 52)
334
337
  def _reduce_24(val, _values, result)
335
338
  @handler.push(val[0])
336
339
  result
@@ -339,21 +342,21 @@ module_eval(<<'.,.,', 'parser.y', 48)
339
342
 
340
343
  # reduce 25 omitted
341
344
 
342
- module_eval(<<'.,.,', 'parser.y', 54)
345
+ module_eval(<<'.,.,', 'parser.y', 58)
343
346
  def _reduce_26(val, _values, result)
344
347
  @handler.assign(val[0])
345
348
  result
346
349
  end
347
350
  .,.,
348
351
 
349
- module_eval(<<'.,.,', 'parser.y', 55)
352
+ module_eval(<<'.,.,', 'parser.y', 59)
350
353
  def _reduce_27(val, _values, result)
351
354
  @handler.assign(val[0])
352
355
  result
353
356
  end
354
357
  .,.,
355
358
 
356
- module_eval(<<'.,.,', 'parser.y', 56)
359
+ module_eval(<<'.,.,', 'parser.y', 60)
357
360
  def _reduce_28(val, _values, result)
358
361
  @handler.assign(val[0])
359
362
  result
@@ -362,7 +365,7 @@ module_eval(<<'.,.,', 'parser.y', 56)
362
365
 
363
366
  # reduce 29 omitted
364
367
 
365
- module_eval(<<'.,.,', 'parser.y', 62)
368
+ module_eval(<<'.,.,', 'parser.y', 66)
366
369
  def _reduce_30(val, _values, result)
367
370
  array = @handler.end_(:array); @handler.push(array)
368
371
  result
@@ -371,7 +374,7 @@ module_eval(<<'.,.,', 'parser.y', 62)
371
374
 
372
375
  # reduce 31 omitted
373
376
 
374
- module_eval(<<'.,.,', 'parser.y', 66)
377
+ module_eval(<<'.,.,', 'parser.y', 70)
375
378
  def _reduce_32(val, _values, result)
376
379
  array = @handler.end_(:array); @handler.push(array)
377
380
  result
@@ -380,14 +383,14 @@ module_eval(<<'.,.,', 'parser.y', 66)
380
383
 
381
384
  # reduce 33 omitted
382
385
 
383
- module_eval(<<'.,.,', 'parser.y', 70)
386
+ module_eval(<<'.,.,', 'parser.y', 74)
384
387
  def _reduce_34(val, _values, result)
385
388
  @handler.start_(:array)
386
389
  result
387
390
  end
388
391
  .,.,
389
392
 
390
- module_eval(<<'.,.,', 'parser.y', 73)
393
+ module_eval(<<'.,.,', 'parser.y', 77)
391
394
  def _reduce_35(val, _values, result)
392
395
  @handler.push(val[0])
393
396
  result
@@ -404,63 +407,63 @@ module_eval(<<'.,.,', 'parser.y', 73)
404
407
 
405
408
  # reduce 40 omitted
406
409
 
407
- module_eval(<<'.,.,', 'parser.y', 82)
410
+ module_eval(<<'.,.,', 'parser.y', 86)
408
411
  def _reduce_41(val, _values, result)
409
412
  result = val[0].to_f
410
413
  result
411
414
  end
412
415
  .,.,
413
416
 
414
- module_eval(<<'.,.,', 'parser.y', 83)
417
+ module_eval(<<'.,.,', 'parser.y', 87)
415
418
  def _reduce_42(val, _values, result)
416
419
  result = val[0].to_i
417
420
  result
418
421
  end
419
422
  .,.,
420
423
 
421
- module_eval(<<'.,.,', 'parser.y', 84)
424
+ module_eval(<<'.,.,', 'parser.y', 88)
422
425
  def _reduce_43(val, _values, result)
423
426
  result = true
424
427
  result
425
428
  end
426
429
  .,.,
427
430
 
428
- module_eval(<<'.,.,', 'parser.y', 85)
431
+ module_eval(<<'.,.,', 'parser.y', 89)
429
432
  def _reduce_44(val, _values, result)
430
433
  result = false
431
434
  result
432
435
  end
433
436
  .,.,
434
437
 
435
- module_eval(<<'.,.,', 'parser.y', 86)
438
+ module_eval(<<'.,.,', 'parser.y', 90)
436
439
  def _reduce_45(val, _values, result)
437
440
  result = Time.new(*val[0])
438
441
  result
439
442
  end
440
443
  .,.,
441
444
 
442
- module_eval(<<'.,.,', 'parser.y', 89)
445
+ module_eval(<<'.,.,', 'parser.y', 93)
443
446
  def _reduce_46(val, _values, result)
444
447
  result = StringUtils.replace_escaped_chars(StringUtils.multiline_replacements(val[0]))
445
448
  result
446
449
  end
447
450
  .,.,
448
451
 
449
- module_eval(<<'.,.,', 'parser.y', 90)
452
+ module_eval(<<'.,.,', 'parser.y', 94)
450
453
  def _reduce_47(val, _values, result)
451
454
  result = StringUtils.replace_escaped_chars(val[0])
452
455
  result
453
456
  end
454
457
  .,.,
455
458
 
456
- module_eval(<<'.,.,', 'parser.y', 91)
459
+ module_eval(<<'.,.,', 'parser.y', 95)
457
460
  def _reduce_48(val, _values, result)
458
461
  result = StringUtils.replace_escaped_chars(StringUtils.strip_spaces(val[0]))
459
462
  result
460
463
  end
461
464
  .,.,
462
465
 
463
- module_eval(<<'.,.,', 'parser.y', 92)
466
+ module_eval(<<'.,.,', 'parser.y', 96)
464
467
  def _reduce_49(val, _values, result)
465
468
  result = StringUtils.strip_spaces(val[0])
466
469
  result
@@ -1,6 +1,6 @@
1
1
  module Tomlrb
2
2
  class Handler
3
- attr_reader :output
3
+ attr_reader :output, :symbolize_keys
4
4
 
5
5
  def initialize(**options)
6
6
  @output = {}
data/lib/tomlrb/parser.y CHANGED
@@ -42,7 +42,11 @@ rule
42
42
  | inline_assignment_key inline_assignment_value inline_next
43
43
  ;
44
44
  inline_next
45
- : '}' { array = @handler.end_(:inline); @handler.push(Hash[*array]) }
45
+ : '}' {
46
+ array = @handler.end_(:inline)
47
+ array.map!.with_index{ |n,i| i.even? ? n.to_sym : n } if @handler.symbolize_keys
48
+ @handler.push(Hash[*array])
49
+ }
46
50
  | ',' inline_continued
47
51
  ;
48
52
  inline_assignment_key
@@ -1,3 +1,3 @@
1
1
  module Tomlrb
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.0"
3
3
  end
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.3
4
+ version: 1.2.0
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-23 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ extra_rdoc_files: []
131
131
  files:
132
132
  - ".gitignore"
133
133
  - ".travis.yml"
134
+ - CHANGELOG.md
134
135
  - Gemfile
135
136
  - LICENSE.txt
136
137
  - README.md