Method: Formatting#_nt_request

Defined in:
lib/ntail/formatting.rb

#_nt_requestObject



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/ntail/formatting.rb', line 256

def _nt_request
  start_index = index
  if node_cache[:request].has_key?(index)
    cached = node_cache[:request][index]
    if cached
      cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
      @index = cached.interval.end
    end
    return cached
  end

  if has_terminal?('%r', false, index)
    r0 = instantiate_node(Node,input, index...(index + 2))
    r0.extend(Request0)
    @index += 2
  else
    terminal_parse_failure('%r')
    r0 = nil
  end

  node_cache[:request][start_index] = r0

  r0
end