edn_turbo 0.2.0 → 0.2.1
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/README.md +18 -6
- data/Rakefile +6 -3
- data/ext/edn_turbo/edn_parser.cc +1140 -414
- data/ext/edn_turbo/edn_parser.h +24 -17
- data/ext/edn_turbo/edn_parser.rl +208 -85
- data/ext/edn_turbo/edn_parser_def.cc +61 -14
- data/ext/edn_turbo/main.cc +4 -0
- data/lib/edn_turbo/version.rb +2 -2
- data/lib/edn_turbo.rb +14 -0
- data/test/test_output_diff.rb +8 -8
- 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: 41f78cfbb6704e1d0a4f7e1336d62609c3c10d18
|
4
|
+
data.tar.gz: 0a8080b1e3356f9e6f743b27670ee9d8ccba4769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45b5f73a05bee804ca8159d7e6b42ca39fde77545c7ed36a67b5f1197e7ac88e45a2e41a08179eba2f8ad6f7f5ab5bc51ee9f67cbbd12d8dbdbe0a95679df33
|
7
|
+
data.tar.gz: 98f1c888c9eeb40fabd89f48a81a9e8178321393cb6f74e49d078b1ae8e1e1f39be8653c7bda51f37a45811cbcca97a99505439c0afa052da65fe4da25b148fe
|
data/README.md
CHANGED
@@ -5,10 +5,11 @@ Ruby C-extension for parsing EDN files.
|
|
5
5
|
|
6
6
|
Written based on the functionality of
|
7
7
|
[edn](https://github.com/relevance/edn-ruby) but with the goal of
|
8
|
-
achieving much faster parsing.
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
achieving much faster parsing.
|
9
|
+
|
10
|
+
As of v0.2.0, `edn_turbo` requires `edn` to support tagged elements
|
11
|
+
using a similar API and return types. The eventual goal is to bundle
|
12
|
+
`edn_turbo` as an optional parser for `edn`.
|
12
13
|
|
13
14
|
Some quick sample runs comparing time output of file reads using `edn`
|
14
15
|
and `edn_turbo`:
|
@@ -52,11 +53,11 @@ Dependencies
|
|
52
53
|
- [rake 10.3.2](http://rake.rubyforge.org)
|
53
54
|
- [rake-compiler 0.9.2](http://rake-compiler.rubyforge.org)
|
54
55
|
- [rice 1.7.0](http://rice.rubyforge.org)
|
56
|
+
- [edn 1.0.7](https://github.com/relevance/edn-ruby)
|
55
57
|
- [icu4c](http://icu-project.org/apiref/icu4c/)
|
56
58
|
|
57
59
|
`edn_turbo` uses a ragel-based parser but the generated .cc file is
|
58
|
-
bundled so ragel should not need to be installed.
|
59
|
-
|
60
|
+
bundled so ragel should not need to be installed.
|
60
61
|
|
61
62
|
Usage
|
62
63
|
=====
|
@@ -68,3 +69,14 @@ Usage
|
|
68
69
|
pp output if output != nil
|
69
70
|
end
|
70
71
|
```
|
72
|
+
|
73
|
+
Known problems
|
74
|
+
==============
|
75
|
+
As of v0.2.0:
|
76
|
+
|
77
|
+
- Need to support stand-alone `-` and `+` symbols as well as named
|
78
|
+
symbols with a leading `-`. The current set of parsers expect only
|
79
|
+
numeric values to optionally lead with a `-` so support for the
|
80
|
+
other two cases requires refactoring of the parser logic
|
81
|
+
- Need to check handling of discards at the root level. Discards
|
82
|
+
within containers looks to work 100% as far as I know.
|
data/Rakefile
CHANGED
@@ -7,7 +7,6 @@ NAME = 'edn_turbo'
|
|
7
7
|
LIB_DIR = "lib/#{NAME}"
|
8
8
|
EXT_BUNDLE = "#{LIB_DIR}/#{NAME}.#{RbConfig::CONFIG['DLEXT']}"
|
9
9
|
|
10
|
-
|
11
10
|
EXT_PATH = "ext/#{NAME}"
|
12
11
|
RAGEL_PARSER_SRC = "edn_parser.rl"
|
13
12
|
RAGEL_PARSER_SRC_PATH = "#{EXT_PATH}/#{RAGEL_PARSER_SRC}"
|
@@ -23,6 +22,8 @@ task :chmod do
|
|
23
22
|
File.chmod(0775, EXT_BUNDLE)
|
24
23
|
end
|
25
24
|
|
25
|
+
CLEAN.include(["*.png", "*.gem"])
|
26
|
+
|
26
27
|
task :ragel => GEN_CC_PARSER_SRC_PATH
|
27
28
|
|
28
29
|
|
@@ -34,9 +35,11 @@ file GEN_CC_PARSER_SRC_PATH => RAGEL_PARSER_SRC_PATH do
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
+
|
39
|
+
task :graph, [:machine] do |t, args|
|
40
|
+
args.with_defaults(:machine => 'EDN_value')
|
38
41
|
TMPFILE='/tmp/ragel_edn'
|
39
|
-
MACHINE=
|
42
|
+
MACHINE=args[:machine]
|
40
43
|
|
41
44
|
# assumes graphviz is installed
|
42
45
|
sh "ragel -Vp -S #{MACHINE} -o #{TMPFILE} #{EXT_PATH}/#{RAGEL_PARSER_SRC} && dot -Tpng #{TMPFILE} -o #{MACHINE}.png"
|