edn_turbo 0.6.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dir-locals.el +3 -0
- data/CHANGELOG.md +43 -12
- data/LICENSE +1 -1
- data/README.md +11 -3
- data/Rakefile +7 -15
- data/docker/Dockerfile +40 -0
- data/docker/build +11 -0
- data/docker/common.sh +28 -0
- data/docker/console +11 -0
- data/docker/docker-compose.yml +22 -0
- data/docker/entrypoint +3 -0
- data/docker/make-check +8 -0
- data/docker/run +9 -0
- data/ext/edn_turbo/edn_parser.cc +110 -88
- data/ext/edn_turbo/edn_parser.rl +20 -1
- data/ext/edn_turbo/extconf.rb +14 -2
- data/ext/edn_turbo/main.cc +13 -3
- data/ext/edn_turbo/parser.h +1 -1
- data/ext/edn_turbo/parser_def.cc +2 -2
- data/ext/edn_turbo/util.cc +1 -1
- data/ext/edn_turbo/util.h +6 -1
- data/ext/edn_turbo/util_unicode.cc +1 -1
- data/ext/edn_turbo/util_unicode.h +1 -1
- data/lib/edn_turbo/edn_parser.rb +1 -1
- data/lib/edn_turbo/version.rb +5 -3
- data/lib/edn_turbo.rb +7 -1
- data/spec/edn_turbo/edn_parser_spec.rb +9 -0
- metadata +38 -13
- data/Dockerfile +0 -34
- data/bin/build_docker_image.sh +0 -11
- data/bin/console.sh +0 -5
- data/docker-compose.yml +0 -10
data/ext/edn_turbo/extconf.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# The MIT License (MIT)
|
4
4
|
|
5
|
-
# Copyright (c) 2015-
|
5
|
+
# Copyright (c) 2015-2021 Ed Porras
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -60,7 +60,19 @@ lib_dirs =
|
|
60
60
|
dir_config('icuuc', header_dirs, lib_dirs)
|
61
61
|
|
62
62
|
# feels very hackish to do this but the new icu4c needs it on MacOS
|
63
|
-
|
63
|
+
if RUBY_PLATFORM =~ /darwin/
|
64
|
+
$CXXFLAGS << ' -stdlib=libc++ -Wno-deprecated-register'
|
65
|
+
else
|
66
|
+
# remove some flags that are either clang-specific or unrecognized
|
67
|
+
# but somehow get passed under linux (?!)
|
68
|
+
%w[
|
69
|
+
-Wno-self-assign -Wno-parentheses-equality -Wno-constant-logical-operand
|
70
|
+
-Wno-cast-function-type -Wdeclaration-after-statement -Wimplicit-function-declaration
|
71
|
+
-Wimplicit-int
|
72
|
+
].each do |f|
|
73
|
+
$warnflags.sub!(f, '')
|
74
|
+
end
|
75
|
+
end
|
64
76
|
$CXXFLAGS << ' -std=c++11 -std=gnu++11'
|
65
77
|
|
66
78
|
abort "\n>> failed to find icu4c headers - is icu4c installed?\n\n" unless
|
data/ext/edn_turbo/main.cc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
@@ -26,6 +26,7 @@
|
|
26
26
|
#include <cstring>
|
27
27
|
|
28
28
|
#include <ruby/ruby.h>
|
29
|
+
#include <ruby/version.h>
|
29
30
|
#include <ruby/io.h>
|
30
31
|
|
31
32
|
#include "parser.h"
|
@@ -48,6 +49,9 @@ namespace edn {
|
|
48
49
|
VALUE RUBY_STRING_TO_F_METHOD = Qnil;
|
49
50
|
VALUE RUBY_READ_METHOD = Qnil;
|
50
51
|
|
52
|
+
VALUE RUBY_NAN_CONST = Qnil;
|
53
|
+
VALUE RUBY_INF_CONST = Qnil;
|
54
|
+
|
51
55
|
// returned when EOF - defined as a constant in EDN module
|
52
56
|
VALUE EDN_EOF_CONST = Qnil;
|
53
57
|
|
@@ -59,7 +63,7 @@ namespace edn {
|
|
59
63
|
|
60
64
|
static const rb_data_type_t parser_data_type = {
|
61
65
|
"edn_turbo::Parser",
|
62
|
-
{0, delete_parser, 0,
|
66
|
+
{0, delete_parser, 0, 0},
|
63
67
|
0, 0,
|
64
68
|
RUBY_TYPED_FREE_IMMEDIATELY,
|
65
69
|
};
|
@@ -214,9 +218,11 @@ void Init_edn_turbo(void)
|
|
214
218
|
edn::EDN_MAKE_SYMBOL_METHOD = rb_intern("symbol");
|
215
219
|
edn::EDN_MAKE_LIST_METHOD = rb_intern("list");
|
216
220
|
edn::EDN_MAKE_SET_METHOD = rb_intern("set");
|
217
|
-
edn::EDN_MAKE_BIG_DECIMAL_METHOD = rb_intern("big_decimal");
|
218
221
|
edn::EDN_TAGGED_ELEM_METHOD = rb_intern("tagged_element");
|
219
222
|
|
223
|
+
// see lib/edn_turbo.rb
|
224
|
+
edn::EDN_MAKE_BIG_DECIMAL_METHOD = rb_intern("big_decimal_edn_turbo");
|
225
|
+
|
220
226
|
// defined in EDNT - see edn_parser.rb
|
221
227
|
edn::EDNT_EXTENDED_VALUE_METHOD = rb_intern("extend_for_meta");
|
222
228
|
edn::EDN_MAKE_RATIONAL_METHOD = rb_intern("rational"); // should be in edn-ruby
|
@@ -226,6 +232,10 @@ void Init_edn_turbo(void)
|
|
226
232
|
edn::RUBY_STRING_TO_F_METHOD = rb_intern("to_f");
|
227
233
|
edn::RUBY_READ_METHOD = rb_intern("read");
|
228
234
|
|
235
|
+
VALUE rb_mFloat = rb_const_get(rb_cObject, rb_intern("Float"));
|
236
|
+
edn::RUBY_NAN_CONST = rb_const_get(rb_mFloat, rb_intern("NAN"));
|
237
|
+
edn::RUBY_INF_CONST = rb_const_get(rb_mFloat, rb_intern("INFINITY"));
|
238
|
+
|
229
239
|
// so we can return EOF directly
|
230
240
|
edn::EDN_EOF_CONST = rb_const_get(edn::rb_mEDN, rb_intern("EOF"));
|
231
241
|
}
|
data/ext/edn_turbo/parser.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
data/ext/edn_turbo/parser_def.cc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
@@ -205,7 +205,7 @@ namespace edn
|
|
205
205
|
// =================================================================
|
206
206
|
//
|
207
207
|
// error reporting
|
208
|
-
void Parser::error(const std::string& func
|
208
|
+
void Parser::error(const std::string& /*func*/, const std::string& err, char c) const
|
209
209
|
{
|
210
210
|
std::cerr << "Parse error "
|
211
211
|
// "from " << func << "() "
|
data/ext/edn_turbo/util.cc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
data/ext/edn_turbo/util.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
#pragma once
|
24
24
|
|
25
|
+
#include <cstddef>
|
26
|
+
|
25
27
|
namespace edn
|
26
28
|
{
|
27
29
|
extern VALUE rb_mEDN;
|
@@ -41,6 +43,9 @@ namespace edn
|
|
41
43
|
extern VALUE RUBY_STRING_TO_F_METHOD;
|
42
44
|
extern VALUE RUBY_READ_METHOD;
|
43
45
|
|
46
|
+
extern VALUE RUBY_NAN_CONST;
|
47
|
+
extern VALUE RUBY_INF_CONST;
|
48
|
+
|
44
49
|
namespace util
|
45
50
|
{
|
46
51
|
// defined in edn_parser_util.cc
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// The MIT License (MIT)
|
2
2
|
|
3
|
-
// Copyright (c) 2015-
|
3
|
+
// Copyright (c) 2015-2021 Ed Porras
|
4
4
|
|
5
5
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
// of this software and associated documentation files (the "Software"), to deal
|
data/lib/edn_turbo/edn_parser.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# The MIT License (MIT)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2015-
|
5
|
+
# Copyright (c) 2015-2021 Ed Porras
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/edn_turbo/version.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# The MIT License (MIT)
|
2
4
|
#
|
3
|
-
# Copyright (c) 2015-
|
5
|
+
# Copyright (c) 2015-2021 Ed Porras
|
4
6
|
#
|
5
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
8
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -21,6 +23,6 @@
|
|
21
23
|
# THE SOFTWARE.
|
22
24
|
|
23
25
|
module EDNT
|
24
|
-
VERSION = '0.
|
25
|
-
RELEASE_DATE = '
|
26
|
+
VERSION = '0.7.2'
|
27
|
+
RELEASE_DATE = '2021-09-20'
|
26
28
|
end
|
data/lib/edn_turbo.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# The MIT License (MIT)
|
4
4
|
#
|
5
|
-
# Copyright (c) 2015-
|
5
|
+
# Copyright (c) 2015-2021 Ed Porras
|
6
6
|
#
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
8
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -36,4 +36,10 @@ module EDN
|
|
36
36
|
def self.rational(value)
|
37
37
|
Rational(value)
|
38
38
|
end
|
39
|
+
|
40
|
+
# edn-ruby uses BigDecimal.new() which breaks in ruby >= 2.7.0 so we
|
41
|
+
# use this instead
|
42
|
+
def self.big_decimal_edn_turbo(value)
|
43
|
+
BigDecimal(value)
|
44
|
+
end
|
39
45
|
end
|
@@ -352,6 +352,15 @@ module EDNT
|
|
352
352
|
it 'with mathematical operators' do
|
353
353
|
expect(subject.parse('>:FOuy/+')).to eq(EDN::Type::Symbol.new('>:FOuy/+'))
|
354
354
|
end
|
355
|
+
it 'NaN' do
|
356
|
+
expect(subject.parse('##NaN').to_f.nan?).to be_truthy
|
357
|
+
end
|
358
|
+
it 'infinity' do
|
359
|
+
expect(subject.parse('##Inf')).to eq(Float::INFINITY)
|
360
|
+
end
|
361
|
+
it 'negative infinity' do
|
362
|
+
expect(subject.parse('##-Inf')).to eq(EDN::Type::Symbol.new('-Inf'))
|
363
|
+
end
|
355
364
|
end
|
356
365
|
|
357
366
|
context 'metadata' do
|
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.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Porras
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: edn
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '12.3'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '14.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '12.3'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '14.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rake-compiler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,6 +98,20 @@ dependencies:
|
|
92
98
|
- - "~>"
|
93
99
|
- !ruby/object:Gem::Version
|
94
100
|
version: 3.8.0
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rubocop
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '1.9'
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '1.9'
|
95
115
|
description: Optimized plugin for parsing EDN files using ragel
|
96
116
|
email: github@digressed.net
|
97
117
|
executables:
|
@@ -100,19 +120,24 @@ extensions:
|
|
100
120
|
- ext/edn_turbo/extconf.rb
|
101
121
|
extra_rdoc_files: []
|
102
122
|
files:
|
123
|
+
- ".dir-locals.el"
|
103
124
|
- ".gitignore"
|
104
125
|
- ".rspec"
|
105
126
|
- CHANGELOG.md
|
106
|
-
- Dockerfile
|
107
127
|
- Gemfile
|
108
128
|
- LICENSE
|
109
129
|
- README.md
|
110
130
|
- Rakefile
|
111
|
-
- bin/build_docker_image.sh
|
112
|
-
- bin/console.sh
|
113
131
|
- bin/ppedn
|
114
132
|
- bin/ppedn-ruby
|
115
|
-
- docker
|
133
|
+
- docker/Dockerfile
|
134
|
+
- docker/build
|
135
|
+
- docker/common.sh
|
136
|
+
- docker/console
|
137
|
+
- docker/docker-compose.yml
|
138
|
+
- docker/entrypoint
|
139
|
+
- docker/make-check
|
140
|
+
- docker/run
|
116
141
|
- ext/edn_turbo/depend
|
117
142
|
- ext/edn_turbo/edn_parser.cc
|
118
143
|
- ext/edn_turbo/edn_parser.rl
|
@@ -133,7 +158,7 @@ homepage: http://rubygems.org/gems/edn_turbo
|
|
133
158
|
licenses:
|
134
159
|
- MIT
|
135
160
|
metadata: {}
|
136
|
-
post_install_message:
|
161
|
+
post_install_message:
|
137
162
|
rdoc_options: []
|
138
163
|
require_paths:
|
139
164
|
- lib
|
@@ -141,15 +166,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
166
|
requirements:
|
142
167
|
- - ">="
|
143
168
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
169
|
+
version: 2.5.0
|
145
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
171
|
requirements:
|
147
172
|
- - ">="
|
148
173
|
- !ruby/object:Gem::Version
|
149
174
|
version: '0'
|
150
175
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
-
signing_key:
|
176
|
+
rubygems_version: 3.2.22
|
177
|
+
signing_key:
|
153
178
|
specification_version: 3
|
154
179
|
summary: Read EDN files
|
155
180
|
test_files: []
|
data/Dockerfile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
FROM buildpack-deps:stretch
|
2
|
-
MAINTAINER github@digressed.net
|
3
|
-
|
4
|
-
ENV LC_ALL C.UTF-8
|
5
|
-
|
6
|
-
# Update Ubuntu Software repository
|
7
|
-
RUN apt-get update
|
8
|
-
|
9
|
-
# install dependencies & utils
|
10
|
-
RUN apt-get install -y \
|
11
|
-
libicu-dev \
|
12
|
-
curl \
|
13
|
-
libreadline-dev
|
14
|
-
|
15
|
-
# aliases, environment
|
16
|
-
RUN echo 'alias h="history"' >> /root/.bashrc
|
17
|
-
RUN echo 'alias be="bundle exec"' >> /root/.bashrc
|
18
|
-
ENV PATH "/root/.rbenv/bin:/root/.rbenv/shims:$PATH"
|
19
|
-
|
20
|
-
# install rbenv & ruby
|
21
|
-
RUN \curl -sL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -
|
22
|
-
RUN eval "$(rbenv init -)"
|
23
|
-
|
24
|
-
ENV RUBY_VERSION=2.6.3
|
25
|
-
RUN rbenv install ${RUBY_VERSION}
|
26
|
-
RUN rbenv global ${RUBY_VERSION}
|
27
|
-
|
28
|
-
# mute bundle warning about root user
|
29
|
-
RUN bundle config --global silence_root_warning 1
|
30
|
-
|
31
|
-
WORKDIR /gem
|
32
|
-
|
33
|
-
# cleanup
|
34
|
-
RUN rm -rf /var/lib/apt/lists/*
|
data/bin/build_docker_image.sh
DELETED
data/bin/console.sh
DELETED