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
data/ext/edn_turbo/main.cc
CHANGED
@@ -17,6 +17,8 @@ namespace edn {
|
|
17
17
|
VALUE EDNT_MAKE_EDN_SYMBOL = Qnil;
|
18
18
|
VALUE EDNT_MAKE_SET_METHOD = Qnil;
|
19
19
|
VALUE EDNT_TAGGED_ELEM = Qnil;
|
20
|
+
VALUE EDNT_STR_INT_TO_BIGNUM = Qnil;
|
21
|
+
VALUE EDNT_STR_DBL_TO_BIGNUM = Qnil;
|
20
22
|
|
21
23
|
|
22
24
|
void die(int sig)
|
@@ -49,6 +51,8 @@ void Init_edn_turbo(void)
|
|
49
51
|
edn::EDNT_MAKE_EDN_SYMBOL = rb_intern("make_edn_symbol");
|
50
52
|
edn::EDNT_MAKE_SET_METHOD = rb_intern("make_set");
|
51
53
|
edn::EDNT_TAGGED_ELEM = rb_intern("tagged_element");
|
54
|
+
edn::EDNT_STR_INT_TO_BIGNUM = rb_intern("string_int_to_bignum");
|
55
|
+
edn::EDNT_STR_DBL_TO_BIGNUM = rb_intern("string_double_to_bignum");
|
52
56
|
|
53
57
|
// bind the ruby Parser class to the C++ one
|
54
58
|
Rice::Data_Type<edn::Parser> rb_cParser =
|
data/lib/edn_turbo/version.rb
CHANGED
data/lib/edn_turbo.rb
CHANGED
@@ -77,4 +77,18 @@ module EDNT
|
|
77
77
|
EDN::Type::Symbol.new(elem)
|
78
78
|
end
|
79
79
|
|
80
|
+
# ----------------------------------------------------------------------------
|
81
|
+
# to create Big Ints (for now)
|
82
|
+
#
|
83
|
+
def self.string_int_to_bignum(str)
|
84
|
+
str.to_i
|
85
|
+
end
|
86
|
+
|
87
|
+
# ----------------------------------------------------------------------------
|
88
|
+
# to create Big Ints (for now)
|
89
|
+
#
|
90
|
+
def self.string_double_to_bignum(str)
|
91
|
+
str.to_f
|
92
|
+
end
|
93
|
+
|
80
94
|
end # EDN namespace
|
data/test/test_output_diff.rb
CHANGED
@@ -30,7 +30,8 @@ class EDNT_Test < Minitest::Test
|
|
30
30
|
|
31
31
|
check_file('test/number.edn',
|
32
32
|
[0, 0, 5, 12, 232, -98798, 13213, 0.11, 231.312, -2321.0, 11.22, 432,
|
33
|
-
|
33
|
+
123412341231212121241234,
|
34
|
+
123412341231212121241234,
|
34
35
|
4.54e+44, 4.5e+44]
|
35
36
|
)
|
36
37
|
end
|
@@ -46,7 +47,7 @@ class EDNT_Test < Minitest::Test
|
|
46
47
|
|
47
48
|
check_file('test/values.edn',
|
48
49
|
[false, true, nil, "this is a test", "this\tis\\only\ta\ttest\rof\"various\nescaped\\values",
|
49
|
-
"c", "
|
50
|
+
"c", "\\n", "\\t",
|
50
51
|
"123➪456®789"]
|
51
52
|
)
|
52
53
|
end
|
@@ -116,14 +117,14 @@ class EDNT_Test < Minitest::Test
|
|
116
117
|
|
117
118
|
def test_map
|
118
119
|
|
119
|
-
check_file('test/
|
120
|
+
check_file('test/map1.edn',
|
120
121
|
{:key_a1=>true,:key_a2=>false,:key_a3=>[1, 2, 3, "test string", nil, {1=>2}],
|
121
122
|
:key_a4=>{:key_a31=>23, :key_a32=>24.4},"string_key"=>:kval,
|
122
123
|
:embedded=>[true, {:c2g_md5=>"2bbee1cd3045710db6fec432b00d1e0c"}],
|
123
124
|
2=>{:a=>:b}}
|
124
125
|
)
|
125
126
|
|
126
|
-
check_file('test/
|
127
|
+
check_file('test/map2.edn',
|
127
128
|
{:int=>1, :string=>"hello", :char=>"a", :array=>[0, 1], :hash=>{:key=>"value"}}
|
128
129
|
)
|
129
130
|
end
|
@@ -165,9 +166,8 @@ class EDNT_Test < Minitest::Test
|
|
165
166
|
EDN::Type::Symbol.new('<'),
|
166
167
|
EDN::Type::Symbol.new('&'),
|
167
168
|
EDN::Type::Symbol.new('='),
|
168
|
-
|
169
|
-
|
170
|
-
# EDN::Type::Symbol.new('+'),
|
169
|
+
EDN::Type::Symbol.new('-'),
|
170
|
+
EDN::Type::Symbol.new('+'),
|
171
171
|
]
|
172
172
|
)
|
173
173
|
|
@@ -183,7 +183,7 @@ class EDNT_Test < Minitest::Test
|
|
183
183
|
|
184
184
|
def test_packard
|
185
185
|
|
186
|
-
check_file('test/
|
186
|
+
check_file('test/map3.edn',
|
187
187
|
{:meta=>{:data_format_version=>304,
|
188
188
|
:filename=>"test/colorspan.pdf",
|
189
189
|
:is_ok=>true,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edn_turbo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Porras
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: edn
|