rdf-n3 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,57 @@
1
+ module RDF
2
+ class URI
3
+ #unless defined?(:vocab)
4
+ def vocab
5
+ # Find vocabulary if not assigned
6
+ return @vocab if @vocab
7
+
8
+ Vocabulary.each do |vocab|
9
+ return self.vocab = vocab if to_s.index(vocab.to_uri.to_s) == 0
10
+ end
11
+ nil
12
+ end
13
+
14
+ def vocab=(value)
15
+ raise "Vocab #{value.inspect} is not a Vocabulary!" if value.is_a?(Array)
16
+ @vocab = value
17
+ end
18
+
19
+ def qname
20
+ @qname ||= if vocab
21
+ raise "Vocab #{vocab.inspect} is not a Vocabulary!" if vocab.is_a?(Array)
22
+ vocab_name = vocab.__name__.to_s.split('::').last.downcase
23
+ local_name = to_s[vocab.to_uri.to_s.size..-1]
24
+ vocab_name && local_name && [vocab_name.to_sym, local_name.to_sym]
25
+ end
26
+ end
27
+ #end
28
+ end
29
+
30
+ class Vocabulary
31
+ def self.[](property)
32
+ @prop_uri ||= {}
33
+ @prop_uri[property] ||= begin
34
+ uri = RDF::URI.intern([to_s, property.to_s].join(''))
35
+ uri.vocab = self
36
+ uri
37
+ end
38
+ end
39
+
40
+ def [](property)
41
+ @prop_uri ||= {}
42
+ @prop_uri[property] ||= begin
43
+ uri = RDF::URI.intern([to_s, property.to_s].join(''))
44
+ uri.vocab = self
45
+ uri
46
+ end
47
+ end
48
+
49
+ def to_uri
50
+ @uri ||= begin
51
+ uri = RDF::URI.intern(to_s)
52
+ uri.vocab = self
53
+ uri
54
+ end
55
+ end
56
+ end
57
+ end
@@ -114,7 +114,7 @@ class String
114
114
  string = self.gsub(UNESCAPE_RE) do |c|
115
115
  case c[1,1]
116
116
  when 'U'
117
- raise RdfException, "Long Unicode escapes no supported in Ruby 1.8" unless defined?(::Encoding)
117
+ raise RDF::ReaderError, "Long Unicode escapes no supported in Ruby 1.8" unless defined?(::Encoding)
118
118
  eval(c.sub(/\\U00(\h+)/, '"\u{\1}"'))
119
119
  when 'u'
120
120
  bytes = [c[2, 2].to_i(16), c[4, 2].to_i(16)]
@@ -126,6 +126,6 @@ class String
126
126
  string.force_encoding(Encoding::UTF_8) if defined?(::Encoding)
127
127
  string
128
128
  rescue Iconv::Failure => e
129
- raise RdfException, "Caught #{e.class}: #{e}"
129
+ raise RDF::ReaderError, "Caught #{e.class}: #{e}"
130
130
  end
131
- end
131
+ end unless String.method_defined?(:rdf_escape)
@@ -0,0 +1,34 @@
1
+ require 'rdf/rdfxml/patches/graph_properties'
2
+ module RDF
3
+ class Graph
4
+ # Returns ordered rdf:_n objects or rdf:first, rdf:rest for a given subject
5
+ def seq(subject)
6
+ props = properties(subject)
7
+ rdf_type = (props[RDF.type.to_s] || []).map {|t| t.to_s}
8
+
9
+ #puts "seq; #{rdf_type} #{rdf_type - [RDF.Seq, RDF.Bag, RDF.Alt]}"
10
+ if !(rdf_type - [RDF.Seq, RDF.Bag, RDF.Alt]).empty?
11
+ props.keys.select {|k| k.match(/#{RDF.to_s}_(\d)$/)}.
12
+ sort_by {|i| i.sub(RDF._.to_s, "").to_i}.
13
+ map {|key| props[key]}.
14
+ flatten
15
+ elsif !self.query(:subject => subject, :predicate => RDF.first).empty?
16
+ # N3-style first/rest chain
17
+ list = []
18
+ while subject != RDF.nil
19
+ props = properties(subject)
20
+ f = props[RDF.first.to_s]
21
+ if f.to_s.empty? || f.first == RDF.nil
22
+ subject = RDF.nil
23
+ else
24
+ list += f
25
+ subject = props[RDF.rest.to_s].first
26
+ end
27
+ end
28
+ list
29
+ else
30
+ []
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ module RDF
2
+ class URI
3
+ ##
4
+ # Joins several URIs together.
5
+ #
6
+ # @param [Array<String, URI, #to_str>] uris
7
+ # @return [URI]
8
+ #
9
+ # GK -- don't add a "/" at the end of URIs, due to rdfcore/xmlbase/test002.rdf
10
+ def join(*uris)
11
+ result = @uri
12
+ uris.each do |uri|
13
+ # result.path += '/' unless result.path.match(/[\#\/]$/) || uri.to_s[0..0] == "#"
14
+ result = result.join(uri)
15
+ end
16
+ self.class.new(result)
17
+ end
18
+ end
19
+ end
data/lib/rdf/n3/reader.rb CHANGED
@@ -1,6 +1,8 @@
1
- require 'nokogiri' # FIXME: Implement using different modules as in RDF::TriX
1
+ require 'treetop'
2
2
 
3
- module RDF::RDFXML
3
+ Treetop.load(File.join(File.dirname(__FILE__), "reader", "n3_grammar"))
4
+
5
+ module RDF::N3
4
6
  ##
5
7
  # A Notation-3/Turtle parser in Ruby
6
8
  #
@@ -23,55 +25,72 @@ module RDF::RDFXML
23
25
  $},
24
26
  Regexp::EXTENDED)
25
27
 
26
- XML_LITERAL = RDF['XMLLiteral']
27
-
28
28
  ##
29
29
  # Initializes the N3 reader instance.
30
30
  #
31
- # @param [IO, File, String]:: input
32
- # @param [Hash{Symbol => Object}]:: options
33
- # <em>options[:debug]</em>:: Array to place debug messages
34
- # <em>options[:strict]</em>:: Raise Error if true, continue with lax parsing, otherwise
35
- # <em>options[:base_uri]</em>:: Base URI to use for relative URIs.
31
+ # @param [IO, File, String] input
32
+ # @option options [Array] :debug Array to place debug messages
33
+ # @option options [Boolean] :strict Raise Error if true, continue with lax parsing, otherwise
34
+ # @option options [Boolean] :base_uri (nil) Base URI to use for relative URIs.
35
+ # @return [reader]
36
36
  # @yield [reader]
37
37
  # @yieldparam [Reader] reader
38
38
  # @raise [Error]:: Raises RDF::ReaderError if _strict_
39
39
  def initialize(input = $stdin, options = {}, &block)
40
40
  super do
41
- @graph = RDF::Graph.new
42
41
  @debug = options[:debug]
43
42
  @strict = options[:strict]
44
- @base_uri = options[:base_uri]
45
- @base_uri = RDF::URI.parse(@base_uri) if @base_uri.is_a?(String)
46
- @nsbinding = {}
43
+ @uri_mappings = {}
44
+ @uri = uri(options[:base_uri], nil, true)
47
45
 
48
- @doc = stream.respond_to?(:read) ? (stream.rewind; stream.read) : stream
49
- @default_ns = @base_uri if @base_uri
46
+ @doc = input.respond_to?(:read) ? (input.rewind; input.read) : input
47
+ @default_ns = uri("#{options[:base_uri]}#", nil, false) if @uri
50
48
  add_debug("@default_ns", "#{@default_ns.inspect}")
51
49
 
52
- document = parser.parse(@doc)
53
- unless document
54
- puts parser.inspect if $DEBUG
55
- reason = parser.failure_reason
56
- raise RDF::ReaderError.new(reason)
57
- end
58
-
59
- process_statements(document)
60
-
61
50
  block.call(self) if block_given?
62
51
  end
63
52
  end
64
53
 
54
+ ##
55
+ # Iterates the given block for each RDF statement in the input.
56
+ #
57
+ # @yield [statement]
58
+ # @yieldparam [RDF::Statement] statement
59
+ # @return [void]
60
+ def each_statement(&block)
61
+ @callback = block
62
+
63
+ parser = N3GrammerParser.new
64
+ document = parser.parse(@doc)
65
+ unless document
66
+ puts parser.inspect if $DEBUG
67
+ reason = parser.failure_reason
68
+ raise RDF::ReaderError, reason
69
+ end
70
+
71
+ process_statements(document)
72
+ end
73
+
74
+ ##
75
+ # Iterates the given block for each RDF triple in the input.
76
+ #
77
+ # @yield [subject, predicate, object]
78
+ # @yieldparam [RDF::Resource] subject
79
+ # @yieldparam [RDF::URI] predicate
80
+ # @yieldparam [RDF::Value] object
81
+ # @return [void]
82
+ def each_triple(&block)
83
+ each_statement do |statement|
84
+ block.call(*statement.to_triple)
85
+ end
86
+ end
87
+
65
88
  private
66
89
 
67
90
  # Keep track of allocated BNodes
68
91
  def bnode(value = nil)
69
- if value
70
- @bnode_cache ||= {}
71
- @bnode_cache[value.to_s] ||= RDF::Node.new(value)
72
- else
73
- RDF::Node.new
74
- end
92
+ @bnode_cache ||= {}
93
+ @bnode_cache[value.to_s] ||= RDF::Node.new(value)
75
94
  end
76
95
 
77
96
  # Add debug event to debug array, if specified
@@ -79,8 +98,8 @@ module RDF::RDFXML
79
98
  # @param [XML Node, any] node:: XML Node or string for showing context
80
99
  # @param [String] message::
81
100
  def add_debug(node, message)
82
- puts "#{node_path(node)}: #{message}" if $DEBUG
83
- @debug << "#{node_path(node)}: #{message}" if @debug.is_a?(Array)
101
+ puts "#{node}: #{message}" if $DEBUG
102
+ @debug << "#{node}: #{message}" if @debug.is_a?(Array)
84
103
  end
85
104
 
86
105
  # add a statement, object can be literal or URI or bnode
@@ -94,19 +113,18 @@ module RDF::RDFXML
94
113
  def add_triple(node, subject, predicate, object)
95
114
  statement = RDF::Statement.new(subject, predicate, object)
96
115
  add_debug(node, "statement: #{statement}")
97
- @graph << statement
98
- statement
99
- rescue RDF::ReaderError => e
100
- add_debug(node, "add_triple raised #{e.class}: #{e.message}")
101
- puts e.backtrace if $DEBUG
102
- raise if @strict
116
+ @callback.call(statement)
103
117
  end
104
118
 
105
119
  def namespace(uri, prefix)
120
+ uri = uri.to_s
121
+ if uri == "#"
122
+ uri = @default_ns
123
+ elsif !uri.match(/[\/\#]$/)
124
+ uri += "#"
125
+ end
106
126
  add_debug("namesspace", "'#{prefix}' <#{uri}>")
107
- uri = @default_ns if uri == '#'
108
- @nsbinding[prefix] = uri
109
- add_debug("namesspace", "ns #{prefix}: <#{uri}>")
127
+ @uri_mappings[prefix] = RDF::URI.intern(uri)
110
128
  end
111
129
 
112
130
  def process_statements(document)
@@ -173,7 +191,7 @@ module RDF::RDFXML
173
191
 
174
192
  def process_anonnode(anonnode)
175
193
  add_debug(*anonnode.info("process_anonnode"))
176
- bnode = self.bnode
194
+ bnode = RDF::Node.new
177
195
 
178
196
  if anonnode.respond_to?(:property_list)
179
197
  properties = process_properties(anonnode.property_list)
@@ -189,7 +207,7 @@ module RDF::RDFXML
189
207
  first_bnode = bnode
190
208
  objects.each do |object|
191
209
  add_triple("anonnode", first_bnode, RDF.first, object)
192
- rest_bnode = self.bnode
210
+ rest_bnode = RDF::Node.new
193
211
  add_triple("anonnode", first_bnode, RDF.rest, rest_bnode)
194
212
  first_bnode = rest_bnode
195
213
  end
@@ -207,16 +225,16 @@ module RDF::RDFXML
207
225
  add_debug(*verb.info("process_verb"))
208
226
  case verb.text_value
209
227
  when "a"
210
- # If "a" is a keyword, then it's RDF_TYPE, otherwise it's expanded from the default namespace
228
+ # If "a" is a keyword, then it's rdf:type, otherwise it's expanded from the default namespace
211
229
  if @keywords.nil? || @keywords.include?("a")
212
- RDF_TYPE
230
+ RDF.type
213
231
  else
214
232
  build_uri("a")
215
233
  end
216
- when "@a" then RDF::RDF.type
234
+ when "@a" then RDF.type
217
235
  when "=" then RDF::OWL.sameAs
218
- when "=>" then RDF::OWL.implies
219
- when "<=" then RDF::OWL.implies
236
+ when "=>" then RDF::LOG.implies
237
+ when "<=" then RDF::LOG.implies
220
238
  when /^(@?is)\s+.*\s+(@?of)$/
221
239
  keyword_check("is") if $1 == "is"
222
240
  keyword_check("of") if $2 == "of"
@@ -258,7 +276,7 @@ module RDF::RDFXML
258
276
  if @keywords && !@keywords.include?(barename)
259
277
  build_uri(barename)
260
278
  else
261
- RDF::Literal.new(barename.delete("@"), :datatype => XSD.boolean)
279
+ RDF::Literal.new(barename.delete("@"), :datatype => RDF::XSD.boolean)
262
280
  end
263
281
  elsif expression.respond_to?(:barename)
264
282
  add_debug(*expression.info("process_expression(barename)"))
@@ -266,8 +284,8 @@ module RDF::RDFXML
266
284
 
267
285
  # Should only happen if @keywords is defined, and text_value is not a defined keyword
268
286
  case barename
269
- when "true" then RDF::Literal.new("true", :datatype => XSD.boolean)
270
- when "false" then RDF::Literal.new("false", :datatype => XSD.boolean)
287
+ when "true" then RDF::Literal.new("true", :datatype => RDF::XSD.boolean)
288
+ when "false" then RDF::Literal.new("false", :datatype => RDF::XSD.boolean)
271
289
  else
272
290
  # create URI using barename, unless it's in defined set, in which case it's an error
273
291
  raise RDF::ReaderError, %Q(Keyword "#{barename}" used as expression) if @keywords && @keywords.include?(barename)
@@ -302,7 +320,7 @@ module RDF::RDFXML
302
320
  # ]
303
321
  path_list.each do |p|
304
322
  reverse, pred = p
305
- bnode = self.bnode
323
+ bnode = RDF::Node.new
306
324
  if reverse
307
325
  add_triple("path(#{reverse})", bnode, pred, object)
308
326
  else
@@ -325,12 +343,11 @@ module RDF::RDFXML
325
343
 
326
344
  def process_uri(uri, normalize = true)
327
345
  uri = uri.text_value if uri.respond_to?(:text_value)
328
- # Use non-normalized URI from @default_ns when constructing URIs
329
- if uri.match(/^\#/) && @default_ns
330
- @default_ns.join(uri.rdf_escape)
346
+ if uri.match(/^\#/)
347
+ uri(@uri, uri.rdf_escape, false) # This is probably bogus, but allows tests to pass
331
348
  else
332
- base_uri = @default_ns || @uri
333
- base_uri.join(uri).normalize!
349
+ uri = uri.rdf_escape unless normalize # Addressable does it's own escaping when normalizing
350
+ uri(@uri, uri, normalize)
334
351
  end
335
352
  end
336
353
 
@@ -375,17 +392,15 @@ module RDF::RDFXML
375
392
 
376
393
  # Evaluate text_value to remove redundant escapes
377
394
  #puts string.elements[1].text_value.dump
378
- # FIXME: RDF::Literal doesn't work properly with rdf encoding
379
- lit = RDF::Literal.new(string.elements[1].text_value.rdf_unescape, :language => language)
380
- # FIXME: No lit.valid?
381
- #raise RDF::ReaderError, %(Typed literal has an invalid lexical value: #{encoding.to_n3} "#{lit.contents}") if @strict && !lit.valid?
395
+ lit = RDF::Literal.new(string.elements[1].text_value.rdf_unescape, :language => language, :datatype => encoding)
396
+ raise RDF::ReaderError, %(Typed literal has an invalid lexical value: #{encoding.to_s} "#{lit.value}") if @strict && !lit.valid?
382
397
  lit
383
398
  end
384
399
 
385
400
  def process_numeric_literal(object)
386
401
  add_debug(*object.info("process_numeric_literal"))
387
402
 
388
- RDF::Literal.new(string.elements[1].text_value.rdf_unescape, :datatype => RDF::XSD[object.numericliteral])
403
+ RDF::Literal.new(object.text_value.rdf_unescape, :datatype => RDF::XSD[object.numericliteral])
389
404
  end
390
405
 
391
406
  def build_uri(expression)
@@ -400,16 +415,24 @@ module RDF::RDFXML
400
415
  add_debug("", "build_uri(#{prefix.inspect}, #{localname.inspect})")
401
416
  end
402
417
 
403
- uri = if @nsbinding[prefix]
404
- RDF::URI.new(@nsbinding[prefix] + localname.to_s.rdf_escape)
418
+ uri = if @uri_mappings[prefix]
419
+ add_debug(*expression.info("build_uri: (ns): #{@uri_mappings[prefix]}, #{localname.to_s.rdf_escape}")) if expression.respond_to?(:info)
420
+ ns(prefix, localname.to_s.rdf_escape)
405
421
  elsif prefix == '_'
406
- self.bnode(localname)
422
+ add_debug(*expression.info("build_uri: (bnode)")) if expression.respond_to?(:info)
423
+ bnode(localname)
407
424
  elsif prefix == "rdf"
425
+ add_debug(*expression.info("build_uri: (rdf)")) if expression.respond_to?(:info)
408
426
  # A special case
409
427
  RDF::RDF[localname.to_s.rdf_escape]
428
+ elsif prefix == "xsd"
429
+ add_debug(*expression.info("build_uri: (xsd)")) if expression.respond_to?(:info)
430
+ # A special case
431
+ RDF::XSD[localname.to_s.rdf_escape]
410
432
  else
411
- @default_ns ||= "#{@uri}#"
412
- RDF::URI.new(@default_ns + localname.to_s.rdf_escape)
433
+ add_debug(*expression.info("build_uri: (default_ns)")) if expression.respond_to?(:info)
434
+ @default_ns ||= uri("#{@uri}#", nil)
435
+ ns(nil, localname.to_s.rdf_escape)
413
436
  end
414
437
  add_debug(*expression.info("build_uri: #{uri.inspect}")) if expression.respond_to?(:info)
415
438
  uri
@@ -421,6 +444,25 @@ module RDF::RDFXML
421
444
  raise RDF::ReaderError, "unqualified keyword '#{kw}' used without @keyword directive" if @strict
422
445
  end
423
446
  end
447
+
448
+ # Create normalized or unnormalized URIs
449
+ def uri(value, append, normalize = true)
450
+ value = value.to_s.sub(/\#$/, "") if normalize
451
+ value = case value
452
+ when Addressable::URI then value
453
+ else Addressable::URI.parse(value.to_s)
454
+ end
455
+
456
+ value = value.join(append) if append
457
+ value.normalize! if normalize
458
+ RDF::URI.intern(value)
459
+ end
460
+
461
+ def ns(prefix, suffix)
462
+ prefix = prefix.nil? ? @default_ns.to_s : @uri_mappings[prefix].to_s
463
+ suffix = suffix.to_s.sub(/^\#/, "") if prefix.index("#")
464
+ RDF::URI.intern(prefix + suffix)
465
+ end
424
466
  end
425
467
  end
426
468
 
@@ -435,7 +477,7 @@ module Treetop
435
477
  else
436
478
  ["@#{self.interval.first}", "#{ctx}[" +
437
479
  self.singleton_methods(true).map do |mm|
438
- v = self.send(m)
480
+ v = self.send(mm)
439
481
  v = v.text_value if v.is_a?(SyntaxNode)
440
482
  "#{mm}='#{v}'"
441
483
  end.join(", ") +
@@ -0,0 +1,3876 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ #encoding: utf-8
5
+ module N3Grammer
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :document
10
+ end
11
+
12
+ def _nt_document
13
+ start_index = index
14
+ if node_cache[:document].has_key?(index)
15
+ cached = node_cache[:document][index]
16
+ if cached
17
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
18
+ @index = cached.interval.end
19
+ end
20
+ return cached
21
+ end
22
+
23
+ r0 = _nt_statements
24
+
25
+ node_cache[:document][start_index] = r0
26
+
27
+ r0
28
+ end
29
+
30
+ def _nt_alpha
31
+ start_index = index
32
+ if node_cache[:alpha].has_key?(index)
33
+ cached = node_cache[:alpha][index]
34
+ if cached
35
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
36
+ @index = cached.interval.end
37
+ end
38
+ return cached
39
+ end
40
+
41
+ if has_terminal?('\G[A-Z_a-z\\p{Alpha}]', true, index)
42
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
43
+ @index += 1
44
+ else
45
+ r0 = nil
46
+ end
47
+
48
+ node_cache[:alpha][start_index] = r0
49
+
50
+ r0
51
+ end
52
+
53
+ def _nt_alphanumeric
54
+ start_index = index
55
+ if node_cache[:alphanumeric].has_key?(index)
56
+ cached = node_cache[:alphanumeric][index]
57
+ if cached
58
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
59
+ @index = cached.interval.end
60
+ end
61
+ return cached
62
+ end
63
+
64
+ i0 = index
65
+ r1 = _nt_alpha
66
+ if r1
67
+ r0 = r1
68
+ else
69
+ if has_terminal?('\G[0-9]', true, index)
70
+ r2 = true
71
+ @index += 1
72
+ else
73
+ r2 = nil
74
+ end
75
+ if r2
76
+ r0 = r2
77
+ else
78
+ @index = i0
79
+ r0 = nil
80
+ end
81
+ end
82
+
83
+ node_cache[:alphanumeric][start_index] = r0
84
+
85
+ r0
86
+ end
87
+
88
+ module BarenameCsl0
89
+ def barename
90
+ elements[1]
91
+ end
92
+
93
+ def barename_csl_tail
94
+ elements[2]
95
+ end
96
+ end
97
+
98
+ def _nt_barename_csl
99
+ start_index = index
100
+ if node_cache[:barename_csl].has_key?(index)
101
+ cached = node_cache[:barename_csl][index]
102
+ if cached
103
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
104
+ @index = cached.interval.end
105
+ end
106
+ return cached
107
+ end
108
+
109
+ i0 = index
110
+ i1, s1 = index, []
111
+ s2, i2 = [], index
112
+ loop do
113
+ r3 = _nt_space
114
+ if r3
115
+ s2 << r3
116
+ else
117
+ break
118
+ end
119
+ end
120
+ if s2.empty?
121
+ @index = i2
122
+ r2 = nil
123
+ else
124
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
125
+ end
126
+ s1 << r2
127
+ if r2
128
+ r4 = _nt_barename
129
+ s1 << r4
130
+ if r4
131
+ r5 = _nt_barename_csl_tail
132
+ s1 << r5
133
+ end
134
+ end
135
+ if s1.last
136
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
137
+ r1.extend(BarenameCsl0)
138
+ else
139
+ @index = i1
140
+ r1 = nil
141
+ end
142
+ if r1
143
+ r0 = r1
144
+ else
145
+ if has_terminal?("", false, index)
146
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 0))
147
+ @index += 0
148
+ else
149
+ terminal_parse_failure("")
150
+ r6 = nil
151
+ end
152
+ if r6
153
+ r0 = r6
154
+ else
155
+ @index = i0
156
+ r0 = nil
157
+ end
158
+ end
159
+
160
+ node_cache[:barename_csl][start_index] = r0
161
+
162
+ r0
163
+ end
164
+
165
+ module BarenameCslTail0
166
+ def barename
167
+ elements[3]
168
+ end
169
+
170
+ def barename_csl_tail
171
+ elements[5]
172
+ end
173
+ end
174
+
175
+ def _nt_barename_csl_tail
176
+ start_index = index
177
+ if node_cache[:barename_csl_tail].has_key?(index)
178
+ cached = node_cache[:barename_csl_tail][index]
179
+ if cached
180
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
181
+ @index = cached.interval.end
182
+ end
183
+ return cached
184
+ end
185
+
186
+ i0 = index
187
+ i1, s1 = index, []
188
+ s2, i2 = [], index
189
+ loop do
190
+ r3 = _nt_space
191
+ if r3
192
+ s2 << r3
193
+ else
194
+ break
195
+ end
196
+ end
197
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
198
+ s1 << r2
199
+ if r2
200
+ if has_terminal?(",", false, index)
201
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
202
+ @index += 1
203
+ else
204
+ terminal_parse_failure(",")
205
+ r4 = nil
206
+ end
207
+ s1 << r4
208
+ if r4
209
+ s5, i5 = [], index
210
+ loop do
211
+ r6 = _nt_space
212
+ if r6
213
+ s5 << r6
214
+ else
215
+ break
216
+ end
217
+ end
218
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
219
+ s1 << r5
220
+ if r5
221
+ r7 = _nt_barename
222
+ s1 << r7
223
+ if r7
224
+ s8, i8 = [], index
225
+ loop do
226
+ r9 = _nt_space
227
+ if r9
228
+ s8 << r9
229
+ else
230
+ break
231
+ end
232
+ end
233
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
234
+ s1 << r8
235
+ if r8
236
+ r10 = _nt_barename_csl_tail
237
+ s1 << r10
238
+ end
239
+ end
240
+ end
241
+ end
242
+ end
243
+ if s1.last
244
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
245
+ r1.extend(BarenameCslTail0)
246
+ else
247
+ @index = i1
248
+ r1 = nil
249
+ end
250
+ if r1
251
+ r0 = r1
252
+ else
253
+ if has_terminal?("", false, index)
254
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 0))
255
+ @index += 0
256
+ else
257
+ terminal_parse_failure("")
258
+ r11 = nil
259
+ end
260
+ if r11
261
+ r0 = r11
262
+ else
263
+ @index = i0
264
+ r0 = nil
265
+ end
266
+ end
267
+
268
+ node_cache[:barename_csl_tail][start_index] = r0
269
+
270
+ r0
271
+ end
272
+
273
+ module Boolean0
274
+ end
275
+
276
+ def _nt_boolean
277
+ start_index = index
278
+ if node_cache[:boolean].has_key?(index)
279
+ cached = node_cache[:boolean][index]
280
+ if cached
281
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
282
+ @index = cached.interval.end
283
+ end
284
+ return cached
285
+ end
286
+
287
+ i0, s0 = index, []
288
+ s1, i1 = [], index
289
+ loop do
290
+ if has_terminal?("@", false, index)
291
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
292
+ @index += 1
293
+ else
294
+ terminal_parse_failure("@")
295
+ r2 = nil
296
+ end
297
+ if r2
298
+ s1 << r2
299
+ else
300
+ break
301
+ end
302
+ end
303
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
304
+ s0 << r1
305
+ if r1
306
+ i3 = index
307
+ if has_terminal?("true", false, index)
308
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
309
+ @index += 4
310
+ else
311
+ terminal_parse_failure("true")
312
+ r4 = nil
313
+ end
314
+ if r4
315
+ r3 = r4
316
+ else
317
+ if has_terminal?("false", false, index)
318
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
319
+ @index += 5
320
+ else
321
+ terminal_parse_failure("false")
322
+ r5 = nil
323
+ end
324
+ if r5
325
+ r3 = r5
326
+ else
327
+ @index = i3
328
+ r3 = nil
329
+ end
330
+ end
331
+ s0 << r3
332
+ end
333
+ if s0.last
334
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
335
+ r0.extend(Boolean0)
336
+ else
337
+ @index = i0
338
+ r0 = nil
339
+ end
340
+
341
+ node_cache[:boolean][start_index] = r0
342
+
343
+ r0
344
+ end
345
+
346
+ module Comment0
347
+ end
348
+
349
+ module Comment1
350
+ end
351
+
352
+ def _nt_comment
353
+ start_index = index
354
+ if node_cache[:comment].has_key?(index)
355
+ cached = node_cache[:comment][index]
356
+ if cached
357
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
358
+ @index = cached.interval.end
359
+ end
360
+ return cached
361
+ end
362
+
363
+ i0, s0 = index, []
364
+ if has_terminal?('#', false, index)
365
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
366
+ @index += 1
367
+ else
368
+ terminal_parse_failure('#')
369
+ r1 = nil
370
+ end
371
+ s0 << r1
372
+ if r1
373
+ s2, i2 = [], index
374
+ loop do
375
+ i3, s3 = index, []
376
+ i4 = index
377
+ if has_terminal?('\G[\\n\\r]', true, index)
378
+ r5 = true
379
+ @index += 1
380
+ else
381
+ r5 = nil
382
+ end
383
+ if r5
384
+ r4 = nil
385
+ else
386
+ @index = i4
387
+ r4 = instantiate_node(SyntaxNode,input, index...index)
388
+ end
389
+ s3 << r4
390
+ if r4
391
+ if index < input_length
392
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
393
+ @index += 1
394
+ else
395
+ terminal_parse_failure("any character")
396
+ r6 = nil
397
+ end
398
+ s3 << r6
399
+ end
400
+ if s3.last
401
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
402
+ r3.extend(Comment0)
403
+ else
404
+ @index = i3
405
+ r3 = nil
406
+ end
407
+ if r3
408
+ s2 << r3
409
+ else
410
+ break
411
+ end
412
+ end
413
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
414
+ s0 << r2
415
+ end
416
+ if s0.last
417
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
418
+ r0.extend(Comment1)
419
+ else
420
+ @index = i0
421
+ r0 = nil
422
+ end
423
+
424
+ node_cache[:comment][start_index] = r0
425
+
426
+ r0
427
+ end
428
+
429
+ module Declaration0
430
+ def barename_csl
431
+ elements[2]
432
+ end
433
+ end
434
+
435
+ module Declaration1
436
+ def declaration; true; end
437
+ def keywords; true;end
438
+ end
439
+
440
+ module Declaration2
441
+ def explicituri
442
+ elements[3]
443
+ end
444
+ end
445
+
446
+ module Declaration3
447
+ def declaration; true; end
448
+ def base; true; end
449
+ end
450
+
451
+ module Declaration4
452
+ def nprefix
453
+ elements[3]
454
+ end
455
+
456
+ def explicituri
457
+ elements[6]
458
+ end
459
+ end
460
+
461
+ module Declaration5
462
+ def declaration; true; end
463
+ end
464
+
465
+ def _nt_declaration
466
+ start_index = index
467
+ if node_cache[:declaration].has_key?(index)
468
+ cached = node_cache[:declaration][index]
469
+ if cached
470
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
471
+ @index = cached.interval.end
472
+ end
473
+ return cached
474
+ end
475
+
476
+ i0 = index
477
+ i1, s1 = index, []
478
+ if has_terminal?("@", false, index)
479
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
480
+ @index += 1
481
+ else
482
+ terminal_parse_failure("@")
483
+ r3 = nil
484
+ end
485
+ if r3
486
+ r2 = r3
487
+ else
488
+ r2 = instantiate_node(SyntaxNode,input, index...index)
489
+ end
490
+ s1 << r2
491
+ if r2
492
+ if has_terminal?('keywords', false, index)
493
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 8))
494
+ @index += 8
495
+ else
496
+ terminal_parse_failure('keywords')
497
+ r4 = nil
498
+ end
499
+ s1 << r4
500
+ if r4
501
+ r5 = _nt_barename_csl
502
+ s1 << r5
503
+ end
504
+ end
505
+ if s1.last
506
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
507
+ r1.extend(Declaration0)
508
+ r1.extend(Declaration1)
509
+ else
510
+ @index = i1
511
+ r1 = nil
512
+ end
513
+ if r1
514
+ r0 = r1
515
+ else
516
+ i6, s6 = index, []
517
+ if has_terminal?("@", false, index)
518
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
519
+ @index += 1
520
+ else
521
+ terminal_parse_failure("@")
522
+ r8 = nil
523
+ end
524
+ if r8
525
+ r7 = r8
526
+ else
527
+ r7 = instantiate_node(SyntaxNode,input, index...index)
528
+ end
529
+ s6 << r7
530
+ if r7
531
+ if has_terminal?('base', false, index)
532
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 4))
533
+ @index += 4
534
+ else
535
+ terminal_parse_failure('base')
536
+ r9 = nil
537
+ end
538
+ s6 << r9
539
+ if r9
540
+ s10, i10 = [], index
541
+ loop do
542
+ r11 = _nt_space
543
+ if r11
544
+ s10 << r11
545
+ else
546
+ break
547
+ end
548
+ end
549
+ if s10.empty?
550
+ @index = i10
551
+ r10 = nil
552
+ else
553
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
554
+ end
555
+ s6 << r10
556
+ if r10
557
+ r12 = _nt_explicituri
558
+ s6 << r12
559
+ end
560
+ end
561
+ end
562
+ if s6.last
563
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
564
+ r6.extend(Declaration2)
565
+ r6.extend(Declaration3)
566
+ else
567
+ @index = i6
568
+ r6 = nil
569
+ end
570
+ if r6
571
+ r0 = r6
572
+ else
573
+ i13, s13 = index, []
574
+ if has_terminal?("@", false, index)
575
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
576
+ @index += 1
577
+ else
578
+ terminal_parse_failure("@")
579
+ r15 = nil
580
+ end
581
+ if r15
582
+ r14 = r15
583
+ else
584
+ r14 = instantiate_node(SyntaxNode,input, index...index)
585
+ end
586
+ s13 << r14
587
+ if r14
588
+ if has_terminal?('prefix', false, index)
589
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 6))
590
+ @index += 6
591
+ else
592
+ terminal_parse_failure('prefix')
593
+ r16 = nil
594
+ end
595
+ s13 << r16
596
+ if r16
597
+ s17, i17 = [], index
598
+ loop do
599
+ r18 = _nt_space
600
+ if r18
601
+ s17 << r18
602
+ else
603
+ break
604
+ end
605
+ end
606
+ if s17.empty?
607
+ @index = i17
608
+ r17 = nil
609
+ else
610
+ r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
611
+ end
612
+ s13 << r17
613
+ if r17
614
+ r20 = _nt_nprefix
615
+ if r20
616
+ r19 = r20
617
+ else
618
+ r19 = instantiate_node(SyntaxNode,input, index...index)
619
+ end
620
+ s13 << r19
621
+ if r19
622
+ if has_terminal?(':', false, index)
623
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
624
+ @index += 1
625
+ else
626
+ terminal_parse_failure(':')
627
+ r21 = nil
628
+ end
629
+ s13 << r21
630
+ if r21
631
+ s22, i22 = [], index
632
+ loop do
633
+ r23 = _nt_space
634
+ if r23
635
+ s22 << r23
636
+ else
637
+ break
638
+ end
639
+ end
640
+ r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
641
+ s13 << r22
642
+ if r22
643
+ r24 = _nt_explicituri
644
+ s13 << r24
645
+ end
646
+ end
647
+ end
648
+ end
649
+ end
650
+ end
651
+ if s13.last
652
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
653
+ r13.extend(Declaration4)
654
+ r13.extend(Declaration5)
655
+ else
656
+ @index = i13
657
+ r13 = nil
658
+ end
659
+ if r13
660
+ r0 = r13
661
+ else
662
+ @index = i0
663
+ r0 = nil
664
+ end
665
+ end
666
+ end
667
+
668
+ node_cache[:declaration][start_index] = r0
669
+
670
+ r0
671
+ end
672
+
673
+ module Decimal0
674
+ def integer
675
+ elements[0]
676
+ end
677
+
678
+ end
679
+
680
+ def _nt_decimal
681
+ start_index = index
682
+ if node_cache[:decimal].has_key?(index)
683
+ cached = node_cache[:decimal][index]
684
+ if cached
685
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
686
+ @index = cached.interval.end
687
+ end
688
+ return cached
689
+ end
690
+
691
+ i0, s0 = index, []
692
+ r1 = _nt_integer
693
+ s0 << r1
694
+ if r1
695
+ if has_terminal?('.', false, index)
696
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
697
+ @index += 1
698
+ else
699
+ terminal_parse_failure('.')
700
+ r2 = nil
701
+ end
702
+ s0 << r2
703
+ if r2
704
+ s3, i3 = [], index
705
+ loop do
706
+ if has_terminal?('\G[0-9]', true, index)
707
+ r4 = true
708
+ @index += 1
709
+ else
710
+ r4 = nil
711
+ end
712
+ if r4
713
+ s3 << r4
714
+ else
715
+ break
716
+ end
717
+ end
718
+ if s3.empty?
719
+ @index = i3
720
+ r3 = nil
721
+ else
722
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
723
+ end
724
+ s0 << r3
725
+ end
726
+ end
727
+ if s0.last
728
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
729
+ r0.extend(Decimal0)
730
+ else
731
+ @index = i0
732
+ r0 = nil
733
+ end
734
+
735
+ node_cache[:decimal][start_index] = r0
736
+
737
+ r0
738
+ end
739
+
740
+ module Double0
741
+ def decimal
742
+ elements[0]
743
+ end
744
+
745
+ def integer
746
+ elements[2]
747
+ end
748
+ end
749
+
750
+ def _nt_double
751
+ start_index = index
752
+ if node_cache[:double].has_key?(index)
753
+ cached = node_cache[:double][index]
754
+ if cached
755
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
756
+ @index = cached.interval.end
757
+ end
758
+ return cached
759
+ end
760
+
761
+ i0, s0 = index, []
762
+ r1 = _nt_decimal
763
+ s0 << r1
764
+ if r1
765
+ if has_terminal?('\G[eE]', true, index)
766
+ r2 = true
767
+ @index += 1
768
+ else
769
+ r2 = nil
770
+ end
771
+ s0 << r2
772
+ if r2
773
+ r3 = _nt_integer
774
+ s0 << r3
775
+ end
776
+ end
777
+ if s0.last
778
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
779
+ r0.extend(Double0)
780
+ else
781
+ @index = i0
782
+ r0 = nil
783
+ end
784
+
785
+ node_cache[:double][start_index] = r0
786
+
787
+ r0
788
+ end
789
+
790
+ module Existential0
791
+ def symbol_csl
792
+ elements[3]
793
+ end
794
+ end
795
+
796
+ def _nt_existential
797
+ start_index = index
798
+ if node_cache[:existential].has_key?(index)
799
+ cached = node_cache[:existential][index]
800
+ if cached
801
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
802
+ @index = cached.interval.end
803
+ end
804
+ return cached
805
+ end
806
+
807
+ i0, s0 = index, []
808
+ if has_terminal?("@", false, index)
809
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
810
+ @index += 1
811
+ else
812
+ terminal_parse_failure("@")
813
+ r2 = nil
814
+ end
815
+ if r2
816
+ r1 = r2
817
+ else
818
+ r1 = instantiate_node(SyntaxNode,input, index...index)
819
+ end
820
+ s0 << r1
821
+ if r1
822
+ if has_terminal?("forSome", false, index)
823
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
824
+ @index += 7
825
+ else
826
+ terminal_parse_failure("forSome")
827
+ r3 = nil
828
+ end
829
+ s0 << r3
830
+ if r3
831
+ s4, i4 = [], index
832
+ loop do
833
+ r5 = _nt_space
834
+ if r5
835
+ s4 << r5
836
+ else
837
+ break
838
+ end
839
+ end
840
+ if s4.empty?
841
+ @index = i4
842
+ r4 = nil
843
+ else
844
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
845
+ end
846
+ s0 << r4
847
+ if r4
848
+ r6 = _nt_symbol_csl
849
+ s0 << r6
850
+ end
851
+ end
852
+ end
853
+ if s0.last
854
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
855
+ r0.extend(Existential0)
856
+ else
857
+ @index = i0
858
+ r0 = nil
859
+ end
860
+
861
+ node_cache[:existential][start_index] = r0
862
+
863
+ r0
864
+ end
865
+
866
+ module Explicituri0
867
+ def uri
868
+ elements[1]
869
+ end
870
+
871
+ end
872
+
873
+ def _nt_explicituri
874
+ start_index = index
875
+ if node_cache[:explicituri].has_key?(index)
876
+ cached = node_cache[:explicituri][index]
877
+ if cached
878
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
879
+ @index = cached.interval.end
880
+ end
881
+ return cached
882
+ end
883
+
884
+ i0, s0 = index, []
885
+ if has_terminal?("<", false, index)
886
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
887
+ @index += 1
888
+ else
889
+ terminal_parse_failure("<")
890
+ r1 = nil
891
+ end
892
+ s0 << r1
893
+ if r1
894
+ r2 = _nt_URI_Reference
895
+ s0 << r2
896
+ if r2
897
+ if has_terminal?(">", false, index)
898
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
899
+ @index += 1
900
+ else
901
+ terminal_parse_failure(">")
902
+ r3 = nil
903
+ end
904
+ s0 << r3
905
+ end
906
+ end
907
+ if s0.last
908
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
909
+ r0.extend(Explicituri0)
910
+ else
911
+ @index = i0
912
+ r0 = nil
913
+ end
914
+
915
+ node_cache[:explicituri][start_index] = r0
916
+
917
+ r0
918
+ end
919
+
920
+ module Expression0
921
+ def pathitem
922
+ elements[0]
923
+ end
924
+
925
+ def expression
926
+ elements[3]
927
+ end
928
+ end
929
+
930
+ module Expression1
931
+ def pathitem
932
+ elements[0]
933
+ end
934
+
935
+ def expression
936
+ elements[4]
937
+ end
938
+ end
939
+
940
+ module Expression2
941
+ def pathitem
942
+ elements[0]
943
+ end
944
+
945
+ def expression
946
+ elements[4]
947
+ end
948
+ end
949
+
950
+ module Expression3
951
+ def reverse; true; end
952
+ end
953
+
954
+ def _nt_expression
955
+ start_index = index
956
+ if node_cache[:expression].has_key?(index)
957
+ cached = node_cache[:expression][index]
958
+ if cached
959
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
960
+ @index = cached.interval.end
961
+ end
962
+ return cached
963
+ end
964
+
965
+ i0 = index
966
+ i1, s1 = index, []
967
+ r2 = _nt_pathitem
968
+ s1 << r2
969
+ if r2
970
+ s3, i3 = [], index
971
+ loop do
972
+ r4 = _nt_space
973
+ if r4
974
+ s3 << r4
975
+ else
976
+ break
977
+ end
978
+ end
979
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
980
+ s1 << r3
981
+ if r3
982
+ if has_terminal?('.', false, index)
983
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
984
+ @index += 1
985
+ else
986
+ terminal_parse_failure('.')
987
+ r5 = nil
988
+ end
989
+ s1 << r5
990
+ if r5
991
+ r6 = _nt_expression
992
+ s1 << r6
993
+ end
994
+ end
995
+ end
996
+ if s1.last
997
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
998
+ r1.extend(Expression0)
999
+ else
1000
+ @index = i1
1001
+ r1 = nil
1002
+ end
1003
+ if r1
1004
+ r0 = r1
1005
+ else
1006
+ i7, s7 = index, []
1007
+ r8 = _nt_pathitem
1008
+ s7 << r8
1009
+ if r8
1010
+ s9, i9 = [], index
1011
+ loop do
1012
+ r10 = _nt_space
1013
+ if r10
1014
+ s9 << r10
1015
+ else
1016
+ break
1017
+ end
1018
+ end
1019
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1020
+ s7 << r9
1021
+ if r9
1022
+ if has_terminal?("!", false, index)
1023
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1024
+ @index += 1
1025
+ else
1026
+ terminal_parse_failure("!")
1027
+ r11 = nil
1028
+ end
1029
+ s7 << r11
1030
+ if r11
1031
+ s12, i12 = [], index
1032
+ loop do
1033
+ r13 = _nt_space
1034
+ if r13
1035
+ s12 << r13
1036
+ else
1037
+ break
1038
+ end
1039
+ end
1040
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
1041
+ s7 << r12
1042
+ if r12
1043
+ r14 = _nt_expression
1044
+ s7 << r14
1045
+ end
1046
+ end
1047
+ end
1048
+ end
1049
+ if s7.last
1050
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
1051
+ r7.extend(Expression1)
1052
+ else
1053
+ @index = i7
1054
+ r7 = nil
1055
+ end
1056
+ if r7
1057
+ r0 = r7
1058
+ else
1059
+ i15, s15 = index, []
1060
+ r16 = _nt_pathitem
1061
+ s15 << r16
1062
+ if r16
1063
+ s17, i17 = [], index
1064
+ loop do
1065
+ r18 = _nt_space
1066
+ if r18
1067
+ s17 << r18
1068
+ else
1069
+ break
1070
+ end
1071
+ end
1072
+ r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
1073
+ s15 << r17
1074
+ if r17
1075
+ if has_terminal?("^", false, index)
1076
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
1077
+ @index += 1
1078
+ else
1079
+ terminal_parse_failure("^")
1080
+ r19 = nil
1081
+ end
1082
+ s15 << r19
1083
+ if r19
1084
+ s20, i20 = [], index
1085
+ loop do
1086
+ r21 = _nt_space
1087
+ if r21
1088
+ s20 << r21
1089
+ else
1090
+ break
1091
+ end
1092
+ end
1093
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
1094
+ s15 << r20
1095
+ if r20
1096
+ r22 = _nt_expression
1097
+ s15 << r22
1098
+ end
1099
+ end
1100
+ end
1101
+ end
1102
+ if s15.last
1103
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
1104
+ r15.extend(Expression2)
1105
+ r15.extend(Expression3)
1106
+ else
1107
+ @index = i15
1108
+ r15 = nil
1109
+ end
1110
+ if r15
1111
+ r0 = r15
1112
+ else
1113
+ r23 = _nt_pathitem
1114
+ if r23
1115
+ r0 = r23
1116
+ else
1117
+ @index = i0
1118
+ r0 = nil
1119
+ end
1120
+ end
1121
+ end
1122
+ end
1123
+
1124
+ node_cache[:expression][start_index] = r0
1125
+
1126
+ r0
1127
+ end
1128
+
1129
+ module Barename0
1130
+ def alpha
1131
+ elements[0]
1132
+ end
1133
+
1134
+ end
1135
+
1136
+ def _nt_barename
1137
+ start_index = index
1138
+ if node_cache[:barename].has_key?(index)
1139
+ cached = node_cache[:barename][index]
1140
+ if cached
1141
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1142
+ @index = cached.interval.end
1143
+ end
1144
+ return cached
1145
+ end
1146
+
1147
+ i0, s0 = index, []
1148
+ r1 = _nt_alpha
1149
+ s0 << r1
1150
+ if r1
1151
+ s2, i2 = [], index
1152
+ loop do
1153
+ i3 = index
1154
+ r4 = _nt_alphanumeric
1155
+ if r4
1156
+ r3 = r4
1157
+ else
1158
+ if has_terminal?('-', false, index)
1159
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1160
+ @index += 1
1161
+ else
1162
+ terminal_parse_failure('-')
1163
+ r5 = nil
1164
+ end
1165
+ if r5
1166
+ r3 = r5
1167
+ else
1168
+ @index = i3
1169
+ r3 = nil
1170
+ end
1171
+ end
1172
+ if r3
1173
+ s2 << r3
1174
+ else
1175
+ break
1176
+ end
1177
+ end
1178
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1179
+ s0 << r2
1180
+ end
1181
+ if s0.last
1182
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1183
+ r0.extend(Barename0)
1184
+ else
1185
+ @index = i0
1186
+ r0 = nil
1187
+ end
1188
+
1189
+ node_cache[:barename][start_index] = r0
1190
+
1191
+ r0
1192
+ end
1193
+
1194
+ def _nt_hexdigit
1195
+ start_index = index
1196
+ if node_cache[:hexdigit].has_key?(index)
1197
+ cached = node_cache[:hexdigit][index]
1198
+ if cached
1199
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1200
+ @index = cached.interval.end
1201
+ end
1202
+ return cached
1203
+ end
1204
+
1205
+ if has_terminal?('\G[0-9a-fA-F]', true, index)
1206
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
1207
+ @index += 1
1208
+ else
1209
+ r0 = nil
1210
+ end
1211
+
1212
+ node_cache[:hexdigit][start_index] = r0
1213
+
1214
+ r0
1215
+ end
1216
+
1217
+ module Integer0
1218
+ end
1219
+
1220
+ def _nt_integer
1221
+ start_index = index
1222
+ if node_cache[:integer].has_key?(index)
1223
+ cached = node_cache[:integer][index]
1224
+ if cached
1225
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1226
+ @index = cached.interval.end
1227
+ end
1228
+ return cached
1229
+ end
1230
+
1231
+ i0, s0 = index, []
1232
+ if has_terminal?('\G[+-]', true, index)
1233
+ r2 = true
1234
+ @index += 1
1235
+ else
1236
+ r2 = nil
1237
+ end
1238
+ if r2
1239
+ r1 = r2
1240
+ else
1241
+ r1 = instantiate_node(SyntaxNode,input, index...index)
1242
+ end
1243
+ s0 << r1
1244
+ if r1
1245
+ s3, i3 = [], index
1246
+ loop do
1247
+ if has_terminal?('\G[0-9]', true, index)
1248
+ r4 = true
1249
+ @index += 1
1250
+ else
1251
+ r4 = nil
1252
+ end
1253
+ if r4
1254
+ s3 << r4
1255
+ else
1256
+ break
1257
+ end
1258
+ end
1259
+ if s3.empty?
1260
+ @index = i3
1261
+ r3 = nil
1262
+ else
1263
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1264
+ end
1265
+ s0 << r3
1266
+ end
1267
+ if s0.last
1268
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1269
+ r0.extend(Integer0)
1270
+ else
1271
+ @index = i0
1272
+ r0 = nil
1273
+ end
1274
+
1275
+ node_cache[:integer][start_index] = r0
1276
+
1277
+ r0
1278
+ end
1279
+
1280
+ module Language0
1281
+ end
1282
+
1283
+ module Language1
1284
+ end
1285
+
1286
+ def _nt_language
1287
+ start_index = index
1288
+ if node_cache[:language].has_key?(index)
1289
+ cached = node_cache[:language][index]
1290
+ if cached
1291
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1292
+ @index = cached.interval.end
1293
+ end
1294
+ return cached
1295
+ end
1296
+
1297
+ i0, s0 = index, []
1298
+ s1, i1 = [], index
1299
+ loop do
1300
+ if has_terminal?('\G[a-z]', true, index)
1301
+ r2 = true
1302
+ @index += 1
1303
+ else
1304
+ r2 = nil
1305
+ end
1306
+ if r2
1307
+ s1 << r2
1308
+ else
1309
+ break
1310
+ end
1311
+ end
1312
+ if s1.empty?
1313
+ @index = i1
1314
+ r1 = nil
1315
+ else
1316
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1317
+ end
1318
+ s0 << r1
1319
+ if r1
1320
+ s3, i3 = [], index
1321
+ loop do
1322
+ i4, s4 = index, []
1323
+ if has_terminal?("-", false, index)
1324
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1325
+ @index += 1
1326
+ else
1327
+ terminal_parse_failure("-")
1328
+ r5 = nil
1329
+ end
1330
+ s4 << r5
1331
+ if r5
1332
+ s6, i6 = [], index
1333
+ loop do
1334
+ if has_terminal?('\G[a-z0-9]', true, index)
1335
+ r7 = true
1336
+ @index += 1
1337
+ else
1338
+ r7 = nil
1339
+ end
1340
+ if r7
1341
+ s6 << r7
1342
+ else
1343
+ break
1344
+ end
1345
+ end
1346
+ if s6.empty?
1347
+ @index = i6
1348
+ r6 = nil
1349
+ else
1350
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1351
+ end
1352
+ s4 << r6
1353
+ end
1354
+ if s4.last
1355
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1356
+ r4.extend(Language0)
1357
+ else
1358
+ @index = i4
1359
+ r4 = nil
1360
+ end
1361
+ if r4
1362
+ s3 << r4
1363
+ else
1364
+ break
1365
+ end
1366
+ end
1367
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1368
+ s0 << r3
1369
+ end
1370
+ if s0.last
1371
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1372
+ r0.extend(Language1)
1373
+ else
1374
+ @index = i0
1375
+ r0 = nil
1376
+ end
1377
+
1378
+ node_cache[:language][start_index] = r0
1379
+
1380
+ r0
1381
+ end
1382
+
1383
+ module Literal0
1384
+ def symbol
1385
+ elements[1]
1386
+ end
1387
+ end
1388
+
1389
+ module Literal1
1390
+ def language
1391
+ elements[1]
1392
+ end
1393
+ end
1394
+
1395
+ module Literal2
1396
+ end
1397
+
1398
+ def _nt_literal
1399
+ start_index = index
1400
+ if node_cache[:literal].has_key?(index)
1401
+ cached = node_cache[:literal][index]
1402
+ if cached
1403
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1404
+ @index = cached.interval.end
1405
+ end
1406
+ return cached
1407
+ end
1408
+
1409
+ i0, s0 = index, []
1410
+ i1 = index
1411
+ r2 = _nt_string_single
1412
+ if r2
1413
+ r1 = r2
1414
+ else
1415
+ r3 = _nt_string_multi
1416
+ if r3
1417
+ r1 = r3
1418
+ else
1419
+ @index = i1
1420
+ r1 = nil
1421
+ end
1422
+ end
1423
+ s0 << r1
1424
+ if r1
1425
+ i5 = index
1426
+ i6, s6 = index, []
1427
+ if has_terminal?("^^", false, index)
1428
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
1429
+ @index += 2
1430
+ else
1431
+ terminal_parse_failure("^^")
1432
+ r7 = nil
1433
+ end
1434
+ s6 << r7
1435
+ if r7
1436
+ r8 = _nt_symbol
1437
+ s6 << r8
1438
+ end
1439
+ if s6.last
1440
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1441
+ r6.extend(Literal0)
1442
+ else
1443
+ @index = i6
1444
+ r6 = nil
1445
+ end
1446
+ if r6
1447
+ r5 = r6
1448
+ else
1449
+ i9, s9 = index, []
1450
+ if has_terminal?("@", false, index)
1451
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
1452
+ @index += 1
1453
+ else
1454
+ terminal_parse_failure("@")
1455
+ r10 = nil
1456
+ end
1457
+ s9 << r10
1458
+ if r10
1459
+ r11 = _nt_language
1460
+ s9 << r11
1461
+ end
1462
+ if s9.last
1463
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1464
+ r9.extend(Literal1)
1465
+ else
1466
+ @index = i9
1467
+ r9 = nil
1468
+ end
1469
+ if r9
1470
+ r5 = r9
1471
+ else
1472
+ @index = i5
1473
+ r5 = nil
1474
+ end
1475
+ end
1476
+ if r5
1477
+ r4 = r5
1478
+ else
1479
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1480
+ end
1481
+ s0 << r4
1482
+ end
1483
+ if s0.last
1484
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1485
+ r0.extend(Literal2)
1486
+ else
1487
+ @index = i0
1488
+ r0 = nil
1489
+ end
1490
+
1491
+ node_cache[:literal][start_index] = r0
1492
+
1493
+ r0
1494
+ end
1495
+
1496
+ module Localname0
1497
+ def alpha
1498
+ elements[0]
1499
+ end
1500
+
1501
+ end
1502
+
1503
+ def _nt_localname
1504
+ start_index = index
1505
+ if node_cache[:localname].has_key?(index)
1506
+ cached = node_cache[:localname][index]
1507
+ if cached
1508
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1509
+ @index = cached.interval.end
1510
+ end
1511
+ return cached
1512
+ end
1513
+
1514
+ i0, s0 = index, []
1515
+ r1 = _nt_alpha
1516
+ s0 << r1
1517
+ if r1
1518
+ s2, i2 = [], index
1519
+ loop do
1520
+ i3 = index
1521
+ r4 = _nt_alphanumeric
1522
+ if r4
1523
+ r3 = r4
1524
+ else
1525
+ if has_terminal?('-', false, index)
1526
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1527
+ @index += 1
1528
+ else
1529
+ terminal_parse_failure('-')
1530
+ r5 = nil
1531
+ end
1532
+ if r5
1533
+ r3 = r5
1534
+ else
1535
+ @index = i3
1536
+ r3 = nil
1537
+ end
1538
+ end
1539
+ if r3
1540
+ s2 << r3
1541
+ else
1542
+ break
1543
+ end
1544
+ end
1545
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1546
+ s0 << r2
1547
+ end
1548
+ if s0.last
1549
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1550
+ r0.extend(Localname0)
1551
+ else
1552
+ @index = i0
1553
+ r0 = nil
1554
+ end
1555
+
1556
+ node_cache[:localname][start_index] = r0
1557
+
1558
+ r0
1559
+ end
1560
+
1561
+ module Nprefix0
1562
+ def alpha
1563
+ elements[0]
1564
+ end
1565
+
1566
+ end
1567
+
1568
+ def _nt_nprefix
1569
+ start_index = index
1570
+ if node_cache[:nprefix].has_key?(index)
1571
+ cached = node_cache[:nprefix][index]
1572
+ if cached
1573
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1574
+ @index = cached.interval.end
1575
+ end
1576
+ return cached
1577
+ end
1578
+
1579
+ i0, s0 = index, []
1580
+ r1 = _nt_alpha
1581
+ s0 << r1
1582
+ if r1
1583
+ s2, i2 = [], index
1584
+ loop do
1585
+ i3 = index
1586
+ r4 = _nt_alphanumeric
1587
+ if r4
1588
+ r3 = r4
1589
+ else
1590
+ if has_terminal?('-', false, index)
1591
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1592
+ @index += 1
1593
+ else
1594
+ terminal_parse_failure('-')
1595
+ r5 = nil
1596
+ end
1597
+ if r5
1598
+ r3 = r5
1599
+ else
1600
+ @index = i3
1601
+ r3 = nil
1602
+ end
1603
+ end
1604
+ if r3
1605
+ s2 << r3
1606
+ else
1607
+ break
1608
+ end
1609
+ end
1610
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1611
+ s0 << r2
1612
+ end
1613
+ if s0.last
1614
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1615
+ r0.extend(Nprefix0)
1616
+ else
1617
+ @index = i0
1618
+ r0 = nil
1619
+ end
1620
+
1621
+ node_cache[:nprefix][start_index] = r0
1622
+
1623
+ r0
1624
+ end
1625
+
1626
+ module Numericliteral0
1627
+ def numericliteral; "double"; end
1628
+ end
1629
+
1630
+ module Numericliteral1
1631
+ def numericliteral; "decimal"; end
1632
+ end
1633
+
1634
+ module Numericliteral2
1635
+ def numericliteral; "integer"; end
1636
+ end
1637
+
1638
+ def _nt_numericliteral
1639
+ start_index = index
1640
+ if node_cache[:numericliteral].has_key?(index)
1641
+ cached = node_cache[:numericliteral][index]
1642
+ if cached
1643
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1644
+ @index = cached.interval.end
1645
+ end
1646
+ return cached
1647
+ end
1648
+
1649
+ i0 = index
1650
+ r1 = _nt_double
1651
+ r1.extend(Numericliteral0)
1652
+ if r1
1653
+ r0 = r1
1654
+ else
1655
+ r2 = _nt_decimal
1656
+ r2.extend(Numericliteral1)
1657
+ if r2
1658
+ r0 = r2
1659
+ else
1660
+ r3 = _nt_integer
1661
+ r3.extend(Numericliteral2)
1662
+ if r3
1663
+ r0 = r3
1664
+ else
1665
+ @index = i0
1666
+ r0 = nil
1667
+ end
1668
+ end
1669
+ end
1670
+
1671
+ node_cache[:numericliteral][start_index] = r0
1672
+
1673
+ r0
1674
+ end
1675
+
1676
+ def _nt_object
1677
+ start_index = index
1678
+ if node_cache[:object].has_key?(index)
1679
+ cached = node_cache[:object][index]
1680
+ if cached
1681
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1682
+ @index = cached.interval.end
1683
+ end
1684
+ return cached
1685
+ end
1686
+
1687
+ r0 = _nt_expression
1688
+
1689
+ node_cache[:object][start_index] = r0
1690
+
1691
+ r0
1692
+ end
1693
+
1694
+ module ObjectList0
1695
+ def object
1696
+ elements[0]
1697
+ end
1698
+
1699
+ def object_list
1700
+ elements[4]
1701
+ end
1702
+ end
1703
+
1704
+ def _nt_object_list
1705
+ start_index = index
1706
+ if node_cache[:object_list].has_key?(index)
1707
+ cached = node_cache[:object_list][index]
1708
+ if cached
1709
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1710
+ @index = cached.interval.end
1711
+ end
1712
+ return cached
1713
+ end
1714
+
1715
+ i0 = index
1716
+ i1, s1 = index, []
1717
+ r2 = _nt_object
1718
+ s1 << r2
1719
+ if r2
1720
+ s3, i3 = [], index
1721
+ loop do
1722
+ r4 = _nt_space
1723
+ if r4
1724
+ s3 << r4
1725
+ else
1726
+ break
1727
+ end
1728
+ end
1729
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1730
+ s1 << r3
1731
+ if r3
1732
+ if has_terminal?(",", false, index)
1733
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
1734
+ @index += 1
1735
+ else
1736
+ terminal_parse_failure(",")
1737
+ r5 = nil
1738
+ end
1739
+ s1 << r5
1740
+ if r5
1741
+ s6, i6 = [], index
1742
+ loop do
1743
+ r7 = _nt_space
1744
+ if r7
1745
+ s6 << r7
1746
+ else
1747
+ break
1748
+ end
1749
+ end
1750
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1751
+ s1 << r6
1752
+ if r6
1753
+ r8 = _nt_object_list
1754
+ s1 << r8
1755
+ end
1756
+ end
1757
+ end
1758
+ end
1759
+ if s1.last
1760
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1761
+ r1.extend(ObjectList0)
1762
+ else
1763
+ @index = i1
1764
+ r1 = nil
1765
+ end
1766
+ if r1
1767
+ r0 = r1
1768
+ else
1769
+ r9 = _nt_object
1770
+ if r9
1771
+ r0 = r9
1772
+ else
1773
+ @index = i0
1774
+ r0 = nil
1775
+ end
1776
+ end
1777
+
1778
+ node_cache[:object_list][start_index] = r0
1779
+
1780
+ r0
1781
+ end
1782
+
1783
+ module Pathitem0
1784
+ def boolean; true; end
1785
+ end
1786
+
1787
+ module Pathitem1
1788
+ def literal; true; end
1789
+ end
1790
+
1791
+ module Pathitem2
1792
+ end
1793
+
1794
+ module Pathitem3
1795
+ def anonnode; true; end
1796
+ end
1797
+
1798
+ module Pathitem4
1799
+ def property_list
1800
+ elements[2]
1801
+ end
1802
+
1803
+ end
1804
+
1805
+ module Pathitem5
1806
+ def anonnode; true; end
1807
+ end
1808
+
1809
+ module Pathitem6
1810
+ def statements
1811
+ elements[2]
1812
+ end
1813
+
1814
+ end
1815
+
1816
+ module Pathitem7
1817
+ def anonnode; true; end
1818
+ end
1819
+
1820
+ module Pathitem8
1821
+ def path_list
1822
+ elements[2]
1823
+ end
1824
+
1825
+ end
1826
+
1827
+ module Pathitem9
1828
+ def anonnode; true; end
1829
+ end
1830
+
1831
+ def _nt_pathitem
1832
+ start_index = index
1833
+ if node_cache[:pathitem].has_key?(index)
1834
+ cached = node_cache[:pathitem][index]
1835
+ if cached
1836
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1837
+ @index = cached.interval.end
1838
+ end
1839
+ return cached
1840
+ end
1841
+
1842
+ i0 = index
1843
+ r1 = _nt_boolean
1844
+ r1.extend(Pathitem0)
1845
+ if r1
1846
+ r0 = r1
1847
+ else
1848
+ r2 = _nt_literal
1849
+ r2.extend(Pathitem1)
1850
+ if r2
1851
+ r0 = r2
1852
+ else
1853
+ r3 = _nt_numericliteral
1854
+ if r3
1855
+ r0 = r3
1856
+ else
1857
+ r4 = _nt_symbol
1858
+ if r4
1859
+ r0 = r4
1860
+ else
1861
+ i5, s5 = index, []
1862
+ if has_terminal?("[", false, index)
1863
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1864
+ @index += 1
1865
+ else
1866
+ terminal_parse_failure("[")
1867
+ r6 = nil
1868
+ end
1869
+ s5 << r6
1870
+ if r6
1871
+ s7, i7 = [], index
1872
+ loop do
1873
+ r8 = _nt_space
1874
+ if r8
1875
+ s7 << r8
1876
+ else
1877
+ break
1878
+ end
1879
+ end
1880
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
1881
+ s5 << r7
1882
+ if r7
1883
+ if has_terminal?("]", false, index)
1884
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
1885
+ @index += 1
1886
+ else
1887
+ terminal_parse_failure("]")
1888
+ r9 = nil
1889
+ end
1890
+ s5 << r9
1891
+ end
1892
+ end
1893
+ if s5.last
1894
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1895
+ r5.extend(Pathitem2)
1896
+ r5.extend(Pathitem3)
1897
+ else
1898
+ @index = i5
1899
+ r5 = nil
1900
+ end
1901
+ if r5
1902
+ r0 = r5
1903
+ else
1904
+ i10, s10 = index, []
1905
+ if has_terminal?("[", false, index)
1906
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
1907
+ @index += 1
1908
+ else
1909
+ terminal_parse_failure("[")
1910
+ r11 = nil
1911
+ end
1912
+ s10 << r11
1913
+ if r11
1914
+ s12, i12 = [], index
1915
+ loop do
1916
+ r13 = _nt_space
1917
+ if r13
1918
+ s12 << r13
1919
+ else
1920
+ break
1921
+ end
1922
+ end
1923
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
1924
+ s10 << r12
1925
+ if r12
1926
+ r14 = _nt_property_list
1927
+ s10 << r14
1928
+ if r14
1929
+ s15, i15 = [], index
1930
+ loop do
1931
+ r16 = _nt_space
1932
+ if r16
1933
+ s15 << r16
1934
+ else
1935
+ break
1936
+ end
1937
+ end
1938
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
1939
+ s10 << r15
1940
+ if r15
1941
+ if has_terminal?("]", false, index)
1942
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
1943
+ @index += 1
1944
+ else
1945
+ terminal_parse_failure("]")
1946
+ r17 = nil
1947
+ end
1948
+ s10 << r17
1949
+ end
1950
+ end
1951
+ end
1952
+ end
1953
+ if s10.last
1954
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
1955
+ r10.extend(Pathitem4)
1956
+ r10.extend(Pathitem5)
1957
+ else
1958
+ @index = i10
1959
+ r10 = nil
1960
+ end
1961
+ if r10
1962
+ r0 = r10
1963
+ else
1964
+ i18, s18 = index, []
1965
+ if has_terminal?("{", false, index)
1966
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
1967
+ @index += 1
1968
+ else
1969
+ terminal_parse_failure("{")
1970
+ r19 = nil
1971
+ end
1972
+ s18 << r19
1973
+ if r19
1974
+ s20, i20 = [], index
1975
+ loop do
1976
+ r21 = _nt_space
1977
+ if r21
1978
+ s20 << r21
1979
+ else
1980
+ break
1981
+ end
1982
+ end
1983
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
1984
+ s18 << r20
1985
+ if r20
1986
+ r22 = _nt_statements
1987
+ s18 << r22
1988
+ if r22
1989
+ s23, i23 = [], index
1990
+ loop do
1991
+ r24 = _nt_space
1992
+ if r24
1993
+ s23 << r24
1994
+ else
1995
+ break
1996
+ end
1997
+ end
1998
+ r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
1999
+ s18 << r23
2000
+ if r23
2001
+ if has_terminal?("}", false, index)
2002
+ r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
2003
+ @index += 1
2004
+ else
2005
+ terminal_parse_failure("}")
2006
+ r25 = nil
2007
+ end
2008
+ s18 << r25
2009
+ end
2010
+ end
2011
+ end
2012
+ end
2013
+ if s18.last
2014
+ r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
2015
+ r18.extend(Pathitem6)
2016
+ r18.extend(Pathitem7)
2017
+ else
2018
+ @index = i18
2019
+ r18 = nil
2020
+ end
2021
+ if r18
2022
+ r0 = r18
2023
+ else
2024
+ i26, s26 = index, []
2025
+ if has_terminal?("(", false, index)
2026
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 1))
2027
+ @index += 1
2028
+ else
2029
+ terminal_parse_failure("(")
2030
+ r27 = nil
2031
+ end
2032
+ s26 << r27
2033
+ if r27
2034
+ s28, i28 = [], index
2035
+ loop do
2036
+ r29 = _nt_space
2037
+ if r29
2038
+ s28 << r29
2039
+ else
2040
+ break
2041
+ end
2042
+ end
2043
+ r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
2044
+ s26 << r28
2045
+ if r28
2046
+ r30 = _nt_path_list
2047
+ s26 << r30
2048
+ if r30
2049
+ s31, i31 = [], index
2050
+ loop do
2051
+ r32 = _nt_space
2052
+ if r32
2053
+ s31 << r32
2054
+ else
2055
+ break
2056
+ end
2057
+ end
2058
+ r31 = instantiate_node(SyntaxNode,input, i31...index, s31)
2059
+ s26 << r31
2060
+ if r31
2061
+ if has_terminal?(")", false, index)
2062
+ r33 = instantiate_node(SyntaxNode,input, index...(index + 1))
2063
+ @index += 1
2064
+ else
2065
+ terminal_parse_failure(")")
2066
+ r33 = nil
2067
+ end
2068
+ s26 << r33
2069
+ end
2070
+ end
2071
+ end
2072
+ end
2073
+ if s26.last
2074
+ r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
2075
+ r26.extend(Pathitem8)
2076
+ r26.extend(Pathitem9)
2077
+ else
2078
+ @index = i26
2079
+ r26 = nil
2080
+ end
2081
+ if r26
2082
+ r0 = r26
2083
+ else
2084
+ @index = i0
2085
+ r0 = nil
2086
+ end
2087
+ end
2088
+ end
2089
+ end
2090
+ end
2091
+ end
2092
+ end
2093
+ end
2094
+
2095
+ node_cache[:pathitem][start_index] = r0
2096
+
2097
+ r0
2098
+ end
2099
+
2100
+ module PathList0
2101
+ def expression
2102
+ elements[0]
2103
+ end
2104
+
2105
+ def path_list
2106
+ elements[2]
2107
+ end
2108
+ end
2109
+
2110
+ def _nt_path_list
2111
+ start_index = index
2112
+ if node_cache[:path_list].has_key?(index)
2113
+ cached = node_cache[:path_list][index]
2114
+ if cached
2115
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2116
+ @index = cached.interval.end
2117
+ end
2118
+ return cached
2119
+ end
2120
+
2121
+ i0 = index
2122
+ i1, s1 = index, []
2123
+ r2 = _nt_expression
2124
+ s1 << r2
2125
+ if r2
2126
+ s3, i3 = [], index
2127
+ loop do
2128
+ r4 = _nt_space
2129
+ if r4
2130
+ s3 << r4
2131
+ else
2132
+ break
2133
+ end
2134
+ end
2135
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2136
+ s1 << r3
2137
+ if r3
2138
+ r5 = _nt_path_list
2139
+ s1 << r5
2140
+ end
2141
+ end
2142
+ if s1.last
2143
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2144
+ r1.extend(PathList0)
2145
+ else
2146
+ @index = i1
2147
+ r1 = nil
2148
+ end
2149
+ if r1
2150
+ r0 = r1
2151
+ else
2152
+ if has_terminal?("", false, index)
2153
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 0))
2154
+ @index += 0
2155
+ else
2156
+ terminal_parse_failure("")
2157
+ r6 = nil
2158
+ end
2159
+ if r6
2160
+ r0 = r6
2161
+ else
2162
+ @index = i0
2163
+ r0 = nil
2164
+ end
2165
+ end
2166
+
2167
+ node_cache[:path_list][start_index] = r0
2168
+
2169
+ r0
2170
+ end
2171
+
2172
+ def _nt_prop
2173
+ start_index = index
2174
+ if node_cache[:prop].has_key?(index)
2175
+ cached = node_cache[:prop][index]
2176
+ if cached
2177
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2178
+ @index = cached.interval.end
2179
+ end
2180
+ return cached
2181
+ end
2182
+
2183
+ r0 = _nt_expression
2184
+
2185
+ node_cache[:prop][start_index] = r0
2186
+
2187
+ r0
2188
+ end
2189
+
2190
+ module PropertyList0
2191
+ def verb
2192
+ elements[0]
2193
+ end
2194
+
2195
+ def object_list
2196
+ elements[2]
2197
+ end
2198
+
2199
+ def property_list
2200
+ elements[6]
2201
+ end
2202
+ end
2203
+
2204
+ module PropertyList1
2205
+ def verb
2206
+ elements[0]
2207
+ end
2208
+
2209
+ def object_list
2210
+ elements[2]
2211
+ end
2212
+
2213
+ end
2214
+
2215
+ module PropertyList2
2216
+ def verb
2217
+ elements[0]
2218
+ end
2219
+
2220
+ end
2221
+
2222
+ module PropertyList3
2223
+ def object_missing; true; end
2224
+ end
2225
+
2226
+ def _nt_property_list
2227
+ start_index = index
2228
+ if node_cache[:property_list].has_key?(index)
2229
+ cached = node_cache[:property_list][index]
2230
+ if cached
2231
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2232
+ @index = cached.interval.end
2233
+ end
2234
+ return cached
2235
+ end
2236
+
2237
+ i0 = index
2238
+ i1, s1 = index, []
2239
+ r2 = _nt_verb
2240
+ s1 << r2
2241
+ if r2
2242
+ s3, i3 = [], index
2243
+ loop do
2244
+ r4 = _nt_space
2245
+ if r4
2246
+ s3 << r4
2247
+ else
2248
+ break
2249
+ end
2250
+ end
2251
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2252
+ s1 << r3
2253
+ if r3
2254
+ r5 = _nt_object_list
2255
+ s1 << r5
2256
+ if r5
2257
+ s6, i6 = [], index
2258
+ loop do
2259
+ r7 = _nt_space
2260
+ if r7
2261
+ s6 << r7
2262
+ else
2263
+ break
2264
+ end
2265
+ end
2266
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
2267
+ s1 << r6
2268
+ if r6
2269
+ s8, i8 = [], index
2270
+ loop do
2271
+ if has_terminal?(";", false, index)
2272
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2273
+ @index += 1
2274
+ else
2275
+ terminal_parse_failure(";")
2276
+ r9 = nil
2277
+ end
2278
+ if r9
2279
+ s8 << r9
2280
+ else
2281
+ break
2282
+ end
2283
+ end
2284
+ if s8.empty?
2285
+ @index = i8
2286
+ r8 = nil
2287
+ else
2288
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
2289
+ end
2290
+ s1 << r8
2291
+ if r8
2292
+ s10, i10 = [], index
2293
+ loop do
2294
+ r11 = _nt_space
2295
+ if r11
2296
+ s10 << r11
2297
+ else
2298
+ break
2299
+ end
2300
+ end
2301
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
2302
+ s1 << r10
2303
+ if r10
2304
+ r12 = _nt_property_list
2305
+ s1 << r12
2306
+ end
2307
+ end
2308
+ end
2309
+ end
2310
+ end
2311
+ end
2312
+ if s1.last
2313
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2314
+ r1.extend(PropertyList0)
2315
+ else
2316
+ @index = i1
2317
+ r1 = nil
2318
+ end
2319
+ if r1
2320
+ r0 = r1
2321
+ else
2322
+ i13, s13 = index, []
2323
+ r14 = _nt_verb
2324
+ s13 << r14
2325
+ if r14
2326
+ s15, i15 = [], index
2327
+ loop do
2328
+ r16 = _nt_space
2329
+ if r16
2330
+ s15 << r16
2331
+ else
2332
+ break
2333
+ end
2334
+ end
2335
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
2336
+ s13 << r15
2337
+ if r15
2338
+ r17 = _nt_object_list
2339
+ s13 << r17
2340
+ if r17
2341
+ s18, i18 = [], index
2342
+ loop do
2343
+ r19 = _nt_space
2344
+ if r19
2345
+ s18 << r19
2346
+ else
2347
+ break
2348
+ end
2349
+ end
2350
+ r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
2351
+ s13 << r18
2352
+ if r18
2353
+ s20, i20 = [], index
2354
+ loop do
2355
+ if has_terminal?(";", false, index)
2356
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
2357
+ @index += 1
2358
+ else
2359
+ terminal_parse_failure(";")
2360
+ r21 = nil
2361
+ end
2362
+ if r21
2363
+ s20 << r21
2364
+ else
2365
+ break
2366
+ end
2367
+ end
2368
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
2369
+ s13 << r20
2370
+ end
2371
+ end
2372
+ end
2373
+ end
2374
+ if s13.last
2375
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
2376
+ r13.extend(PropertyList1)
2377
+ else
2378
+ @index = i13
2379
+ r13 = nil
2380
+ end
2381
+ if r13
2382
+ r0 = r13
2383
+ else
2384
+ i22, s22 = index, []
2385
+ r23 = _nt_verb
2386
+ s22 << r23
2387
+ if r23
2388
+ s24, i24 = [], index
2389
+ loop do
2390
+ r25 = _nt_space
2391
+ if r25
2392
+ s24 << r25
2393
+ else
2394
+ break
2395
+ end
2396
+ end
2397
+ r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
2398
+ s22 << r24
2399
+ if r24
2400
+ s26, i26 = [], index
2401
+ loop do
2402
+ if has_terminal?(";", false, index)
2403
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 1))
2404
+ @index += 1
2405
+ else
2406
+ terminal_parse_failure(";")
2407
+ r27 = nil
2408
+ end
2409
+ if r27
2410
+ s26 << r27
2411
+ else
2412
+ break
2413
+ end
2414
+ end
2415
+ r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
2416
+ s22 << r26
2417
+ end
2418
+ end
2419
+ if s22.last
2420
+ r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
2421
+ r22.extend(PropertyList2)
2422
+ r22.extend(PropertyList3)
2423
+ else
2424
+ @index = i22
2425
+ r22 = nil
2426
+ end
2427
+ if r22
2428
+ r0 = r22
2429
+ else
2430
+ if has_terminal?("", false, index)
2431
+ r28 = instantiate_node(SyntaxNode,input, index...(index + 0))
2432
+ @index += 0
2433
+ else
2434
+ terminal_parse_failure("")
2435
+ r28 = nil
2436
+ end
2437
+ if r28
2438
+ r0 = r28
2439
+ else
2440
+ @index = i0
2441
+ r0 = nil
2442
+ end
2443
+ end
2444
+ end
2445
+ end
2446
+
2447
+ node_cache[:property_list][start_index] = r0
2448
+
2449
+ r0
2450
+ end
2451
+
2452
+ module Qname0
2453
+ def nprefix
2454
+ elements[0]
2455
+ end
2456
+
2457
+ def localname
2458
+ elements[2]
2459
+ end
2460
+ end
2461
+
2462
+ module Qname1
2463
+ def nprefix
2464
+ elements[0]
2465
+ end
2466
+
2467
+ end
2468
+
2469
+ module Qname2
2470
+ def text_value; ""; end
2471
+ end
2472
+
2473
+ module Qname3
2474
+ end
2475
+
2476
+ module Qname4
2477
+ def barename; true; end
2478
+ end
2479
+
2480
+ def _nt_qname
2481
+ start_index = index
2482
+ if node_cache[:qname].has_key?(index)
2483
+ cached = node_cache[:qname][index]
2484
+ if cached
2485
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2486
+ @index = cached.interval.end
2487
+ end
2488
+ return cached
2489
+ end
2490
+
2491
+ i0 = index
2492
+ i1, s1 = index, []
2493
+ r2 = _nt_nprefix
2494
+ s1 << r2
2495
+ if r2
2496
+ if has_terminal?(":", false, index)
2497
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
2498
+ @index += 1
2499
+ else
2500
+ terminal_parse_failure(":")
2501
+ r3 = nil
2502
+ end
2503
+ s1 << r3
2504
+ if r3
2505
+ r4 = _nt_localname
2506
+ s1 << r4
2507
+ end
2508
+ end
2509
+ if s1.last
2510
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2511
+ r1.extend(Qname0)
2512
+ else
2513
+ @index = i1
2514
+ r1 = nil
2515
+ end
2516
+ if r1
2517
+ r0 = r1
2518
+ else
2519
+ i5, s5 = index, []
2520
+ r6 = _nt_nprefix
2521
+ s5 << r6
2522
+ if r6
2523
+ if has_terminal?(':', false, index)
2524
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
2525
+ @index += 1
2526
+ else
2527
+ terminal_parse_failure(':')
2528
+ r7 = nil
2529
+ end
2530
+ s5 << r7
2531
+ end
2532
+ if s5.last
2533
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2534
+ r5.extend(Qname1)
2535
+ r5.extend(Qname2)
2536
+ else
2537
+ @index = i5
2538
+ r5 = nil
2539
+ end
2540
+ if r5
2541
+ r0 = r5
2542
+ else
2543
+ i8, s8 = index, []
2544
+ if has_terminal?(':', false, index)
2545
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2546
+ @index += 1
2547
+ else
2548
+ terminal_parse_failure(':')
2549
+ r9 = nil
2550
+ end
2551
+ s8 << r9
2552
+ if r9
2553
+ s10, i10 = [], index
2554
+ loop do
2555
+ r11 = _nt_localname
2556
+ if r11
2557
+ s10 << r11
2558
+ else
2559
+ break
2560
+ end
2561
+ end
2562
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
2563
+ s8 << r10
2564
+ end
2565
+ if s8.last
2566
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
2567
+ r8.extend(Qname3)
2568
+ else
2569
+ @index = i8
2570
+ r8 = nil
2571
+ end
2572
+ if r8
2573
+ r0 = r8
2574
+ else
2575
+ r12 = _nt_localname
2576
+ r12.extend(Qname4)
2577
+ if r12
2578
+ r0 = r12
2579
+ else
2580
+ @index = i0
2581
+ r0 = nil
2582
+ end
2583
+ end
2584
+ end
2585
+ end
2586
+
2587
+ node_cache[:qname][start_index] = r0
2588
+
2589
+ r0
2590
+ end
2591
+
2592
+ module SimpleStatement0
2593
+ def subject
2594
+ elements[0]
2595
+ end
2596
+
2597
+ def property_list
2598
+ elements[2]
2599
+ end
2600
+ end
2601
+
2602
+ def _nt_simpleStatement
2603
+ start_index = index
2604
+ if node_cache[:simpleStatement].has_key?(index)
2605
+ cached = node_cache[:simpleStatement][index]
2606
+ if cached
2607
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2608
+ @index = cached.interval.end
2609
+ end
2610
+ return cached
2611
+ end
2612
+
2613
+ i0 = index
2614
+ i1, s1 = index, []
2615
+ r2 = _nt_subject
2616
+ s1 << r2
2617
+ if r2
2618
+ s3, i3 = [], index
2619
+ loop do
2620
+ r4 = _nt_space
2621
+ if r4
2622
+ s3 << r4
2623
+ else
2624
+ break
2625
+ end
2626
+ end
2627
+ if s3.empty?
2628
+ @index = i3
2629
+ r3 = nil
2630
+ else
2631
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2632
+ end
2633
+ s1 << r3
2634
+ if r3
2635
+ r5 = _nt_property_list
2636
+ s1 << r5
2637
+ end
2638
+ end
2639
+ if s1.last
2640
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2641
+ r1.extend(SimpleStatement0)
2642
+ else
2643
+ @index = i1
2644
+ r1 = nil
2645
+ end
2646
+ if r1
2647
+ r0 = r1
2648
+ else
2649
+ r6 = _nt_subject
2650
+ if r6
2651
+ r0 = r6
2652
+ else
2653
+ @index = i0
2654
+ r0 = nil
2655
+ end
2656
+ end
2657
+
2658
+ node_cache[:simpleStatement][start_index] = r0
2659
+
2660
+ r0
2661
+ end
2662
+
2663
+ def _nt_space
2664
+ start_index = index
2665
+ if node_cache[:space].has_key?(index)
2666
+ cached = node_cache[:space][index]
2667
+ if cached
2668
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2669
+ @index = cached.interval.end
2670
+ end
2671
+ return cached
2672
+ end
2673
+
2674
+ i0 = index
2675
+ s1, i1 = [], index
2676
+ loop do
2677
+ if has_terminal?('\G[ \\t\\n\\r]', true, index)
2678
+ r2 = true
2679
+ @index += 1
2680
+ else
2681
+ r2 = nil
2682
+ end
2683
+ if r2
2684
+ s1 << r2
2685
+ else
2686
+ break
2687
+ end
2688
+ end
2689
+ if s1.empty?
2690
+ @index = i1
2691
+ r1 = nil
2692
+ else
2693
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2694
+ end
2695
+ if r1
2696
+ r0 = r1
2697
+ else
2698
+ r3 = _nt_comment
2699
+ if r3
2700
+ r0 = r3
2701
+ else
2702
+ @index = i0
2703
+ r0 = nil
2704
+ end
2705
+ end
2706
+
2707
+ node_cache[:space][start_index] = r0
2708
+
2709
+ r0
2710
+ end
2711
+
2712
+ def _nt_statement
2713
+ start_index = index
2714
+ if node_cache[:statement].has_key?(index)
2715
+ cached = node_cache[:statement][index]
2716
+ if cached
2717
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2718
+ @index = cached.interval.end
2719
+ end
2720
+ return cached
2721
+ end
2722
+
2723
+ i0 = index
2724
+ r1 = _nt_declaration
2725
+ if r1
2726
+ r0 = r1
2727
+ else
2728
+ r2 = _nt_existential
2729
+ if r2
2730
+ r0 = r2
2731
+ else
2732
+ r3 = _nt_simpleStatement
2733
+ if r3
2734
+ r0 = r3
2735
+ else
2736
+ r4 = _nt_universal
2737
+ if r4
2738
+ r0 = r4
2739
+ else
2740
+ @index = i0
2741
+ r0 = nil
2742
+ end
2743
+ end
2744
+ end
2745
+ end
2746
+
2747
+ node_cache[:statement][start_index] = r0
2748
+
2749
+ r0
2750
+ end
2751
+
2752
+ module Statements0
2753
+ end
2754
+
2755
+ module Statements1
2756
+ def statement
2757
+ elements[0]
2758
+ end
2759
+
2760
+ end
2761
+
2762
+ def _nt_statements
2763
+ start_index = index
2764
+ if node_cache[:statements].has_key?(index)
2765
+ cached = node_cache[:statements][index]
2766
+ if cached
2767
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2768
+ @index = cached.interval.end
2769
+ end
2770
+ return cached
2771
+ end
2772
+
2773
+ s0, i0 = [], index
2774
+ loop do
2775
+ i1 = index
2776
+ r2 = _nt_space
2777
+ if r2
2778
+ r1 = r2
2779
+ else
2780
+ i3, s3 = index, []
2781
+ r4 = _nt_statement
2782
+ s3 << r4
2783
+ if r4
2784
+ s5, i5 = [], index
2785
+ loop do
2786
+ r6 = _nt_space
2787
+ if r6
2788
+ s5 << r6
2789
+ else
2790
+ break
2791
+ end
2792
+ end
2793
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2794
+ s3 << r5
2795
+ if r5
2796
+ i8, s8 = index, []
2797
+ if has_terminal?('.', false, index)
2798
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2799
+ @index += 1
2800
+ else
2801
+ terminal_parse_failure('.')
2802
+ r9 = nil
2803
+ end
2804
+ s8 << r9
2805
+ if r9
2806
+ s10, i10 = [], index
2807
+ loop do
2808
+ r11 = _nt_space
2809
+ if r11
2810
+ s10 << r11
2811
+ else
2812
+ break
2813
+ end
2814
+ end
2815
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
2816
+ s8 << r10
2817
+ end
2818
+ if s8.last
2819
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
2820
+ r8.extend(Statements0)
2821
+ else
2822
+ @index = i8
2823
+ r8 = nil
2824
+ end
2825
+ if r8
2826
+ r7 = r8
2827
+ else
2828
+ r7 = instantiate_node(SyntaxNode,input, index...index)
2829
+ end
2830
+ s3 << r7
2831
+ end
2832
+ end
2833
+ if s3.last
2834
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2835
+ r3.extend(Statements1)
2836
+ else
2837
+ @index = i3
2838
+ r3 = nil
2839
+ end
2840
+ if r3
2841
+ r1 = r3
2842
+ else
2843
+ @index = i1
2844
+ r1 = nil
2845
+ end
2846
+ end
2847
+ if r1
2848
+ s0 << r1
2849
+ else
2850
+ break
2851
+ end
2852
+ end
2853
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2854
+
2855
+ node_cache[:statements][start_index] = r0
2856
+
2857
+ r0
2858
+ end
2859
+
2860
+ module StringSingle0
2861
+ end
2862
+
2863
+ module StringSingle1
2864
+ end
2865
+
2866
+ def _nt_string_single
2867
+ start_index = index
2868
+ if node_cache[:string_single].has_key?(index)
2869
+ cached = node_cache[:string_single][index]
2870
+ if cached
2871
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2872
+ @index = cached.interval.end
2873
+ end
2874
+ return cached
2875
+ end
2876
+
2877
+ i0 = index
2878
+ i1, s1 = index, []
2879
+ if has_terminal?('""', false, index)
2880
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
2881
+ @index += 2
2882
+ else
2883
+ terminal_parse_failure('""')
2884
+ r2 = nil
2885
+ end
2886
+ s1 << r2
2887
+ if r2
2888
+ i3 = index
2889
+ if has_terminal?('\G["]', true, index)
2890
+ r4 = true
2891
+ @index += 1
2892
+ else
2893
+ r4 = nil
2894
+ end
2895
+ if r4
2896
+ r3 = nil
2897
+ else
2898
+ @index = i3
2899
+ r3 = instantiate_node(SyntaxNode,input, index...index)
2900
+ end
2901
+ s1 << r3
2902
+ end
2903
+ if s1.last
2904
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2905
+ r1.extend(StringSingle0)
2906
+ else
2907
+ @index = i1
2908
+ r1 = nil
2909
+ end
2910
+ if r1
2911
+ r0 = r1
2912
+ else
2913
+ i5, s5 = index, []
2914
+ if has_terminal?('"', false, index)
2915
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
2916
+ @index += 1
2917
+ else
2918
+ terminal_parse_failure('"')
2919
+ r6 = nil
2920
+ end
2921
+ s5 << r6
2922
+ if r6
2923
+ s7, i7 = [], index
2924
+ loop do
2925
+ r8 = _nt_string_single_char
2926
+ if r8
2927
+ s7 << r8
2928
+ else
2929
+ break
2930
+ end
2931
+ end
2932
+ if s7.empty?
2933
+ @index = i7
2934
+ r7 = nil
2935
+ else
2936
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2937
+ end
2938
+ s5 << r7
2939
+ if r7
2940
+ if has_terminal?('"', false, index)
2941
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
2942
+ @index += 1
2943
+ else
2944
+ terminal_parse_failure('"')
2945
+ r9 = nil
2946
+ end
2947
+ s5 << r9
2948
+ end
2949
+ end
2950
+ if s5.last
2951
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2952
+ r5.extend(StringSingle1)
2953
+ else
2954
+ @index = i5
2955
+ r5 = nil
2956
+ end
2957
+ if r5
2958
+ r0 = r5
2959
+ else
2960
+ @index = i0
2961
+ r0 = nil
2962
+ end
2963
+ end
2964
+
2965
+ node_cache[:string_single][start_index] = r0
2966
+
2967
+ r0
2968
+ end
2969
+
2970
+ module StringSingleChar0
2971
+ end
2972
+
2973
+ module StringSingleChar1
2974
+ def hexdigit1
2975
+ elements[1]
2976
+ end
2977
+
2978
+ def hexdigit2
2979
+ elements[2]
2980
+ end
2981
+
2982
+ def hexdigit3
2983
+ elements[3]
2984
+ end
2985
+
2986
+ def hexdigit4
2987
+ elements[4]
2988
+ end
2989
+ end
2990
+
2991
+ module StringSingleChar2
2992
+ def hexdigit1
2993
+ elements[2]
2994
+ end
2995
+
2996
+ def hexdigit2
2997
+ elements[3]
2998
+ end
2999
+
3000
+ def hexdigit3
3001
+ elements[4]
3002
+ end
3003
+
3004
+ def hexdigit4
3005
+ elements[5]
3006
+ end
3007
+
3008
+ def hexdigit5
3009
+ elements[6]
3010
+ end
3011
+
3012
+ def hexdigit6
3013
+ elements[7]
3014
+ end
3015
+ end
3016
+
3017
+ module StringSingleChar3
3018
+ end
3019
+
3020
+ def _nt_string_single_char
3021
+ start_index = index
3022
+ if node_cache[:string_single_char].has_key?(index)
3023
+ cached = node_cache[:string_single_char][index]
3024
+ if cached
3025
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3026
+ @index = cached.interval.end
3027
+ end
3028
+ return cached
3029
+ end
3030
+
3031
+ i0, s0 = index, []
3032
+ i1 = index
3033
+ if has_terminal?('\G["\\n\\r]', true, index)
3034
+ r2 = true
3035
+ @index += 1
3036
+ else
3037
+ r2 = nil
3038
+ end
3039
+ if r2
3040
+ r1 = nil
3041
+ else
3042
+ @index = i1
3043
+ r1 = instantiate_node(SyntaxNode,input, index...index)
3044
+ end
3045
+ s0 << r1
3046
+ if r1
3047
+ i3 = index
3048
+ i4 = index
3049
+ i5, s5 = index, []
3050
+ if has_terminal?("\\", false, index)
3051
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
3052
+ @index += 1
3053
+ else
3054
+ terminal_parse_failure("\\")
3055
+ r6 = nil
3056
+ end
3057
+ s5 << r6
3058
+ if r6
3059
+ if has_terminal?('\G[\\\\\\"bfnrt]', true, index)
3060
+ r7 = true
3061
+ @index += 1
3062
+ else
3063
+ r7 = nil
3064
+ end
3065
+ s5 << r7
3066
+ end
3067
+ if s5.last
3068
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
3069
+ r5.extend(StringSingleChar0)
3070
+ else
3071
+ @index = i5
3072
+ r5 = nil
3073
+ end
3074
+ if r5
3075
+ r4 = r5
3076
+ else
3077
+ i8, s8 = index, []
3078
+ if has_terminal?("u", false, index)
3079
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
3080
+ @index += 1
3081
+ else
3082
+ terminal_parse_failure("u")
3083
+ r9 = nil
3084
+ end
3085
+ s8 << r9
3086
+ if r9
3087
+ r10 = _nt_hexdigit
3088
+ s8 << r10
3089
+ if r10
3090
+ r11 = _nt_hexdigit
3091
+ s8 << r11
3092
+ if r11
3093
+ r12 = _nt_hexdigit
3094
+ s8 << r12
3095
+ if r12
3096
+ r13 = _nt_hexdigit
3097
+ s8 << r13
3098
+ end
3099
+ end
3100
+ end
3101
+ end
3102
+ if s8.last
3103
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
3104
+ r8.extend(StringSingleChar1)
3105
+ else
3106
+ @index = i8
3107
+ r8 = nil
3108
+ end
3109
+ if r8
3110
+ r4 = r8
3111
+ else
3112
+ i14, s14 = index, []
3113
+ if has_terminal?("U", false, index)
3114
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
3115
+ @index += 1
3116
+ else
3117
+ terminal_parse_failure("U")
3118
+ r15 = nil
3119
+ end
3120
+ s14 << r15
3121
+ if r15
3122
+ if has_terminal?("00", false, index)
3123
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 2))
3124
+ @index += 2
3125
+ else
3126
+ terminal_parse_failure("00")
3127
+ r16 = nil
3128
+ end
3129
+ s14 << r16
3130
+ if r16
3131
+ r17 = _nt_hexdigit
3132
+ s14 << r17
3133
+ if r17
3134
+ r18 = _nt_hexdigit
3135
+ s14 << r18
3136
+ if r18
3137
+ r19 = _nt_hexdigit
3138
+ s14 << r19
3139
+ if r19
3140
+ r20 = _nt_hexdigit
3141
+ s14 << r20
3142
+ if r20
3143
+ r21 = _nt_hexdigit
3144
+ s14 << r21
3145
+ if r21
3146
+ r22 = _nt_hexdigit
3147
+ s14 << r22
3148
+ end
3149
+ end
3150
+ end
3151
+ end
3152
+ end
3153
+ end
3154
+ end
3155
+ if s14.last
3156
+ r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
3157
+ r14.extend(StringSingleChar2)
3158
+ else
3159
+ @index = i14
3160
+ r14 = nil
3161
+ end
3162
+ if r14
3163
+ r4 = r14
3164
+ else
3165
+ @index = i4
3166
+ r4 = nil
3167
+ end
3168
+ end
3169
+ end
3170
+ if r4
3171
+ r3 = r4
3172
+ else
3173
+ if index < input_length
3174
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
3175
+ @index += 1
3176
+ else
3177
+ terminal_parse_failure("any character")
3178
+ r23 = nil
3179
+ end
3180
+ if r23
3181
+ r3 = r23
3182
+ else
3183
+ @index = i3
3184
+ r3 = nil
3185
+ end
3186
+ end
3187
+ s0 << r3
3188
+ end
3189
+ if s0.last
3190
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3191
+ r0.extend(StringSingleChar3)
3192
+ else
3193
+ @index = i0
3194
+ r0 = nil
3195
+ end
3196
+
3197
+ node_cache[:string_single_char][start_index] = r0
3198
+
3199
+ r0
3200
+ end
3201
+
3202
+ module StringMulti0
3203
+ end
3204
+
3205
+ def _nt_string_multi
3206
+ start_index = index
3207
+ if node_cache[:string_multi].has_key?(index)
3208
+ cached = node_cache[:string_multi][index]
3209
+ if cached
3210
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3211
+ @index = cached.interval.end
3212
+ end
3213
+ return cached
3214
+ end
3215
+
3216
+ i0, s0 = index, []
3217
+ if has_terminal?('"""', false, index)
3218
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
3219
+ @index += 3
3220
+ else
3221
+ terminal_parse_failure('"""')
3222
+ r1 = nil
3223
+ end
3224
+ s0 << r1
3225
+ if r1
3226
+ s2, i2 = [], index
3227
+ loop do
3228
+ r3 = _nt_string_multi_single_char
3229
+ if r3
3230
+ s2 << r3
3231
+ else
3232
+ break
3233
+ end
3234
+ end
3235
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3236
+ s0 << r2
3237
+ if r2
3238
+ if has_terminal?('"""', false, index)
3239
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
3240
+ @index += 3
3241
+ else
3242
+ terminal_parse_failure('"""')
3243
+ r4 = nil
3244
+ end
3245
+ s0 << r4
3246
+ end
3247
+ end
3248
+ if s0.last
3249
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3250
+ r0.extend(StringMulti0)
3251
+ else
3252
+ @index = i0
3253
+ r0 = nil
3254
+ end
3255
+
3256
+ node_cache[:string_multi][start_index] = r0
3257
+
3258
+ r0
3259
+ end
3260
+
3261
+ module StringMultiSingleChar0
3262
+ end
3263
+
3264
+ def _nt_string_multi_single_char
3265
+ start_index = index
3266
+ if node_cache[:string_multi_single_char].has_key?(index)
3267
+ cached = node_cache[:string_multi_single_char][index]
3268
+ if cached
3269
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3270
+ @index = cached.interval.end
3271
+ end
3272
+ return cached
3273
+ end
3274
+
3275
+ i0 = index
3276
+ if has_terminal?("\\\"", false, index)
3277
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
3278
+ @index += 2
3279
+ else
3280
+ terminal_parse_failure("\\\"")
3281
+ r1 = nil
3282
+ end
3283
+ if r1
3284
+ r0 = r1
3285
+ else
3286
+ i2, s2 = index, []
3287
+ i3 = index
3288
+ if has_terminal?('"""', false, index)
3289
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
3290
+ @index += 3
3291
+ else
3292
+ terminal_parse_failure('"""')
3293
+ r4 = nil
3294
+ end
3295
+ if r4
3296
+ r3 = nil
3297
+ else
3298
+ @index = i3
3299
+ r3 = instantiate_node(SyntaxNode,input, index...index)
3300
+ end
3301
+ s2 << r3
3302
+ if r3
3303
+ if index < input_length
3304
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
3305
+ @index += 1
3306
+ else
3307
+ terminal_parse_failure("any character")
3308
+ r5 = nil
3309
+ end
3310
+ s2 << r5
3311
+ end
3312
+ if s2.last
3313
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3314
+ r2.extend(StringMultiSingleChar0)
3315
+ else
3316
+ @index = i2
3317
+ r2 = nil
3318
+ end
3319
+ if r2
3320
+ r0 = r2
3321
+ else
3322
+ @index = i0
3323
+ r0 = nil
3324
+ end
3325
+ end
3326
+
3327
+ node_cache[:string_multi_single_char][start_index] = r0
3328
+
3329
+ r0
3330
+ end
3331
+
3332
+ def _nt_subject
3333
+ start_index = index
3334
+ if node_cache[:subject].has_key?(index)
3335
+ cached = node_cache[:subject][index]
3336
+ if cached
3337
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3338
+ @index = cached.interval.end
3339
+ end
3340
+ return cached
3341
+ end
3342
+
3343
+ r0 = _nt_expression
3344
+
3345
+ node_cache[:subject][start_index] = r0
3346
+
3347
+ r0
3348
+ end
3349
+
3350
+ def _nt_symbol
3351
+ start_index = index
3352
+ if node_cache[:symbol].has_key?(index)
3353
+ cached = node_cache[:symbol][index]
3354
+ if cached
3355
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3356
+ @index = cached.interval.end
3357
+ end
3358
+ return cached
3359
+ end
3360
+
3361
+ i0 = index
3362
+ r1 = _nt_qname
3363
+ if r1
3364
+ r0 = r1
3365
+ else
3366
+ r2 = _nt_explicituri
3367
+ if r2
3368
+ r0 = r2
3369
+ else
3370
+ @index = i0
3371
+ r0 = nil
3372
+ end
3373
+ end
3374
+
3375
+ node_cache[:symbol][start_index] = r0
3376
+
3377
+ r0
3378
+ end
3379
+
3380
+ module SymbolCsl0
3381
+ def symbol
3382
+ elements[0]
3383
+ end
3384
+
3385
+ def symbol_csl
3386
+ elements[4]
3387
+ end
3388
+ end
3389
+
3390
+ def _nt_symbol_csl
3391
+ start_index = index
3392
+ if node_cache[:symbol_csl].has_key?(index)
3393
+ cached = node_cache[:symbol_csl][index]
3394
+ if cached
3395
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3396
+ @index = cached.interval.end
3397
+ end
3398
+ return cached
3399
+ end
3400
+
3401
+ i0 = index
3402
+ i1, s1 = index, []
3403
+ r2 = _nt_symbol
3404
+ s1 << r2
3405
+ if r2
3406
+ s3, i3 = [], index
3407
+ loop do
3408
+ r4 = _nt_space
3409
+ if r4
3410
+ s3 << r4
3411
+ else
3412
+ break
3413
+ end
3414
+ end
3415
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3416
+ s1 << r3
3417
+ if r3
3418
+ if has_terminal?(",", false, index)
3419
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
3420
+ @index += 1
3421
+ else
3422
+ terminal_parse_failure(",")
3423
+ r5 = nil
3424
+ end
3425
+ s1 << r5
3426
+ if r5
3427
+ s6, i6 = [], index
3428
+ loop do
3429
+ r7 = _nt_space
3430
+ if r7
3431
+ s6 << r7
3432
+ else
3433
+ break
3434
+ end
3435
+ end
3436
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
3437
+ s1 << r6
3438
+ if r6
3439
+ r8 = _nt_symbol_csl
3440
+ s1 << r8
3441
+ end
3442
+ end
3443
+ end
3444
+ end
3445
+ if s1.last
3446
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3447
+ r1.extend(SymbolCsl0)
3448
+ else
3449
+ @index = i1
3450
+ r1 = nil
3451
+ end
3452
+ if r1
3453
+ r0 = r1
3454
+ else
3455
+ r9 = _nt_symbol
3456
+ if r9
3457
+ r0 = r9
3458
+ else
3459
+ @index = i0
3460
+ r0 = nil
3461
+ end
3462
+ end
3463
+
3464
+ node_cache[:symbol_csl][start_index] = r0
3465
+
3466
+ r0
3467
+ end
3468
+
3469
+ module Verb0
3470
+ def prop
3471
+ elements[3]
3472
+ end
3473
+ end
3474
+
3475
+ module Verb1
3476
+ def prop
3477
+ elements[3]
3478
+ end
3479
+
3480
+ end
3481
+
3482
+ module Verb2
3483
+ # is xxx of
3484
+ def invert; true; end
3485
+ end
3486
+
3487
+ module Verb3
3488
+ end
3489
+
3490
+ module Verb4
3491
+ def invert; true; end
3492
+ end
3493
+
3494
+ def _nt_verb
3495
+ start_index = index
3496
+ if node_cache[:verb].has_key?(index)
3497
+ cached = node_cache[:verb][index]
3498
+ if cached
3499
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3500
+ @index = cached.interval.end
3501
+ end
3502
+ return cached
3503
+ end
3504
+
3505
+ i0 = index
3506
+ i1, s1 = index, []
3507
+ if has_terminal?("@", false, index)
3508
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
3509
+ @index += 1
3510
+ else
3511
+ terminal_parse_failure("@")
3512
+ r3 = nil
3513
+ end
3514
+ if r3
3515
+ r2 = r3
3516
+ else
3517
+ r2 = instantiate_node(SyntaxNode,input, index...index)
3518
+ end
3519
+ s1 << r2
3520
+ if r2
3521
+ if has_terminal?("has", false, index)
3522
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
3523
+ @index += 3
3524
+ else
3525
+ terminal_parse_failure("has")
3526
+ r4 = nil
3527
+ end
3528
+ s1 << r4
3529
+ if r4
3530
+ s5, i5 = [], index
3531
+ loop do
3532
+ r6 = _nt_space
3533
+ if r6
3534
+ s5 << r6
3535
+ else
3536
+ break
3537
+ end
3538
+ end
3539
+ if s5.empty?
3540
+ @index = i5
3541
+ r5 = nil
3542
+ else
3543
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
3544
+ end
3545
+ s1 << r5
3546
+ if r5
3547
+ r7 = _nt_prop
3548
+ s1 << r7
3549
+ end
3550
+ end
3551
+ end
3552
+ if s1.last
3553
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3554
+ r1.extend(Verb0)
3555
+ else
3556
+ @index = i1
3557
+ r1 = nil
3558
+ end
3559
+ if r1
3560
+ r0 = r1
3561
+ else
3562
+ i8, s8 = index, []
3563
+ if has_terminal?("@", false, index)
3564
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
3565
+ @index += 1
3566
+ else
3567
+ terminal_parse_failure("@")
3568
+ r10 = nil
3569
+ end
3570
+ if r10
3571
+ r9 = r10
3572
+ else
3573
+ r9 = instantiate_node(SyntaxNode,input, index...index)
3574
+ end
3575
+ s8 << r9
3576
+ if r9
3577
+ if has_terminal?("is", false, index)
3578
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 2))
3579
+ @index += 2
3580
+ else
3581
+ terminal_parse_failure("is")
3582
+ r11 = nil
3583
+ end
3584
+ s8 << r11
3585
+ if r11
3586
+ s12, i12 = [], index
3587
+ loop do
3588
+ r13 = _nt_space
3589
+ if r13
3590
+ s12 << r13
3591
+ else
3592
+ break
3593
+ end
3594
+ end
3595
+ if s12.empty?
3596
+ @index = i12
3597
+ r12 = nil
3598
+ else
3599
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
3600
+ end
3601
+ s8 << r12
3602
+ if r12
3603
+ r14 = _nt_prop
3604
+ s8 << r14
3605
+ if r14
3606
+ s15, i15 = [], index
3607
+ loop do
3608
+ r16 = _nt_space
3609
+ if r16
3610
+ s15 << r16
3611
+ else
3612
+ break
3613
+ end
3614
+ end
3615
+ if s15.empty?
3616
+ @index = i15
3617
+ r15 = nil
3618
+ else
3619
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
3620
+ end
3621
+ s8 << r15
3622
+ if r15
3623
+ if has_terminal?("@", false, index)
3624
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
3625
+ @index += 1
3626
+ else
3627
+ terminal_parse_failure("@")
3628
+ r18 = nil
3629
+ end
3630
+ if r18
3631
+ r17 = r18
3632
+ else
3633
+ r17 = instantiate_node(SyntaxNode,input, index...index)
3634
+ end
3635
+ s8 << r17
3636
+ if r17
3637
+ if has_terminal?("of", false, index)
3638
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 2))
3639
+ @index += 2
3640
+ else
3641
+ terminal_parse_failure("of")
3642
+ r19 = nil
3643
+ end
3644
+ s8 << r19
3645
+ end
3646
+ end
3647
+ end
3648
+ end
3649
+ end
3650
+ end
3651
+ if s8.last
3652
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
3653
+ r8.extend(Verb1)
3654
+ r8.extend(Verb2)
3655
+ else
3656
+ @index = i8
3657
+ r8 = nil
3658
+ end
3659
+ if r8
3660
+ r0 = r8
3661
+ else
3662
+ i20, s20 = index, []
3663
+ if has_terminal?("@", false, index)
3664
+ r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
3665
+ @index += 1
3666
+ else
3667
+ terminal_parse_failure("@")
3668
+ r22 = nil
3669
+ end
3670
+ if r22
3671
+ r21 = r22
3672
+ else
3673
+ r21 = instantiate_node(SyntaxNode,input, index...index)
3674
+ end
3675
+ s20 << r21
3676
+ if r21
3677
+ if has_terminal?("a", false, index)
3678
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
3679
+ @index += 1
3680
+ else
3681
+ terminal_parse_failure("a")
3682
+ r23 = nil
3683
+ end
3684
+ s20 << r23
3685
+ if r23
3686
+ i24 = index
3687
+ if has_terminal?(":", false, index)
3688
+ r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
3689
+ @index += 1
3690
+ else
3691
+ terminal_parse_failure(":")
3692
+ r25 = nil
3693
+ end
3694
+ if r25
3695
+ r24 = nil
3696
+ else
3697
+ @index = i24
3698
+ r24 = instantiate_node(SyntaxNode,input, index...index)
3699
+ end
3700
+ s20 << r24
3701
+ end
3702
+ end
3703
+ if s20.last
3704
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
3705
+ r20.extend(Verb3)
3706
+ else
3707
+ @index = i20
3708
+ r20 = nil
3709
+ end
3710
+ if r20
3711
+ r0 = r20
3712
+ else
3713
+ if has_terminal?("=>", false, index)
3714
+ r26 = instantiate_node(SyntaxNode,input, index...(index + 2))
3715
+ @index += 2
3716
+ else
3717
+ terminal_parse_failure("=>")
3718
+ r26 = nil
3719
+ end
3720
+ if r26
3721
+ r0 = r26
3722
+ else
3723
+ if has_terminal?("<=", false, index)
3724
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
3725
+ r27.extend(Verb4)
3726
+ @index += 2
3727
+ else
3728
+ terminal_parse_failure("<=")
3729
+ r27 = nil
3730
+ end
3731
+ if r27
3732
+ r0 = r27
3733
+ else
3734
+ if has_terminal?("=", false, index)
3735
+ r28 = instantiate_node(SyntaxNode,input, index...(index + 1))
3736
+ @index += 1
3737
+ else
3738
+ terminal_parse_failure("=")
3739
+ r28 = nil
3740
+ end
3741
+ if r28
3742
+ r0 = r28
3743
+ else
3744
+ r29 = _nt_prop
3745
+ if r29
3746
+ r0 = r29
3747
+ else
3748
+ @index = i0
3749
+ r0 = nil
3750
+ end
3751
+ end
3752
+ end
3753
+ end
3754
+ end
3755
+ end
3756
+ end
3757
+
3758
+ node_cache[:verb][start_index] = r0
3759
+
3760
+ r0
3761
+ end
3762
+
3763
+ module Universal0
3764
+ def symbol_csl
3765
+ elements[3]
3766
+ end
3767
+ end
3768
+
3769
+ def _nt_universal
3770
+ start_index = index
3771
+ if node_cache[:universal].has_key?(index)
3772
+ cached = node_cache[:universal][index]
3773
+ if cached
3774
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3775
+ @index = cached.interval.end
3776
+ end
3777
+ return cached
3778
+ end
3779
+
3780
+ i0, s0 = index, []
3781
+ if has_terminal?("@", false, index)
3782
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3783
+ @index += 1
3784
+ else
3785
+ terminal_parse_failure("@")
3786
+ r2 = nil
3787
+ end
3788
+ if r2
3789
+ r1 = r2
3790
+ else
3791
+ r1 = instantiate_node(SyntaxNode,input, index...index)
3792
+ end
3793
+ s0 << r1
3794
+ if r1
3795
+ if has_terminal?("forAll", false, index)
3796
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 6))
3797
+ @index += 6
3798
+ else
3799
+ terminal_parse_failure("forAll")
3800
+ r3 = nil
3801
+ end
3802
+ s0 << r3
3803
+ if r3
3804
+ s4, i4 = [], index
3805
+ loop do
3806
+ r5 = _nt_space
3807
+ if r5
3808
+ s4 << r5
3809
+ else
3810
+ break
3811
+ end
3812
+ end
3813
+ if s4.empty?
3814
+ @index = i4
3815
+ r4 = nil
3816
+ else
3817
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
3818
+ end
3819
+ s0 << r4
3820
+ if r4
3821
+ r6 = _nt_symbol_csl
3822
+ s0 << r6
3823
+ end
3824
+ end
3825
+ end
3826
+ if s0.last
3827
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3828
+ r0.extend(Universal0)
3829
+ else
3830
+ @index = i0
3831
+ r0 = nil
3832
+ end
3833
+
3834
+ node_cache[:universal][start_index] = r0
3835
+
3836
+ r0
3837
+ end
3838
+
3839
+ def _nt_URI_Reference
3840
+ start_index = index
3841
+ if node_cache[:URI_Reference].has_key?(index)
3842
+ cached = node_cache[:URI_Reference][index]
3843
+ if cached
3844
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3845
+ @index = cached.interval.end
3846
+ end
3847
+ return cached
3848
+ end
3849
+
3850
+ s0, i0 = [], index
3851
+ loop do
3852
+ if has_terminal?('\G[^{}<>]', true, index)
3853
+ r1 = true
3854
+ @index += 1
3855
+ else
3856
+ r1 = nil
3857
+ end
3858
+ if r1
3859
+ s0 << r1
3860
+ else
3861
+ break
3862
+ end
3863
+ end
3864
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3865
+
3866
+ node_cache[:URI_Reference][start_index] = r0
3867
+
3868
+ r0
3869
+ end
3870
+
3871
+ end
3872
+
3873
+ class N3GrammerParser < Treetop::Runtime::CompiledParser
3874
+ include N3Grammer
3875
+ end
3876
+