hemingway 0.0.0 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +297 -0
- data/Rakefile +1 -0
- data/hemingway.gemspec +23 -0
- data/lib/hemingway/block/block.rb +378 -0
- data/lib/hemingway/block/block.treetop +36 -0
- data/lib/hemingway/block/block_nodes.rb +9 -0
- data/lib/hemingway/block/list/list.rb +412 -0
- data/lib/hemingway/block/list/list.treetop +51 -0
- data/lib/hemingway/block/list/list_nodes.rb +39 -0
- data/lib/hemingway/block/quote/quote.rb +192 -0
- data/lib/hemingway/block/quote/quote.treetop +27 -0
- data/lib/hemingway/block/quote/quote_nodes.rb +25 -0
- data/lib/hemingway/block/verbatim/verbatim.rb +159 -0
- data/lib/hemingway/block/verbatim/verbatim.treetop +21 -0
- data/lib/hemingway/block/verbatim/verbatim_nodes.rb +9 -0
- data/lib/hemingway/build.rb +65 -0
- data/lib/hemingway/footnote/footnote.rb +83 -0
- data/lib/hemingway/footnote/footnote.treetop +11 -0
- data/lib/hemingway/footnote/footnote_nodes.rb +21 -0
- data/lib/hemingway/latex.rb +409 -0
- data/lib/hemingway/latex.treetop +81 -0
- data/lib/hemingway/latex_nodes.rb +45 -0
- data/lib/hemingway/math/math.rb +135 -0
- data/lib/hemingway/math/math.treetop +29 -0
- data/lib/hemingway/math/math_nodes.rb +7 -0
- data/lib/hemingway/special/special.rb +164 -0
- data/lib/hemingway/special/special.treetop +17 -0
- data/lib/hemingway/special/special_nodes.rb +7 -0
- data/lib/hemingway/symbol/symbol.rb +460 -0
- data/lib/hemingway/symbol/symbol.treetop +47 -0
- data/lib/hemingway/symbol/symbol_nodes.rb +7 -0
- data/lib/hemingway/tag/tag.rb +538 -0
- data/lib/hemingway/tag/tag.treetop +63 -0
- data/lib/hemingway/tag/tag_nodes.rb +49 -0
- data/lib/hemingway/text/text.rb +121 -0
- data/lib/hemingway/text/text.treetop +35 -0
- data/lib/hemingway/text/text_nodes.rb +7 -0
- data/lib/hemingway/version.rb +3 -0
- data/lib/hemingway.rb +7 -0
- data/script/build +22 -0
- data/script/test +2 -0
- data/spec/build_spec.rb +65 -0
- data/spec/nodes/block/list_spec.rb +91 -0
- data/spec/nodes/block/quote_spec.rb +31 -0
- data/spec/nodes/block/verbatim_spec.rb +27 -0
- data/spec/nodes/block_spec.rb +21 -0
- data/spec/nodes/footnote_spec.rb +42 -0
- data/spec/nodes/math_spec.rb +31 -0
- data/spec/nodes/special_spec.rb +27 -0
- data/spec/nodes/tag_spec.rb +98 -0
- data/spec/parser_spec.rb +48 -0
- data/spec/spec_helper.rb +5 -0
- metadata +110 -18
@@ -0,0 +1,164 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
require "hemingway/special/special_nodes"
|
5
|
+
|
6
|
+
module Hemingway
|
7
|
+
module Special
|
8
|
+
include Treetop::Runtime
|
9
|
+
|
10
|
+
def root
|
11
|
+
@root ||= :special
|
12
|
+
end
|
13
|
+
|
14
|
+
module Special0
|
15
|
+
def escape
|
16
|
+
elements[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def character
|
20
|
+
elements[1]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def _nt_special
|
25
|
+
start_index = index
|
26
|
+
if node_cache[:special].has_key?(index)
|
27
|
+
cached = node_cache[:special][index]
|
28
|
+
if cached
|
29
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
30
|
+
@index = cached.interval.end
|
31
|
+
end
|
32
|
+
return cached
|
33
|
+
end
|
34
|
+
|
35
|
+
i0, s0 = index, []
|
36
|
+
r1 = _nt_escape
|
37
|
+
s0 << r1
|
38
|
+
if r1
|
39
|
+
i2 = index
|
40
|
+
if has_terminal?("#", false, index)
|
41
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
42
|
+
@index += 1
|
43
|
+
else
|
44
|
+
terminal_parse_failure("#")
|
45
|
+
r3 = nil
|
46
|
+
end
|
47
|
+
if r3
|
48
|
+
r2 = r3
|
49
|
+
else
|
50
|
+
if has_terminal?("$", false, index)
|
51
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
52
|
+
@index += 1
|
53
|
+
else
|
54
|
+
terminal_parse_failure("$")
|
55
|
+
r4 = nil
|
56
|
+
end
|
57
|
+
if r4
|
58
|
+
r2 = r4
|
59
|
+
else
|
60
|
+
if has_terminal?("%", false, index)
|
61
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
62
|
+
@index += 1
|
63
|
+
else
|
64
|
+
terminal_parse_failure("%")
|
65
|
+
r5 = nil
|
66
|
+
end
|
67
|
+
if r5
|
68
|
+
r2 = r5
|
69
|
+
else
|
70
|
+
if has_terminal?("&", false, index)
|
71
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
72
|
+
@index += 1
|
73
|
+
else
|
74
|
+
terminal_parse_failure("&")
|
75
|
+
r6 = nil
|
76
|
+
end
|
77
|
+
if r6
|
78
|
+
r2 = r6
|
79
|
+
else
|
80
|
+
if has_terminal?("_", false, index)
|
81
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
82
|
+
@index += 1
|
83
|
+
else
|
84
|
+
terminal_parse_failure("_")
|
85
|
+
r7 = nil
|
86
|
+
end
|
87
|
+
if r7
|
88
|
+
r2 = r7
|
89
|
+
else
|
90
|
+
if has_terminal?("{", false, index)
|
91
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
92
|
+
@index += 1
|
93
|
+
else
|
94
|
+
terminal_parse_failure("{")
|
95
|
+
r8 = nil
|
96
|
+
end
|
97
|
+
if r8
|
98
|
+
r2 = r8
|
99
|
+
else
|
100
|
+
if has_terminal?("}", false, index)
|
101
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
102
|
+
@index += 1
|
103
|
+
else
|
104
|
+
terminal_parse_failure("}")
|
105
|
+
r9 = nil
|
106
|
+
end
|
107
|
+
if r9
|
108
|
+
r2 = r9
|
109
|
+
else
|
110
|
+
@index = i2
|
111
|
+
r2 = nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
s0 << r2
|
120
|
+
end
|
121
|
+
if s0.last
|
122
|
+
r0 = instantiate_node(SpecialNode,input, i0...index, s0)
|
123
|
+
r0.extend(Special0)
|
124
|
+
else
|
125
|
+
@index = i0
|
126
|
+
r0 = nil
|
127
|
+
end
|
128
|
+
|
129
|
+
node_cache[:special][start_index] = r0
|
130
|
+
|
131
|
+
r0
|
132
|
+
end
|
133
|
+
|
134
|
+
def _nt_escape
|
135
|
+
start_index = index
|
136
|
+
if node_cache[:escape].has_key?(index)
|
137
|
+
cached = node_cache[:escape][index]
|
138
|
+
if cached
|
139
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
140
|
+
@index = cached.interval.end
|
141
|
+
end
|
142
|
+
return cached
|
143
|
+
end
|
144
|
+
|
145
|
+
if has_terminal?("\\", false, index)
|
146
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
147
|
+
@index += 1
|
148
|
+
else
|
149
|
+
terminal_parse_failure("\\")
|
150
|
+
r0 = nil
|
151
|
+
end
|
152
|
+
|
153
|
+
node_cache[:escape][start_index] = r0
|
154
|
+
|
155
|
+
r0
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
class SpecialParser < Treetop::Runtime::CompiledParser
|
161
|
+
include Special
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "hemingway/special/special_nodes"
|
2
|
+
|
3
|
+
module Hemingway
|
4
|
+
grammar Special
|
5
|
+
|
6
|
+
# Special characters that need to be escaped in Latex.
|
7
|
+
# Example: War \& Peace
|
8
|
+
rule special
|
9
|
+
escape character:( "#" / "$" / "%" / "&" / "_" / "{" / "}" ) <SpecialNode>
|
10
|
+
end
|
11
|
+
|
12
|
+
rule escape
|
13
|
+
"\\"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,460 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
require "hemingway/symbol/symbol_nodes"
|
5
|
+
|
6
|
+
module Hemingway
|
7
|
+
module Symbol
|
8
|
+
include Treetop::Runtime
|
9
|
+
|
10
|
+
def root
|
11
|
+
@root ||= :math_symbol
|
12
|
+
end
|
13
|
+
|
14
|
+
def _nt_math_symbol
|
15
|
+
start_index = index
|
16
|
+
if node_cache[:math_symbol].has_key?(index)
|
17
|
+
cached = node_cache[:math_symbol][index]
|
18
|
+
if cached
|
19
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
20
|
+
@index = cached.interval.end
|
21
|
+
end
|
22
|
+
return cached
|
23
|
+
end
|
24
|
+
|
25
|
+
i0 = index
|
26
|
+
if has_terminal?("\\Gamma", false, index)
|
27
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
28
|
+
@index += 6
|
29
|
+
else
|
30
|
+
terminal_parse_failure("\\Gamma")
|
31
|
+
r1 = nil
|
32
|
+
end
|
33
|
+
if r1
|
34
|
+
r0 = r1
|
35
|
+
r0.extend(SymbolNode)
|
36
|
+
else
|
37
|
+
if has_terminal?("\\Delta", false, index)
|
38
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
39
|
+
@index += 6
|
40
|
+
else
|
41
|
+
terminal_parse_failure("\\Delta")
|
42
|
+
r2 = nil
|
43
|
+
end
|
44
|
+
if r2
|
45
|
+
r0 = r2
|
46
|
+
r0.extend(SymbolNode)
|
47
|
+
else
|
48
|
+
if has_terminal?("\\Theta", false, index)
|
49
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
50
|
+
@index += 6
|
51
|
+
else
|
52
|
+
terminal_parse_failure("\\Theta")
|
53
|
+
r3 = nil
|
54
|
+
end
|
55
|
+
if r3
|
56
|
+
r0 = r3
|
57
|
+
r0.extend(SymbolNode)
|
58
|
+
else
|
59
|
+
if has_terminal?("\\Lambda", false, index)
|
60
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
61
|
+
@index += 7
|
62
|
+
else
|
63
|
+
terminal_parse_failure("\\Lambda")
|
64
|
+
r4 = nil
|
65
|
+
end
|
66
|
+
if r4
|
67
|
+
r0 = r4
|
68
|
+
r0.extend(SymbolNode)
|
69
|
+
else
|
70
|
+
if has_terminal?("\\Xi", false, index)
|
71
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
72
|
+
@index += 3
|
73
|
+
else
|
74
|
+
terminal_parse_failure("\\Xi")
|
75
|
+
r5 = nil
|
76
|
+
end
|
77
|
+
if r5
|
78
|
+
r0 = r5
|
79
|
+
r0.extend(SymbolNode)
|
80
|
+
else
|
81
|
+
if has_terminal?("\\Pi", false, index)
|
82
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
83
|
+
@index += 3
|
84
|
+
else
|
85
|
+
terminal_parse_failure("\\Pi")
|
86
|
+
r6 = nil
|
87
|
+
end
|
88
|
+
if r6
|
89
|
+
r0 = r6
|
90
|
+
r0.extend(SymbolNode)
|
91
|
+
else
|
92
|
+
if has_terminal?("\\Sigma", false, index)
|
93
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
94
|
+
@index += 6
|
95
|
+
else
|
96
|
+
terminal_parse_failure("\\Sigma")
|
97
|
+
r7 = nil
|
98
|
+
end
|
99
|
+
if r7
|
100
|
+
r0 = r7
|
101
|
+
r0.extend(SymbolNode)
|
102
|
+
else
|
103
|
+
if has_terminal?("\\Upsilon", false, index)
|
104
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
105
|
+
@index += 8
|
106
|
+
else
|
107
|
+
terminal_parse_failure("\\Upsilon")
|
108
|
+
r8 = nil
|
109
|
+
end
|
110
|
+
if r8
|
111
|
+
r0 = r8
|
112
|
+
r0.extend(SymbolNode)
|
113
|
+
else
|
114
|
+
if has_terminal?("\\Phi", false, index)
|
115
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
116
|
+
@index += 4
|
117
|
+
else
|
118
|
+
terminal_parse_failure("\\Phi")
|
119
|
+
r9 = nil
|
120
|
+
end
|
121
|
+
if r9
|
122
|
+
r0 = r9
|
123
|
+
r0.extend(SymbolNode)
|
124
|
+
else
|
125
|
+
if has_terminal?("\\Psi", false, index)
|
126
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
127
|
+
@index += 4
|
128
|
+
else
|
129
|
+
terminal_parse_failure("\\Psi")
|
130
|
+
r10 = nil
|
131
|
+
end
|
132
|
+
if r10
|
133
|
+
r0 = r10
|
134
|
+
r0.extend(SymbolNode)
|
135
|
+
else
|
136
|
+
if has_terminal?("\\Omega", false, index)
|
137
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
138
|
+
@index += 6
|
139
|
+
else
|
140
|
+
terminal_parse_failure("\\Omega")
|
141
|
+
r11 = nil
|
142
|
+
end
|
143
|
+
if r11
|
144
|
+
r0 = r11
|
145
|
+
r0.extend(SymbolNode)
|
146
|
+
else
|
147
|
+
if has_terminal?("\\alpha", false, index)
|
148
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
149
|
+
@index += 6
|
150
|
+
else
|
151
|
+
terminal_parse_failure("\\alpha")
|
152
|
+
r12 = nil
|
153
|
+
end
|
154
|
+
if r12
|
155
|
+
r0 = r12
|
156
|
+
r0.extend(SymbolNode)
|
157
|
+
else
|
158
|
+
if has_terminal?("\\beta", false, index)
|
159
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
160
|
+
@index += 5
|
161
|
+
else
|
162
|
+
terminal_parse_failure("\\beta")
|
163
|
+
r13 = nil
|
164
|
+
end
|
165
|
+
if r13
|
166
|
+
r0 = r13
|
167
|
+
r0.extend(SymbolNode)
|
168
|
+
else
|
169
|
+
if has_terminal?("\\gamma", false, index)
|
170
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
171
|
+
@index += 6
|
172
|
+
else
|
173
|
+
terminal_parse_failure("\\gamma")
|
174
|
+
r14 = nil
|
175
|
+
end
|
176
|
+
if r14
|
177
|
+
r0 = r14
|
178
|
+
r0.extend(SymbolNode)
|
179
|
+
else
|
180
|
+
if has_terminal?("\\delta", false, index)
|
181
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
182
|
+
@index += 6
|
183
|
+
else
|
184
|
+
terminal_parse_failure("\\delta")
|
185
|
+
r15 = nil
|
186
|
+
end
|
187
|
+
if r15
|
188
|
+
r0 = r15
|
189
|
+
r0.extend(SymbolNode)
|
190
|
+
else
|
191
|
+
if has_terminal?("\\epsilon", false, index)
|
192
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
193
|
+
@index += 8
|
194
|
+
else
|
195
|
+
terminal_parse_failure("\\epsilon")
|
196
|
+
r16 = nil
|
197
|
+
end
|
198
|
+
if r16
|
199
|
+
r0 = r16
|
200
|
+
r0.extend(SymbolNode)
|
201
|
+
else
|
202
|
+
if has_terminal?("\\zeta", false, index)
|
203
|
+
r17 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
204
|
+
@index += 5
|
205
|
+
else
|
206
|
+
terminal_parse_failure("\\zeta")
|
207
|
+
r17 = nil
|
208
|
+
end
|
209
|
+
if r17
|
210
|
+
r0 = r17
|
211
|
+
r0.extend(SymbolNode)
|
212
|
+
else
|
213
|
+
if has_terminal?("\\eta", false, index)
|
214
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
215
|
+
@index += 4
|
216
|
+
else
|
217
|
+
terminal_parse_failure("\\eta")
|
218
|
+
r18 = nil
|
219
|
+
end
|
220
|
+
if r18
|
221
|
+
r0 = r18
|
222
|
+
r0.extend(SymbolNode)
|
223
|
+
else
|
224
|
+
if has_terminal?("\\theta", false, index)
|
225
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
226
|
+
@index += 6
|
227
|
+
else
|
228
|
+
terminal_parse_failure("\\theta")
|
229
|
+
r19 = nil
|
230
|
+
end
|
231
|
+
if r19
|
232
|
+
r0 = r19
|
233
|
+
r0.extend(SymbolNode)
|
234
|
+
else
|
235
|
+
if has_terminal?("\\iota", false, index)
|
236
|
+
r20 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
237
|
+
@index += 5
|
238
|
+
else
|
239
|
+
terminal_parse_failure("\\iota")
|
240
|
+
r20 = nil
|
241
|
+
end
|
242
|
+
if r20
|
243
|
+
r0 = r20
|
244
|
+
r0.extend(SymbolNode)
|
245
|
+
else
|
246
|
+
if has_terminal?("\\kappa", false, index)
|
247
|
+
r21 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
248
|
+
@index += 6
|
249
|
+
else
|
250
|
+
terminal_parse_failure("\\kappa")
|
251
|
+
r21 = nil
|
252
|
+
end
|
253
|
+
if r21
|
254
|
+
r0 = r21
|
255
|
+
r0.extend(SymbolNode)
|
256
|
+
else
|
257
|
+
if has_terminal?("\\lambda", false, index)
|
258
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
259
|
+
@index += 7
|
260
|
+
else
|
261
|
+
terminal_parse_failure("\\lambda")
|
262
|
+
r22 = nil
|
263
|
+
end
|
264
|
+
if r22
|
265
|
+
r0 = r22
|
266
|
+
r0.extend(SymbolNode)
|
267
|
+
else
|
268
|
+
if has_terminal?("\\mu", false, index)
|
269
|
+
r23 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
270
|
+
@index += 3
|
271
|
+
else
|
272
|
+
terminal_parse_failure("\\mu")
|
273
|
+
r23 = nil
|
274
|
+
end
|
275
|
+
if r23
|
276
|
+
r0 = r23
|
277
|
+
r0.extend(SymbolNode)
|
278
|
+
else
|
279
|
+
if has_terminal?("\\nu", false, index)
|
280
|
+
r24 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
281
|
+
@index += 3
|
282
|
+
else
|
283
|
+
terminal_parse_failure("\\nu")
|
284
|
+
r24 = nil
|
285
|
+
end
|
286
|
+
if r24
|
287
|
+
r0 = r24
|
288
|
+
r0.extend(SymbolNode)
|
289
|
+
else
|
290
|
+
if has_terminal?("\\xi", false, index)
|
291
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
292
|
+
@index += 3
|
293
|
+
else
|
294
|
+
terminal_parse_failure("\\xi")
|
295
|
+
r25 = nil
|
296
|
+
end
|
297
|
+
if r25
|
298
|
+
r0 = r25
|
299
|
+
r0.extend(SymbolNode)
|
300
|
+
else
|
301
|
+
if has_terminal?("\\pi", false, index)
|
302
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
303
|
+
@index += 3
|
304
|
+
else
|
305
|
+
terminal_parse_failure("\\pi")
|
306
|
+
r26 = nil
|
307
|
+
end
|
308
|
+
if r26
|
309
|
+
r0 = r26
|
310
|
+
r0.extend(SymbolNode)
|
311
|
+
else
|
312
|
+
if has_terminal?("\\rho", false, index)
|
313
|
+
r27 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
314
|
+
@index += 4
|
315
|
+
else
|
316
|
+
terminal_parse_failure("\\rho")
|
317
|
+
r27 = nil
|
318
|
+
end
|
319
|
+
if r27
|
320
|
+
r0 = r27
|
321
|
+
r0.extend(SymbolNode)
|
322
|
+
else
|
323
|
+
if has_terminal?("\\varsigma", false, index)
|
324
|
+
r28 = instantiate_node(SyntaxNode,input, index...(index + 9))
|
325
|
+
@index += 9
|
326
|
+
else
|
327
|
+
terminal_parse_failure("\\varsigma")
|
328
|
+
r28 = nil
|
329
|
+
end
|
330
|
+
if r28
|
331
|
+
r0 = r28
|
332
|
+
r0.extend(SymbolNode)
|
333
|
+
else
|
334
|
+
if has_terminal?("\\sigma", false, index)
|
335
|
+
r29 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
336
|
+
@index += 6
|
337
|
+
else
|
338
|
+
terminal_parse_failure("\\sigma")
|
339
|
+
r29 = nil
|
340
|
+
end
|
341
|
+
if r29
|
342
|
+
r0 = r29
|
343
|
+
r0.extend(SymbolNode)
|
344
|
+
else
|
345
|
+
if has_terminal?("\\tau", false, index)
|
346
|
+
r30 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
347
|
+
@index += 4
|
348
|
+
else
|
349
|
+
terminal_parse_failure("\\tau")
|
350
|
+
r30 = nil
|
351
|
+
end
|
352
|
+
if r30
|
353
|
+
r0 = r30
|
354
|
+
r0.extend(SymbolNode)
|
355
|
+
else
|
356
|
+
if has_terminal?("\\upsilon", false, index)
|
357
|
+
r31 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
358
|
+
@index += 8
|
359
|
+
else
|
360
|
+
terminal_parse_failure("\\upsilon")
|
361
|
+
r31 = nil
|
362
|
+
end
|
363
|
+
if r31
|
364
|
+
r0 = r31
|
365
|
+
r0.extend(SymbolNode)
|
366
|
+
else
|
367
|
+
if has_terminal?("\\phi", false, index)
|
368
|
+
r32 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
369
|
+
@index += 4
|
370
|
+
else
|
371
|
+
terminal_parse_failure("\\phi")
|
372
|
+
r32 = nil
|
373
|
+
end
|
374
|
+
if r32
|
375
|
+
r0 = r32
|
376
|
+
r0.extend(SymbolNode)
|
377
|
+
else
|
378
|
+
if has_terminal?("\\chi", false, index)
|
379
|
+
r33 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
380
|
+
@index += 4
|
381
|
+
else
|
382
|
+
terminal_parse_failure("\\chi")
|
383
|
+
r33 = nil
|
384
|
+
end
|
385
|
+
if r33
|
386
|
+
r0 = r33
|
387
|
+
r0.extend(SymbolNode)
|
388
|
+
else
|
389
|
+
if has_terminal?("\\psi", false, index)
|
390
|
+
r34 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
391
|
+
@index += 4
|
392
|
+
else
|
393
|
+
terminal_parse_failure("\\psi")
|
394
|
+
r34 = nil
|
395
|
+
end
|
396
|
+
if r34
|
397
|
+
r0 = r34
|
398
|
+
r0.extend(SymbolNode)
|
399
|
+
else
|
400
|
+
if has_terminal?("\\omega", false, index)
|
401
|
+
r35 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
402
|
+
@index += 6
|
403
|
+
else
|
404
|
+
terminal_parse_failure("\\omega")
|
405
|
+
r35 = nil
|
406
|
+
end
|
407
|
+
if r35
|
408
|
+
r0 = r35
|
409
|
+
r0.extend(SymbolNode)
|
410
|
+
else
|
411
|
+
@index = i0
|
412
|
+
r0 = nil
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
node_cache[:math_symbol][start_index] = r0
|
450
|
+
|
451
|
+
r0
|
452
|
+
end
|
453
|
+
|
454
|
+
end
|
455
|
+
|
456
|
+
class SymbolParser < Treetop::Runtime::CompiledParser
|
457
|
+
include Symbol
|
458
|
+
end
|
459
|
+
|
460
|
+
end
|