edn_turbo 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bedae4e49919f1fb8b5eb7ac3438288353ba840
4
- data.tar.gz: a1685384d17a698d5ea050aa5557e7106be81c21
3
+ metadata.gz: 30d991ed7b0f1d538557b651a4e5d04eccf1b54b
4
+ data.tar.gz: 046f2b1f3f66814897e1ead26d5404737f2dc00f
5
5
  SHA512:
6
- metadata.gz: 762c77382240141aaab80528a5fae3865d789a7740401215320b9416d078df72acaea10512fe0a9967307ab997ed4c68a0fb9bcf2d71248bac8155811ddfcea0
7
- data.tar.gz: 644544230a2dcceb3139fedf9d83071c13b653746f40e041a512bdf8de5797d35890516aeaa15ae6059322c960038eabce3636e332ccefe8c9403e9abfc563c5
6
+ metadata.gz: e8467a5aa1f6ae26b4ee414627ce49dddff1df50135bd48184972d93c334fb7a0f636cef089c759b524b2d30b04e3f2b517746e02cc65aa2c9f905e1594730d8
7
+ data.tar.gz: c1eea11deb70ce83ee4d322aaa424d288dcc272ec5097e284d8b2418c58630f907295b3437822ef28eb1b82ff7fe9c0c2cd2d211c4c530a3c1286fceb92cec8e
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/bin/ppedn CHANGED
@@ -11,6 +11,11 @@ options = {}
11
11
  optparse = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$0} [options] filename"
13
13
 
14
+ options[:use_parse] = false
15
+ opts.on( '-p', '--use_parse', 'User single-shot parse() instead of token-wise read()' ) do
16
+ options[:use_parse] = true
17
+ end
18
+
14
19
  opts.on( '-v', '--version', 'Display version information and exit' ) do
15
20
  $stderr.puts "EDN parsing C++-extension version #{EDNt::VERSION}"
16
21
  exit
@@ -34,8 +39,24 @@ if !File.exist? filename
34
39
  exit 1
35
40
  end
36
41
 
37
- # mimic edn-ruby usage
42
+ p = EDNT::Parser.new
43
+
44
+
38
45
  File.open(filename) do |file|
39
- output = EDNT.read(file)
40
- pp output if output != nil
46
+
47
+ if options[:use_parse]
48
+ pp p.parse(file.read)
49
+ else
50
+ p.set_input(file.read)
51
+
52
+ loop do
53
+ output = p.read
54
+
55
+ break if output == EDNT::EOF
56
+
57
+ pp output
58
+
59
+ # puts "\tread() meta: #{p.metadata}" if p.has_metadata?
60
+ end
61
+ end
41
62
  end