tomlrb 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tomlrb/scanner.rb +2 -2
- data/lib/tomlrb/version.rb +1 -1
- metadata +4 -15
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -12
- data/Gemfile +0 -13
- data/README.md +0 -80
- data/Rakefile +0 -14
- data/benchmarks/bench.rb +0 -22
- data/bin/console +0 -10
- data/bin/setup +0 -6
- data/tomlrb.gemspec +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed6d567784a3cc9c807a7a0f8fd598df93c61a1814ffb6b332de00f0fb283834
|
4
|
+
data.tar.gz: 750ee2900fc4f8cc4d90943e088888ceb7aafcbff5c59ace2b57672e190213e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0331f20dcfbecaa645c1895febe1459e516592ca25ce27e2f4c85b42933f7041e4ae455a5a0e8581f3893ffb0d23995df549cc2fbbc942615ba0481807673f73
|
7
|
+
data.tar.gz: ec8e6d286acb1cd62c2b336d9fdb6c0cc169c4acd76c9ac2e7e14501ce7a668db4b073c0d9d474a314c129d760af925df17f40006630f0e568e03143e77a84f9
|
data/lib/tomlrb/scanner.rb
CHANGED
@@ -10,8 +10,8 @@ module Tomlrb
|
|
10
10
|
STRING_LITERAL = /(['])(?:\\?.)*?\1/
|
11
11
|
STRING_LITERAL_MULTI = /'{3}([\s\S]*?'{3})/m
|
12
12
|
DATETIME = /(-?\d{4})-(\d{2})-(\d{2})(?:(?:t|\s)(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?))?(z|[-+]\d{2}:\d{2})?/i
|
13
|
-
FLOAT = /[+-]?(?:[0-9_]+\.[0-9_]
|
14
|
-
INTEGER = /[+-]
|
13
|
+
FLOAT = /[+-]?(?:[0-9_]+\.[0-9_]*|\d+(?=[eE]))(?:[eE][+-]?[0-9_]+)?/
|
14
|
+
INTEGER = /[+-]?([1-9](_?\d)*|0)(?![A-Za-z0-9_-]+)/
|
15
15
|
TRUE = /true/
|
16
16
|
FALSE = /false/
|
17
17
|
|
data/lib/tomlrb/version.rb
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.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Bernier
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A racc based toml parser
|
14
14
|
email:
|
@@ -17,16 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".gitignore"
|
21
|
-
- ".travis.yml"
|
22
|
-
- CHANGELOG.md
|
23
|
-
- Gemfile
|
24
20
|
- LICENSE.txt
|
25
|
-
- README.md
|
26
|
-
- Rakefile
|
27
|
-
- benchmarks/bench.rb
|
28
|
-
- bin/console
|
29
|
-
- bin/setup
|
30
21
|
- lib/tomlrb.rb
|
31
22
|
- lib/tomlrb/generated_parser.rb
|
32
23
|
- lib/tomlrb/handler.rb
|
@@ -35,7 +26,6 @@ files:
|
|
35
26
|
- lib/tomlrb/scanner.rb
|
36
27
|
- lib/tomlrb/string_utils.rb
|
37
28
|
- lib/tomlrb/version.rb
|
38
|
-
- tomlrb.gemspec
|
39
29
|
homepage: https://github.com/fbernier/tomlrb
|
40
30
|
licenses:
|
41
31
|
- MIT
|
@@ -55,8 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
45
|
- !ruby/object:Gem::Version
|
56
46
|
version: '0'
|
57
47
|
requirements: []
|
58
|
-
|
59
|
-
rubygems_version: 2.7.6
|
48
|
+
rubygems_version: 3.0.0
|
60
49
|
signing_key:
|
61
50
|
specification_version: 4
|
62
51
|
summary: A racc based toml parser
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
### 1.2.7 - 2018-07-12
|
2
|
-
|
3
|
-
* Datetime should be UTC when no offset or timezone are specified
|
4
|
-
|
5
|
-
### 1.2.6 - 2017-10-23
|
6
|
-
|
7
|
-
* Fix issue where an unclosed table could make the parsing loop infinitely.
|
8
|
-
* Proper string escaping
|
9
|
-
|
10
|
-
### 1.1.3 - 2015-11-24
|
11
|
-
|
12
|
-
* Bare integers can be used as keys as per the spec
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# Tomlrb
|
2
|
-
|
3
|
-
[![Code Climate](https://codeclimate.com/github/fbernier/tomlrb/badges/gpa.svg)](https://codeclimate.com/github/fbernier/tomlrb) [![Build Status](https://travis-ci.org/fbernier/tomlrb.svg)](https://travis-ci.org/fbernier/tomlrb) [![Gem Version](https://badge.fury.io/rb/tomlrb.svg)](http://badge.fury.io/rb/tomlrb)
|
4
|
-
|
5
|
-
A Racc based [TOML](https://github.com/toml-lang/toml) Ruby parser supporting the 0.4.0 version of the spec.
|
6
|
-
|
7
|
-
|
8
|
-
## TODO
|
9
|
-
|
10
|
-
* Better tests
|
11
|
-
* Dumper
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
gem 'tomlrb'
|
19
|
-
```
|
20
|
-
|
21
|
-
And then execute:
|
22
|
-
|
23
|
-
$ bundle
|
24
|
-
|
25
|
-
Or install it yourself as:
|
26
|
-
|
27
|
-
$ gem install tomlrb
|
28
|
-
|
29
|
-
## Usage
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
Tomlrb.parse("[toml]\na = [\"array\", 123]")
|
33
|
-
```
|
34
|
-
|
35
|
-
or
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
Tomlrb.load_file('my_file', symbolize_keys: true)
|
39
|
-
```
|
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
|
-
Warming up --------------------------------------
|
49
|
-
emancu/toml-rb 1.000 i/100ms
|
50
|
-
fbernier/tomlrb 65.000 i/100ms
|
51
|
-
Calculating -------------------------------------
|
52
|
-
emancu/toml-rb 19.199 (± 5.2%) i/s - 96.000 in 5.034377s
|
53
|
-
fbernier/tomlrb 653.650 (± 4.0%) i/s - 3.315k in 5.081117s
|
54
|
-
|
55
|
-
Comparison:
|
56
|
-
fbernier/tomlrb: 653.6 i/s
|
57
|
-
emancu/toml-rb: 19.2 i/s - 34.05x slower
|
58
|
-
```
|
59
|
-
|
60
|
-
## Development
|
61
|
-
|
62
|
-
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.
|
63
|
-
|
64
|
-
Do not forget to regenerate the parser when you modify rules in the `parser.y` file using `rake compile`.
|
65
|
-
|
66
|
-
Run the tests using `rake test`.
|
67
|
-
|
68
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
69
|
-
|
70
|
-
## Contributing
|
71
|
-
|
72
|
-
1. Fork it ( https://github.com/[my-github-username]/tomlrb/fork )
|
73
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
74
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
75
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
76
|
-
5. Create a new Pull Request
|
77
|
-
|
78
|
-
## Thanks
|
79
|
-
|
80
|
-
Thanks to [@jpbougie](https://github.com/jpbougie) for the crash course on the Chomsky hierarchy and general tips.
|
data/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
Rake::TestTask.new do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.test_files = FileList['test/test*.rb']
|
7
|
-
t.verbose = true
|
8
|
-
end
|
9
|
-
|
10
|
-
task default: [:test]
|
11
|
-
|
12
|
-
task :compile do
|
13
|
-
sh 'racc lib/tomlrb/parser.y -o lib/tomlrb/generated_parser.rb'
|
14
|
-
end
|
data/benchmarks/bench.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'benchmark/ips'
|
2
|
-
require_relative '../lib/tomlrb'
|
3
|
-
begin
|
4
|
-
require 'toml-rb'
|
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
|
-
TomlRB.parse(data)
|
15
|
-
end
|
16
|
-
|
17
|
-
x.report("fbernier/tomlrb") do
|
18
|
-
Tomlrb.parse(data)
|
19
|
-
end
|
20
|
-
|
21
|
-
x.compare!
|
22
|
-
end
|
data/bin/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "tomlrb"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
require "byebug"
|
data/bin/setup
DELETED
data/tomlrb.gemspec
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'tomlrb/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "tomlrb"
|
8
|
-
spec.version = Tomlrb::VERSION
|
9
|
-
spec.authors = ["Francois Bernier"]
|
10
|
-
spec.email = ["frankbernier@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{A racc based toml parser}
|
13
|
-
spec.description = %q{A racc based toml parser}
|
14
|
-
spec.homepage = "https://github.com/fbernier/tomlrb"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
spec.required_ruby_version = '>= 2.0'
|
22
|
-
end
|