rdf-turtle 1.0.2 → 1.0.3

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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION +1 -1
  3. data/lib/rdf/turtle/reader.rb +7 -39
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWRjMmI0MTVmN2I4YWQ1MTVjYTg1YmNkZDIzMzNjMDA4ZmVkYzhhMA==
4
+ NmFjNDZhYjI5YjkzMzUwMzNjMGVkZGQ2NDg1ZjIzZDRmOTZhZTFkOA==
5
5
  data.tar.gz: !binary |-
6
- ZDgwNTlhNGNmODY3NTliMzRiYTE4OTcxZDI5NjZmY2NlNmExMTgzNw==
6
+ ZjRmYTU5N2I2MzU5OGQzMmNjMzFkNDhkYzE5YWI5NTYxODZmYzg4Yw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjIwZjI3OGQ0ZjUzYzQ0N2Q1YmQyODg0ZDFjYTBiNzA4MWU1ZTdiNWE2ODZh
10
- NWJmNWU3ZTM3NTYyOTdhM2QwZDY5NmUyN2JjYWM5OTE3YjRiMjM0YTdiN2Rh
11
- OGRiYmU4YmM5MGI0ZDRjMWU0MzIzNWRjODkwYjI2NjRmNWE5Njc=
9
+ ODBiMWZhMDUzMDNjODhmOTc5MDZmODQ2YTYwMzYyN2I1MWYzMDRmZDZjMmU3
10
+ MDFkODc0M2RlNDU4MjdhMGFlMzgxMWJmMWMzOTQxNDkwNjVkOGM5YWM4NTg3
11
+ ZGJhNzJkMWVjM2E1Y2UzOWI2MDI0ZmY1YmM2NTFkZWY2ZWEwYTY=
12
12
  data.tar.gz: !binary |-
13
- ODEyMTc5MDNhOWExZjM1MDU0MmVjYTFhYmU0ZjEyNDkxNzE2YTlmMmVkOTA0
14
- NjIxMzA3YzdlODMzM2FkMWZjMGZlYWQ2MWI1N2NlMDEyODZhZjUxYzk4MGFl
15
- NWIzZjdiMTQzN2U3M2M2NTYwZTgwN2ZiMGI0MzViNTQ1MmFlMzE=
13
+ NmFlMGUzMjZhMjQwNGVjMDViOGU4ODUwNTE1MmYyYmE1ZWU0YjA2YmEzYmI3
14
+ YTY0ZDhiNzc0ZTUzYWFmNzY5NDRlNTJhNjkyMDdmMDc3ZWNjZmFlYzI5ZWEy
15
+ NTIzMWEyYTE1MzlkYzQ0YWY1NjQzNjg2NjJkNjRmZDg1MDNjOTk=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -92,19 +92,18 @@ module RDF::Turtle
92
92
  end
93
93
 
94
94
  # Productions
95
-
96
95
  # [4] prefixID defines a prefix mapping
97
96
  production(:prefixID) do |input, current, callback|
98
97
  prefix = current[:prefix]
99
98
  iri = current[:resource]
100
- callback.call(:trace, "prefixID", lambda {"Defined prefix #{prefix.inspect} mapping to #{iri.inspect}"})
99
+ debug("prefixID") {"Defined prefix #{prefix.inspect} mapping to #{iri.inspect}"}
101
100
  prefix(prefix, iri)
102
101
  end
103
102
 
104
103
  # [5] base set base_uri
105
104
  production(:base) do |input, current, callback|
106
105
  iri = current[:resource]
107
- callback.call(:trace, "base", lambda {"Defined base as #{iri}"})
106
+ debug("base") {"Defined base as #{iri}"}
108
107
  options[:base_uri] = iri
109
108
  end
110
109
 
@@ -112,14 +111,14 @@ module RDF::Turtle
112
111
  production(:sparqlPrefix) do |input, current, callback|
113
112
  prefix = current[:prefix]
114
113
  iri = current[:resource]
115
- callback.call(:trace, "sparqlPrefix", lambda {"Defined prefix #{prefix.inspect} mapping to #{iri.inspect}"})
114
+ debug("sparqlPrefix") {"Defined prefix #{prefix.inspect} mapping to #{iri.inspect}"}
116
115
  prefix(prefix, iri)
117
116
  end
118
117
 
119
118
  # [29s] sparqlBase ::= [Bb][Aa][Ss][Ee] IRIREF
120
119
  production(:sparqlBase) do |input, current, callback|
121
120
  iri = current[:resource]
122
- callback.call(:trace, ":sparqlBase", lambda {"Defined base as #{iri}"})
121
+ debug("base") {"Defined base as #{iri}"}
123
122
  options[:base_uri] = iri
124
123
  end
125
124
 
@@ -155,7 +154,7 @@ module RDF::Turtle
155
154
  # Part of an rdf:List collection
156
155
  input[:object_list] << current[:resource]
157
156
  else
158
- callback.call(:trace, "object", lambda {"current: #{current.inspect}"})
157
+ debug("object") {"current: #{current.inspect}"}
159
158
  callback.call(:statement, "object", input[:subject], input[:predicate], current[:resource])
160
159
  end
161
160
  end
@@ -271,14 +270,13 @@ module RDF::Turtle
271
270
 
272
271
  parse(@input, START.to_sym, @options.merge(:branch => BRANCH,
273
272
  :first => FIRST,
274
- :follow => FOLLOW)
273
+ :follow => FOLLOW,
274
+ :reset_on_start => true)
275
275
  ) do |context, *data|
276
276
  loc = data.shift
277
277
  case context
278
278
  when :statement
279
279
  add_statement(loc, RDF::Statement.from(data))
280
- when :trace
281
- debug(loc, *(data.dup << {:level => 0}))
282
280
  end
283
281
  end
284
282
  rescue ArgumentError, EBNF::LL1::Parser::Error => e
@@ -373,35 +371,5 @@ module RDF::Turtle
373
371
  @bnode_cache ||= {}
374
372
  @bnode_cache[value.to_s] ||= RDF::Node.new(value)
375
373
  end
376
-
377
- ##
378
- # Progress output when debugging
379
- # @overload debug(node, message)
380
- # @param [String] node relative location in input
381
- # @param [String] message ("")
382
- #
383
- # @overload debug(message)
384
- # @param [String] message ("")
385
- #
386
- # @yieldreturn [String] added to message
387
- def debug(*args)
388
- return unless @options[:debug]
389
- options = args.last.is_a?(Hash) ? args.pop : {}
390
- debug_level = options.fetch(:level, 1)
391
- return unless debug_level <= DEBUG_LEVEL
392
- depth = options[:depth] || self.depth
393
- message = args.pop
394
- message = message.call if message.is_a?(Proc)
395
- args << message if message
396
- args << yield if block_given?
397
- message = "#{args.join(': ')}"
398
- str = "[#{@lineno}]#{' ' * depth}#{message}"
399
- case @options[:debug]
400
- when Array
401
- @options[:debug] << str
402
- when TrueClass
403
- $stderr.puts str
404
- end
405
- end
406
374
  end # class Reader
407
375
  end # module RDF::Turtle
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-turtle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-24 00:00:00.000000000 Z
11
+ date: 2013-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf