31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/hemingway/block/center/center.rb', line 31
def _nt_center
start_index = index
if node_cache[:center].has_key?(index)
cached = node_cache[:center][index]
if cached
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
s0, i0 = [], index
loop do
i1 = index
i2, s2 = index, []
i3 = index
i4, s4 = index, []
r5 = _nt_block_end
s4 << r5
if r5
r6 = _nt_center_type
s4 << r6
end
if s4.last
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
r4.extend(Center0)
else
@index = i4
r4 = nil
end
if r4
r3 = nil
else
@index = i3
r3 = instantiate_node(SyntaxNode,input, index...index)
end
s2 << r3
if r3
r7 = _nt_content
s2 << r7
end
if s2.last
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
r2.extend(Center1)
else
@index = i2
r2 = nil
end
if r2
r1 = r2
else
r8 = _nt_newline
if r8
r1 = r8
else
@index = i1
r1 = nil
end
end
if r1
s0 << r1
else
break
end
end
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
node_cache[:center][start_index] = r0
r0
end
|