edn_turbo 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +2 -0
- data/Rakefile +2 -3
- data/bin/ppedn +11 -12
- data/bin/ppedn-ruby +6 -5
- data/ext/edn_turbo/depend +5 -3
- data/ext/edn_turbo/edn_parser.cc +297 -295
- data/ext/edn_turbo/edn_parser.rl +20 -18
- data/ext/edn_turbo/extconf.rb +7 -11
- data/ext/edn_turbo/main.cc +28 -27
- data/ext/edn_turbo/{edn_parser.h → parser.h} +0 -42
- data/ext/edn_turbo/parser_def.cc +197 -0
- data/ext/edn_turbo/util.cc +240 -0
- data/ext/edn_turbo/util.h +39 -0
- data/ext/edn_turbo/util_unicode.cc +36 -0
- data/ext/edn_turbo/util_unicode.h +14 -0
- data/lib/edn_turbo/edn_parser.rb +6 -3
- data/lib/edn_turbo/version.rb +4 -2
- data/lib/edn_turbo.rb +2 -0
- data/test/test_output_diff.rb +38 -49
- metadata +9 -7
- data/ext/edn_turbo/edn_parser_util.cc +0 -424
- data/ext/edn_turbo/edn_parser_util.h +0 -11
- data/ext/edn_turbo/edn_parser_util_unicode.cc +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a4ad2ca7e8fe3d62d10c0922aa848d681a7bbc
|
4
|
+
data.tar.gz: 6c150c29710382b31ac9d2fa57b1bb92a80ebfc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4894a11b2dd834bae3167a349813651340f4da142f3cd42b15ef8631d921524c9b4dfad61f5fa597e279ae2537b79dcee8f337eaa877a339b15923764a84d518
|
7
|
+
data.tar.gz: bfbca29dc9a58aefeb8e465f23961e1604e3f5e77100ec4027a96a53cdb916707c8d4342584df8a4d18d386dff64423f1b2b4be39cc31df2d95f3e95f964fab2
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -31,9 +31,8 @@ end
|
|
31
31
|
|
32
32
|
CLEAN.include(["*.png", "*.gem"])
|
33
33
|
|
34
|
+
# ragel cc source generation
|
34
35
|
task :ragel => GEN_CC_PARSER_SRC_PATH
|
35
|
-
|
36
|
-
|
37
36
|
file GEN_CC_PARSER_SRC_PATH => RAGEL_PARSER_SRC_PATH do
|
38
37
|
cd EXT_PATH do
|
39
38
|
sh "ragel -G2 -o #{GEN_CC_PARSER_SRC} #{RAGEL_PARSER_SRC}"
|
@@ -42,7 +41,7 @@ file GEN_CC_PARSER_SRC_PATH => RAGEL_PARSER_SRC_PATH do
|
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
|
44
|
+
# graph generation for testing machine output
|
46
45
|
task :graph, [:machine] do |t, args|
|
47
46
|
args.with_defaults(:machine => 'EDN_value')
|
48
47
|
TMPFILE='/tmp/ragel_edn'
|
data/bin/ppedn
CHANGED
@@ -1,49 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
|
-
$LOAD_PATH << File.expand_path(
|
5
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
5
6
|
|
6
7
|
require 'optparse'
|
8
|
+
require 'edn'
|
7
9
|
require 'edn_turbo'
|
8
10
|
require 'pp'
|
9
11
|
|
10
12
|
options = {}
|
11
13
|
optparse = OptionParser.new do |opts|
|
12
|
-
opts.banner = "Usage: #{$
|
14
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options] filename"
|
13
15
|
|
14
16
|
options[:use_parse] = false
|
15
|
-
opts.on(
|
17
|
+
opts.on('-p', '--use_parse', 'User single-shot parse() instead of token-wise read()') do
|
16
18
|
options[:use_parse] = true
|
17
19
|
end
|
18
20
|
|
19
|
-
opts.on(
|
20
|
-
$stderr.puts "EDN parsing C++-extension version #{
|
21
|
+
opts.on('-v', '--version', 'Display version information and exit') do
|
22
|
+
$stderr.puts "EDN parsing C++-extension version #{EDNT::VERSION}"
|
21
23
|
exit
|
22
24
|
end
|
23
25
|
|
24
|
-
opts.on(
|
26
|
+
opts.on('-h', '--help', 'Display this screen') do
|
25
27
|
$stderr.puts opts
|
26
28
|
exit
|
27
29
|
end
|
28
30
|
end
|
29
31
|
optparse.parse!
|
30
32
|
|
31
|
-
if ARGV.
|
33
|
+
if ARGV.empty?
|
32
34
|
$stderr.puts optparse
|
33
35
|
exit 1
|
34
36
|
end
|
35
37
|
|
36
38
|
filename = ARGV[0]
|
37
|
-
|
39
|
+
unless File.exist? filename
|
38
40
|
$stderr.puts "Path '#{filename}' not valid"
|
39
41
|
exit 1
|
40
42
|
end
|
41
43
|
|
42
44
|
p = EDNT::Parser.new
|
43
45
|
|
44
|
-
|
45
46
|
File.open(filename) do |file|
|
46
|
-
|
47
47
|
if options[:use_parse]
|
48
48
|
output = p.parse(file.read)
|
49
49
|
|
@@ -57,8 +57,7 @@ File.open(filename) do |file|
|
|
57
57
|
break if output == EDN::EOF
|
58
58
|
|
59
59
|
pp output
|
60
|
-
|
61
|
-
# puts "\tread() meta: #{p.metadata}" if p.has_metadata?
|
60
|
+
# puts "\tread() meta: #{p.metadata}" if p.has_metadata?
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
data/bin/ppedn-ruby
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
require 'edn'
|
5
6
|
require 'pp'
|
6
7
|
|
7
|
-
if ARGV.
|
8
|
-
$stderr.puts
|
8
|
+
if ARGV.empty?
|
9
|
+
$stderr.puts 'no filename given'
|
9
10
|
exit 1
|
10
11
|
end
|
11
12
|
|
12
13
|
# file checks
|
13
14
|
filename = ARGV[0]
|
14
|
-
|
15
|
+
unless File.exist? filename
|
15
16
|
$stderr.puts "Error opening #{filename}"
|
16
17
|
abort
|
17
18
|
end
|
@@ -22,8 +23,8 @@ begin
|
|
22
23
|
File.open(filename) do |file|
|
23
24
|
doc_data = EDN.read(file)
|
24
25
|
end
|
25
|
-
rescue
|
26
|
-
$stderr.puts
|
26
|
+
rescue StandardError
|
27
|
+
$stderr.puts 'Error reading file'
|
27
28
|
abort
|
28
29
|
end
|
29
30
|
|
data/ext/edn_turbo/depend
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
main.o: main.cc parser.h
|
2
|
+
edn_parser.o: edn_parser.cc parser.h util.h
|
3
|
+
parser_def.o: parser_def.cc parser.h util.h
|
4
|
+
util.o: util.cc util_unicode.h
|
5
|
+
util_unicode.o: util_unicode.cc util_unicode.h
|