Method: Cucumber::Parser::PyString#_nt_close_py_string

Defined in:
lib/cucumber/parser/py_string.rb

#_nt_close_py_stringObject



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/cucumber/parser/py_string.rb', line 223

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

  i0, s0 = index, []
  r1 = _nt_eol
  s0 << r1
  if r1
    s2, i2 = [], index
    loop do
      r3 = _nt_space
      if r3
        s2 << r3
      else
        break
      end
    end
    r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
    s0 << r2
    if r2
      if has_terminal?('"""', false, index)
        r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
        @index += 3
      else
        terminal_parse_failure('"""')
        r4 = nil
      end
      s0 << r4
      if r4
        r5 = _nt_white
        s0 << r5
      end
    end
  end
  if s0.last
    r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
    r0.extend(ClosePyString0)
    r0.extend(ClosePyString1)
  else
    @index = i0
    r0 = nil
  end

  node_cache[:close_py_string][start_index] = r0

  r0
end