edn_turbo 0.3.2 → 0.3.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 +10 -9
- data/ext/edn_turbo/edn_parser.cc +269 -267
- data/ext/edn_turbo/edn_parser.rl +2 -0
- data/ext/edn_turbo/edn_parser_util.cc +3 -0
- data/ext/edn_turbo/extconf.rb +6 -8
- data/ext/edn_turbo/main.cc +6 -6
- data/lib/edn_turbo/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a087faff28667fe082bf7562ae36b749db1ee77
|
4
|
+
data.tar.gz: 50e07981c8864a7257a3a3fc99054b839719404c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2876add49e35091384d97a89ffd8d7f9306a08ebd4854443c21700c3417c1fea48806e2bcc7c582b752d810c6ab86ef2f9d7b146669e4713a54b2226db0f00a3
|
7
|
+
data.tar.gz: fd59be0e552b7cf5d4932179553dc2ae971dee20cd927e2ef7c05a7f88c1bbc12827b95e94faa36c2d91dbd3df152b6e7c5fecd834cf0bb70a8fe6f8530168e4
|
data/README.md
CHANGED
@@ -18,13 +18,13 @@ and `edn_turbo` (see [issue 12](https://github.com/relevance/edn-ruby/issues/12)
|
|
18
18
|
irb(main):004:0> s = "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
|
19
19
|
=> "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
|
20
20
|
irb(main):005:0> Benchmark.realtime { 100.times { EDN::read(s) } }
|
21
|
-
=> 0.
|
21
|
+
=> 0.0786
|
22
22
|
irb(main):006:0> Benchmark.realtime { 100.times { EDNT::read(s) } }
|
23
|
-
=> 0.
|
23
|
+
=> 0.002991
|
24
24
|
irb(main):007:0> Benchmark.realtime { 100000.times { EDN::read(s) } }
|
25
|
-
=>
|
25
|
+
=> 72.421565
|
26
26
|
irb(main):008:0> Benchmark.realtime { 100000.times { EDNT::read(s) } }
|
27
|
-
=> 2.
|
27
|
+
=> 2.993059
|
28
28
|
```
|
29
29
|
|
30
30
|
Dependencies
|
@@ -57,7 +57,7 @@ Simlar to `edn-ruby`:
|
|
57
57
|
|
58
58
|
File.open(filename) do |file|
|
59
59
|
output = EDNT.read(file)
|
60
|
-
pp output if output !=
|
60
|
+
pp output if output != EOF
|
61
61
|
end
|
62
62
|
|
63
63
|
# also accepts a string
|
@@ -78,7 +78,7 @@ Or instantiate and reuse an instance of a parser:
|
|
78
78
|
p = EDNT::Parser.new
|
79
79
|
File.open(filename) do |file|
|
80
80
|
output = p.parse(file)
|
81
|
-
pp output if output !=
|
81
|
+
pp output if output != EOF
|
82
82
|
end
|
83
83
|
|
84
84
|
# with a string
|
@@ -92,7 +92,7 @@ Or instantiate and reuse an instance of a parser:
|
|
92
92
|
# parse token by token
|
93
93
|
loop do
|
94
94
|
t = p.read
|
95
|
-
break if t ==
|
95
|
+
break if t == EOF
|
96
96
|
|
97
97
|
pp t
|
98
98
|
end
|
@@ -101,8 +101,9 @@ Or instantiate and reuse an instance of a parser:
|
|
101
101
|
|
102
102
|
Known problems
|
103
103
|
==============
|
104
|
-
v0.3.
|
104
|
+
v0.3.2:
|
105
105
|
|
106
106
|
- Some unhandled corner cases with operators and spacing
|
107
107
|
remain. `edn_turbo` handles things like `1 / 12` and `1/ 12` but
|
108
|
-
parse errors occur with `1/12` and `1 /12
|
108
|
+
parse errors occur with `1/12` and `1 /12` because it treats `/12`
|
109
|
+
as an invalid symbol.
|