dracoon 1.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/README.md +2 -0
- data/bin/dracoon +6 -0
- data/dracoon.gemspec +29 -0
- data/lib/dracoon.rb +56 -0
- data/lib/dracoon_core.rb +2611 -0
- data/lib/dracoon_nodes.rb +228 -0
- data/lib/dracoon_sqlite.rb +222 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bab3be8d2e16ab0681289c65b01ec3f472bfc258
|
4
|
+
data.tar.gz: e8b606365c04ff98ca5e1b624877731dac0db8dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0562f4391851a0545be16dad6bc0af45a49ed648fffdbde5fd88f8cfd97624f30e974b48deb82b4eac39865cdfe9743bcddf7d85f2d63d3f543ce695436dac80
|
7
|
+
data.tar.gz: e9eda9949951d0f5255f9194e7696c073c7fc01ecd8ead0b6b2b4d0db5515968e1e0a76d5039278dcb836fbed111a395bc64736312aa8d8429a447dcc8bc7de0
|
data/LICENSE
ADDED
@@ -0,0 +1,339 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
Version 2, June 1991
|
3
|
+
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
7
|
+
of this license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
Preamble
|
10
|
+
|
11
|
+
The licenses for most software are designed to take away your
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
14
|
+
software--to make sure the software is free for all its users. This
|
15
|
+
General Public License applies to most of the Free Software
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
19
|
+
your programs, too.
|
20
|
+
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
24
|
+
this service if you wish), that you receive source code or can get it
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
26
|
+
in new free programs; and that you know you can do these things.
|
27
|
+
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
31
|
+
distribute copies of the software, or if you modify it.
|
32
|
+
|
33
|
+
For example, if you distribute copies of such a program, whether
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
36
|
+
source code. And you must show them these terms so they know their
|
37
|
+
rights.
|
38
|
+
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
41
|
+
distribute and/or modify the software.
|
42
|
+
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
44
|
+
that everyone understands that there is no warranty for this free
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
46
|
+
want its recipients to know that what they have is not the original, so
|
47
|
+
that any problems introduced by others will not reflect on the original
|
48
|
+
authors' reputations.
|
49
|
+
|
50
|
+
Finally, any free program is threatened constantly by software
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
55
|
+
|
56
|
+
The precise terms and conditions for copying, distribution and
|
57
|
+
modification follow.
|
58
|
+
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61
|
+
|
62
|
+
0. This License applies to any program or other work which contains
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
66
|
+
means either the Program or any derivative work under copyright law:
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
68
|
+
either verbatim or with modifications and/or translated into another
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
71
|
+
|
72
|
+
Activities other than copying, distribution and modification are not
|
73
|
+
covered by this License; they are outside its scope. The act of
|
74
|
+
running the Program is not restricted, and the output from the Program
|
75
|
+
is covered only if its contents constitute a work based on the
|
76
|
+
Program (independent of having been made by running the Program).
|
77
|
+
Whether that is true depends on what the Program does.
|
78
|
+
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
80
|
+
source code as you receive it, in any medium, provided that you
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
84
|
+
and give any other recipients of the Program a copy of this License
|
85
|
+
along with the Program.
|
86
|
+
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
89
|
+
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
93
|
+
above, provided that you also meet all of these conditions:
|
94
|
+
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
96
|
+
stating that you changed the files and the date of any change.
|
97
|
+
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
99
|
+
whole or in part contains or is derived from the Program or any
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
101
|
+
parties under the terms of this License.
|
102
|
+
|
103
|
+
c) If the modified program normally reads commands interactively
|
104
|
+
when run, you must cause it, when started running for such
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
106
|
+
announcement including an appropriate copyright notice and a
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
108
|
+
a warranty) and that users may redistribute the program under
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
111
|
+
does not normally print such an announcement, your work based on
|
112
|
+
the Program is not required to print an announcement.)
|
113
|
+
|
114
|
+
These requirements apply to the modified work as a whole. If
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
116
|
+
and can be reasonably considered independent and separate works in
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
118
|
+
sections when you distribute them as separate works. But when you
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
121
|
+
this License, whose permissions for other licensees extend to the
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123
|
+
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
126
|
+
exercise the right to control the distribution of derivative or
|
127
|
+
collective works based on the Program.
|
128
|
+
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
131
|
+
a storage or distribution medium does not bring the other work under
|
132
|
+
the scope of this License.
|
133
|
+
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
137
|
+
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
139
|
+
source code, which must be distributed under the terms of Sections
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141
|
+
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
143
|
+
years, to give any third party, for a charge no more than your
|
144
|
+
cost of physically performing source distribution, a complete
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147
|
+
customarily used for software interchange; or,
|
148
|
+
|
149
|
+
c) Accompany it with the information you received as to the offer
|
150
|
+
to distribute corresponding source code. (This alternative is
|
151
|
+
allowed only for noncommercial distribution and only if you
|
152
|
+
received the program in object code or executable form with such
|
153
|
+
an offer, in accord with Subsection b above.)
|
154
|
+
|
155
|
+
The source code for a work means the preferred form of the work for
|
156
|
+
making modifications to it. For an executable work, complete source
|
157
|
+
code means all the source code for all modules it contains, plus any
|
158
|
+
associated interface definition files, plus the scripts used to
|
159
|
+
control compilation and installation of the executable. However, as a
|
160
|
+
special exception, the source code distributed need not include
|
161
|
+
anything that is normally distributed (in either source or binary
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
163
|
+
operating system on which the executable runs, unless that component
|
164
|
+
itself accompanies the executable.
|
165
|
+
|
166
|
+
If distribution of executable or object code is made by offering
|
167
|
+
access to copy from a designated place, then offering equivalent
|
168
|
+
access to copy the source code from the same place counts as
|
169
|
+
distribution of the source code, even though third parties are not
|
170
|
+
compelled to copy the source along with the object code.
|
171
|
+
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173
|
+
except as expressly provided under this License. Any attempt
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175
|
+
void, and will automatically terminate your rights under this License.
|
176
|
+
However, parties who have received copies, or rights, from you under
|
177
|
+
this License will not have their licenses terminated so long as such
|
178
|
+
parties remain in full compliance.
|
179
|
+
|
180
|
+
5. You are not required to accept this License, since you have not
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
182
|
+
distribute the Program or its derivative works. These actions are
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
184
|
+
modifying or distributing the Program (or any work based on the
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
187
|
+
the Program or works based on it.
|
188
|
+
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
190
|
+
Program), the recipient automatically receives a license from the
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
192
|
+
these terms and conditions. You may not impose any further
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
195
|
+
this License.
|
196
|
+
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
207
|
+
the only way you could satisfy both it and this License would be to
|
208
|
+
refrain entirely from distribution of the Program.
|
209
|
+
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
212
|
+
apply and the section as a whole is intended to apply in other
|
213
|
+
circumstances.
|
214
|
+
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
216
|
+
patents or other property right claims or to contest validity of any
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
218
|
+
integrity of the free software distribution system, which is
|
219
|
+
implemented by public license practices. Many people have made
|
220
|
+
generous contributions to the wide range of software distributed
|
221
|
+
through that system in reliance on consistent application of that
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
223
|
+
to distribute software through any other system and a licensee cannot
|
224
|
+
impose that choice.
|
225
|
+
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
227
|
+
be a consequence of the rest of this License.
|
228
|
+
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
231
|
+
original copyright holder who places the Program under this License
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
233
|
+
those countries, so that distribution is permitted only in or among
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
235
|
+
the limitation as if written in the body of this License.
|
236
|
+
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
238
|
+
of the General Public License from time to time. Such new versions will
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
240
|
+
address new problems or concerns.
|
241
|
+
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
243
|
+
specifies a version number of this License which applies to it and "any
|
244
|
+
later version", you have the option of following the terms and conditions
|
245
|
+
either of that version or of any later version published by the Free
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
248
|
+
Foundation.
|
249
|
+
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
251
|
+
programs whose distribution conditions are different, write to the author
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
256
|
+
of promoting the sharing and reuse of software generally.
|
257
|
+
|
258
|
+
NO WARRANTY
|
259
|
+
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268
|
+
REPAIR OR CORRECTION.
|
269
|
+
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
279
|
+
|
280
|
+
END OF TERMS AND CONDITIONS
|
281
|
+
|
282
|
+
How to Apply These Terms to Your New Programs
|
283
|
+
|
284
|
+
If you develop a new program, and you want it to be of the greatest
|
285
|
+
possible use to the public, the best way to achieve this is to make it
|
286
|
+
free software which everyone can redistribute and change under these terms.
|
287
|
+
|
288
|
+
To do so, attach the following notices to the program. It is safest
|
289
|
+
to attach them to the start of each source file to most effectively
|
290
|
+
convey the exclusion of warranty; and each file should have at least
|
291
|
+
the "copyright" line and a pointer to where the full notice is found.
|
292
|
+
|
293
|
+
{description}
|
294
|
+
Copyright (C) {year} {fullname}
|
295
|
+
|
296
|
+
This program is free software; you can redistribute it and/or modify
|
297
|
+
it under the terms of the GNU General Public License as published by
|
298
|
+
the Free Software Foundation; either version 2 of the License, or
|
299
|
+
(at your option) any later version.
|
300
|
+
|
301
|
+
This program is distributed in the hope that it will be useful,
|
302
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304
|
+
GNU General Public License for more details.
|
305
|
+
|
306
|
+
You should have received a copy of the GNU General Public License along
|
307
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309
|
+
|
310
|
+
Also add information on how to contact you by electronic and paper mail.
|
311
|
+
|
312
|
+
If the program is interactive, make it output a short notice like this
|
313
|
+
when it starts in an interactive mode:
|
314
|
+
|
315
|
+
Gnomovision version 69, Copyright (C) year name of author
|
316
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317
|
+
This is free software, and you are welcome to redistribute it
|
318
|
+
under certain conditions; type `show c' for details.
|
319
|
+
|
320
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321
|
+
parts of the General Public License. Of course, the commands you use may
|
322
|
+
be called something other than `show w' and `show c'; they could even be
|
323
|
+
mouse-clicks or menu items--whatever suits your program.
|
324
|
+
|
325
|
+
You should also get your employer (if you work as a programmer) or your
|
326
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327
|
+
necessary. Here is a sample; alter the names:
|
328
|
+
|
329
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331
|
+
|
332
|
+
{signature of Ty Coon}, 1 April 1989
|
333
|
+
Ty Coon, President of Vice
|
334
|
+
|
335
|
+
This General Public License does not permit incorporating your program into
|
336
|
+
proprietary programs. If your program is a subroutine library, you may
|
337
|
+
consider it more useful to permit linking proprietary applications with the
|
338
|
+
library. If this is what you want to do, use the GNU Lesser General
|
339
|
+
Public License instead of this License.
|
data/README.md
ADDED
data/bin/dracoon
ADDED
data/dracoon.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "dracoon"
|
3
|
+
s.version = "1.0.0.beta2"
|
4
|
+
s.date = "2014-03-30"
|
5
|
+
s.summary = "Dracoon, the amaizing tool to compile interactive fiction books."
|
6
|
+
s.description = "Dracoon is a language and compiler to write interactive fiction books."
|
7
|
+
s.authors = ["Pedro L. Morales"]
|
8
|
+
s.email = "piterlouis@gmail.com"
|
9
|
+
s.extra_rdoc_files = [
|
10
|
+
"LICENSE",
|
11
|
+
"README.md"
|
12
|
+
]
|
13
|
+
s.files = [
|
14
|
+
"LICENSE",
|
15
|
+
"README.md",
|
16
|
+
"bin/dracoon",
|
17
|
+
"lib/dracoon.rb",
|
18
|
+
"lib/dracoon_core.rb",
|
19
|
+
"lib/dracoon_nodes.rb",
|
20
|
+
"lib/dracoon_sqlite.rb",
|
21
|
+
"dracoon.gemspec"
|
22
|
+
]
|
23
|
+
s.homepage = "https://github.com/piterlouis/dracoon"
|
24
|
+
s.license = "GPL-2"
|
25
|
+
s.executables = ["dracoon"]
|
26
|
+
s.add_runtime_dependency "treetop", ["~> 1.5"]
|
27
|
+
s.add_runtime_dependency "uglifier", ["~> 2.5"]
|
28
|
+
s.add_runtime_dependency "sqlite3", ["~> 1.3"]
|
29
|
+
end
|
data/lib/dracoon.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
module Dracoon
|
3
|
+
|
4
|
+
require 'treetop'
|
5
|
+
|
6
|
+
load 'dracoon_core.rb'
|
7
|
+
load 'dracoon_nodes.rb'
|
8
|
+
load 'dracoon_sqlite.rb'
|
9
|
+
|
10
|
+
class DracoonParser
|
11
|
+
@parser
|
12
|
+
@writer
|
13
|
+
|
14
|
+
public
|
15
|
+
def initialize
|
16
|
+
#Treetop.load 'dracoon'
|
17
|
+
@parser = DracoonGrammarParser.new
|
18
|
+
@writer = Dracoon::SQLiteWriter.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def processFile(path)
|
22
|
+
# file = File.open 'test2.gb'
|
23
|
+
# data = file.read
|
24
|
+
file = File.open path
|
25
|
+
data = file.read
|
26
|
+
|
27
|
+
# puts data
|
28
|
+
ast = @parser.parse data
|
29
|
+
if ast then
|
30
|
+
ast.cutdown
|
31
|
+
#puts '==> RESULTS:'
|
32
|
+
# puts ast.inspect
|
33
|
+
puts '==> Writing gamebook file...'
|
34
|
+
@writer.writeAST(ast, nil)
|
35
|
+
else
|
36
|
+
@parser.failure_reason =~ /^(Expected .+) after/m
|
37
|
+
puts "#{$1.gsub("\n", '$NEWLINE')}:"
|
38
|
+
puts data.lines.to_a[@parser.failure_line - 1]
|
39
|
+
puts "#{'~' * (@parser.failure_column - 1)}^"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def processDirectory(path)
|
44
|
+
Dir.foreach(path) do |f|
|
45
|
+
next if f == '.' or f == '..' or File.extname(f) != '.gbook'
|
46
|
+
if File::directory? f
|
47
|
+
processDirectory(path + '/' + f)
|
48
|
+
elsif File::file? f
|
49
|
+
puts "Processing file #{f}"
|
50
|
+
processFile f
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/dracoon_core.rb
ADDED
@@ -0,0 +1,2611 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
module DracoonGrammar
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :module
|
10
|
+
end
|
11
|
+
|
12
|
+
module Module0
|
13
|
+
def header
|
14
|
+
elements[2]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def _nt_module
|
20
|
+
start_index = index
|
21
|
+
if node_cache[:module].has_key?(index)
|
22
|
+
cached = node_cache[:module][index]
|
23
|
+
if cached
|
24
|
+
node_cache[:module][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
25
|
+
@index = cached.interval.end
|
26
|
+
end
|
27
|
+
return cached
|
28
|
+
end
|
29
|
+
|
30
|
+
s0, i0 = [], index
|
31
|
+
loop do
|
32
|
+
i1, s1 = index, []
|
33
|
+
if (match_len = has_terminal?('#module', false, index))
|
34
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
35
|
+
@index += match_len
|
36
|
+
else
|
37
|
+
terminal_parse_failure('#module')
|
38
|
+
r2 = nil
|
39
|
+
end
|
40
|
+
s1 << r2
|
41
|
+
if r2
|
42
|
+
s3, i3 = [], index
|
43
|
+
loop do
|
44
|
+
r4 = _nt_ws
|
45
|
+
if r4
|
46
|
+
s3 << r4
|
47
|
+
else
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
if s3.empty?
|
52
|
+
@index = i3
|
53
|
+
r3 = nil
|
54
|
+
else
|
55
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
56
|
+
end
|
57
|
+
s1 << r3
|
58
|
+
if r3
|
59
|
+
r5 = _nt_header
|
60
|
+
s1 << r5
|
61
|
+
if r5
|
62
|
+
s6, i6 = [], index
|
63
|
+
loop do
|
64
|
+
i7 = index
|
65
|
+
r8 = _nt_scene
|
66
|
+
if r8
|
67
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
68
|
+
r7 = r8
|
69
|
+
else
|
70
|
+
r9 = _nt_item
|
71
|
+
if r9
|
72
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
73
|
+
r7 = r9
|
74
|
+
else
|
75
|
+
@index = i7
|
76
|
+
r7 = nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if r7
|
80
|
+
s6 << r7
|
81
|
+
else
|
82
|
+
break
|
83
|
+
end
|
84
|
+
end
|
85
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
86
|
+
s1 << r6
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
if s1.last
|
91
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
92
|
+
r1.extend(Module0)
|
93
|
+
else
|
94
|
+
@index = i1
|
95
|
+
r1 = nil
|
96
|
+
end
|
97
|
+
if r1
|
98
|
+
s0 << r1
|
99
|
+
else
|
100
|
+
break
|
101
|
+
end
|
102
|
+
end
|
103
|
+
r0 = instantiate_node(ModuleNode,input, i0...index, s0)
|
104
|
+
|
105
|
+
node_cache[:module][start_index] = r0
|
106
|
+
|
107
|
+
r0
|
108
|
+
end
|
109
|
+
|
110
|
+
module Scene0
|
111
|
+
def header
|
112
|
+
elements[2]
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
def _nt_scene
|
118
|
+
start_index = index
|
119
|
+
if node_cache[:scene].has_key?(index)
|
120
|
+
cached = node_cache[:scene][index]
|
121
|
+
if cached
|
122
|
+
node_cache[:scene][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
123
|
+
@index = cached.interval.end
|
124
|
+
end
|
125
|
+
return cached
|
126
|
+
end
|
127
|
+
|
128
|
+
i0, s0 = index, []
|
129
|
+
if (match_len = has_terminal?('#scene', false, index))
|
130
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
131
|
+
@index += match_len
|
132
|
+
else
|
133
|
+
terminal_parse_failure('#scene')
|
134
|
+
r1 = nil
|
135
|
+
end
|
136
|
+
s0 << r1
|
137
|
+
if r1
|
138
|
+
s2, i2 = [], index
|
139
|
+
loop do
|
140
|
+
r3 = _nt_ws
|
141
|
+
if r3
|
142
|
+
s2 << r3
|
143
|
+
else
|
144
|
+
break
|
145
|
+
end
|
146
|
+
end
|
147
|
+
if s2.empty?
|
148
|
+
@index = i2
|
149
|
+
r2 = nil
|
150
|
+
else
|
151
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
152
|
+
end
|
153
|
+
s0 << r2
|
154
|
+
if r2
|
155
|
+
r4 = _nt_header
|
156
|
+
s0 << r4
|
157
|
+
if r4
|
158
|
+
s5, i5 = [], index
|
159
|
+
loop do
|
160
|
+
r6 = _nt_passage
|
161
|
+
if r6
|
162
|
+
s5 << r6
|
163
|
+
else
|
164
|
+
break
|
165
|
+
end
|
166
|
+
end
|
167
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
168
|
+
s0 << r5
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
if s0.last
|
173
|
+
r0 = instantiate_node(SceneNode,input, i0...index, s0)
|
174
|
+
r0.extend(Scene0)
|
175
|
+
else
|
176
|
+
@index = i0
|
177
|
+
r0 = nil
|
178
|
+
end
|
179
|
+
|
180
|
+
node_cache[:scene][start_index] = r0
|
181
|
+
|
182
|
+
r0
|
183
|
+
end
|
184
|
+
|
185
|
+
module Passage0
|
186
|
+
def action
|
187
|
+
elements[0]
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
module Passage1
|
193
|
+
def header
|
194
|
+
elements[2]
|
195
|
+
end
|
196
|
+
|
197
|
+
def content
|
198
|
+
elements[3]
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
def _nt_passage
|
204
|
+
start_index = index
|
205
|
+
if node_cache[:passage].has_key?(index)
|
206
|
+
cached = node_cache[:passage][index]
|
207
|
+
if cached
|
208
|
+
node_cache[:passage][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
209
|
+
@index = cached.interval.end
|
210
|
+
end
|
211
|
+
return cached
|
212
|
+
end
|
213
|
+
|
214
|
+
i0, s0 = index, []
|
215
|
+
if (match_len = has_terminal?('#passage', false, index))
|
216
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
217
|
+
@index += match_len
|
218
|
+
else
|
219
|
+
terminal_parse_failure('#passage')
|
220
|
+
r1 = nil
|
221
|
+
end
|
222
|
+
s0 << r1
|
223
|
+
if r1
|
224
|
+
s2, i2 = [], index
|
225
|
+
loop do
|
226
|
+
r3 = _nt_ws
|
227
|
+
if r3
|
228
|
+
s2 << r3
|
229
|
+
else
|
230
|
+
break
|
231
|
+
end
|
232
|
+
end
|
233
|
+
if s2.empty?
|
234
|
+
@index = i2
|
235
|
+
r2 = nil
|
236
|
+
else
|
237
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
238
|
+
end
|
239
|
+
s0 << r2
|
240
|
+
if r2
|
241
|
+
r4 = _nt_header
|
242
|
+
s0 << r4
|
243
|
+
if r4
|
244
|
+
r5 = _nt_content
|
245
|
+
s0 << r5
|
246
|
+
if r5
|
247
|
+
s6, i6 = [], index
|
248
|
+
loop do
|
249
|
+
i7, s7 = index, []
|
250
|
+
r8 = _nt_action
|
251
|
+
s7 << r8
|
252
|
+
if r8
|
253
|
+
s9, i9 = [], index
|
254
|
+
loop do
|
255
|
+
r10 = _nt_nl
|
256
|
+
if r10
|
257
|
+
s9 << r10
|
258
|
+
else
|
259
|
+
break
|
260
|
+
end
|
261
|
+
end
|
262
|
+
if s9.empty?
|
263
|
+
@index = i9
|
264
|
+
r9 = nil
|
265
|
+
else
|
266
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
267
|
+
end
|
268
|
+
s7 << r9
|
269
|
+
end
|
270
|
+
if s7.last
|
271
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
272
|
+
r7.extend(Passage0)
|
273
|
+
else
|
274
|
+
@index = i7
|
275
|
+
r7 = nil
|
276
|
+
end
|
277
|
+
if r7
|
278
|
+
s6 << r7
|
279
|
+
else
|
280
|
+
break
|
281
|
+
end
|
282
|
+
end
|
283
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
284
|
+
s0 << r6
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
if s0.last
|
290
|
+
r0 = instantiate_node(PassageNode,input, i0...index, s0)
|
291
|
+
r0.extend(Passage1)
|
292
|
+
else
|
293
|
+
@index = i0
|
294
|
+
r0 = nil
|
295
|
+
end
|
296
|
+
|
297
|
+
node_cache[:passage][start_index] = r0
|
298
|
+
|
299
|
+
r0
|
300
|
+
end
|
301
|
+
|
302
|
+
module Item0
|
303
|
+
def action
|
304
|
+
elements[0]
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
module Item1
|
310
|
+
def header
|
311
|
+
elements[2]
|
312
|
+
end
|
313
|
+
|
314
|
+
def content
|
315
|
+
elements[3]
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
319
|
+
|
320
|
+
def _nt_item
|
321
|
+
start_index = index
|
322
|
+
if node_cache[:item].has_key?(index)
|
323
|
+
cached = node_cache[:item][index]
|
324
|
+
if cached
|
325
|
+
node_cache[:item][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
326
|
+
@index = cached.interval.end
|
327
|
+
end
|
328
|
+
return cached
|
329
|
+
end
|
330
|
+
|
331
|
+
i0, s0 = index, []
|
332
|
+
if (match_len = has_terminal?('#item', false, index))
|
333
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
334
|
+
@index += match_len
|
335
|
+
else
|
336
|
+
terminal_parse_failure('#item')
|
337
|
+
r1 = nil
|
338
|
+
end
|
339
|
+
s0 << r1
|
340
|
+
if r1
|
341
|
+
s2, i2 = [], index
|
342
|
+
loop do
|
343
|
+
r3 = _nt_ws
|
344
|
+
if r3
|
345
|
+
s2 << r3
|
346
|
+
else
|
347
|
+
break
|
348
|
+
end
|
349
|
+
end
|
350
|
+
if s2.empty?
|
351
|
+
@index = i2
|
352
|
+
r2 = nil
|
353
|
+
else
|
354
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
355
|
+
end
|
356
|
+
s0 << r2
|
357
|
+
if r2
|
358
|
+
r4 = _nt_header
|
359
|
+
s0 << r4
|
360
|
+
if r4
|
361
|
+
r5 = _nt_content
|
362
|
+
s0 << r5
|
363
|
+
if r5
|
364
|
+
s6, i6 = [], index
|
365
|
+
loop do
|
366
|
+
i7, s7 = index, []
|
367
|
+
r8 = _nt_action
|
368
|
+
s7 << r8
|
369
|
+
if r8
|
370
|
+
s9, i9 = [], index
|
371
|
+
loop do
|
372
|
+
r10 = _nt_nl
|
373
|
+
if r10
|
374
|
+
s9 << r10
|
375
|
+
else
|
376
|
+
break
|
377
|
+
end
|
378
|
+
end
|
379
|
+
if s9.empty?
|
380
|
+
@index = i9
|
381
|
+
r9 = nil
|
382
|
+
else
|
383
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
384
|
+
end
|
385
|
+
s7 << r9
|
386
|
+
end
|
387
|
+
if s7.last
|
388
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
389
|
+
r7.extend(Item0)
|
390
|
+
else
|
391
|
+
@index = i7
|
392
|
+
r7 = nil
|
393
|
+
end
|
394
|
+
if r7
|
395
|
+
s6 << r7
|
396
|
+
else
|
397
|
+
break
|
398
|
+
end
|
399
|
+
end
|
400
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
401
|
+
s0 << r6
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
if s0.last
|
407
|
+
r0 = instantiate_node(ItemNode,input, i0...index, s0)
|
408
|
+
r0.extend(Item1)
|
409
|
+
else
|
410
|
+
@index = i0
|
411
|
+
r0 = nil
|
412
|
+
end
|
413
|
+
|
414
|
+
node_cache[:item][start_index] = r0
|
415
|
+
|
416
|
+
r0
|
417
|
+
end
|
418
|
+
|
419
|
+
module Header0
|
420
|
+
def state
|
421
|
+
elements[3]
|
422
|
+
end
|
423
|
+
|
424
|
+
end
|
425
|
+
|
426
|
+
module Header1
|
427
|
+
def summary
|
428
|
+
elements[1]
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
module Header2
|
433
|
+
def scriptWrapper
|
434
|
+
elements[1]
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
module Header3
|
439
|
+
def identifier
|
440
|
+
elements[0]
|
441
|
+
end
|
442
|
+
|
443
|
+
end
|
444
|
+
|
445
|
+
def _nt_header
|
446
|
+
start_index = index
|
447
|
+
if node_cache[:header].has_key?(index)
|
448
|
+
cached = node_cache[:header][index]
|
449
|
+
if cached
|
450
|
+
node_cache[:header][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
451
|
+
@index = cached.interval.end
|
452
|
+
end
|
453
|
+
return cached
|
454
|
+
end
|
455
|
+
|
456
|
+
i0, s0 = index, []
|
457
|
+
r1 = _nt_identifier
|
458
|
+
s0 << r1
|
459
|
+
if r1
|
460
|
+
i3, s3 = index, []
|
461
|
+
s4, i4 = [], index
|
462
|
+
loop do
|
463
|
+
r5 = _nt_ws
|
464
|
+
if r5
|
465
|
+
s4 << r5
|
466
|
+
else
|
467
|
+
break
|
468
|
+
end
|
469
|
+
end
|
470
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
471
|
+
s3 << r4
|
472
|
+
if r4
|
473
|
+
if (match_len = has_terminal?('[', false, index))
|
474
|
+
r6 = true
|
475
|
+
@index += match_len
|
476
|
+
else
|
477
|
+
terminal_parse_failure('[')
|
478
|
+
r6 = nil
|
479
|
+
end
|
480
|
+
s3 << r6
|
481
|
+
if r6
|
482
|
+
s7, i7 = [], index
|
483
|
+
loop do
|
484
|
+
r8 = _nt_ws
|
485
|
+
if r8
|
486
|
+
s7 << r8
|
487
|
+
else
|
488
|
+
break
|
489
|
+
end
|
490
|
+
end
|
491
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
492
|
+
s3 << r7
|
493
|
+
if r7
|
494
|
+
r9 = _nt_state
|
495
|
+
s3 << r9
|
496
|
+
if r9
|
497
|
+
s10, i10 = [], index
|
498
|
+
loop do
|
499
|
+
r11 = _nt_ws
|
500
|
+
if r11
|
501
|
+
s10 << r11
|
502
|
+
else
|
503
|
+
break
|
504
|
+
end
|
505
|
+
end
|
506
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
507
|
+
s3 << r10
|
508
|
+
if r10
|
509
|
+
if (match_len = has_terminal?(']', false, index))
|
510
|
+
r12 = true
|
511
|
+
@index += match_len
|
512
|
+
else
|
513
|
+
terminal_parse_failure(']')
|
514
|
+
r12 = nil
|
515
|
+
end
|
516
|
+
s3 << r12
|
517
|
+
end
|
518
|
+
end
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
522
|
+
if s3.last
|
523
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
524
|
+
r3.extend(Header0)
|
525
|
+
else
|
526
|
+
@index = i3
|
527
|
+
r3 = nil
|
528
|
+
end
|
529
|
+
if r3
|
530
|
+
r2 = r3
|
531
|
+
else
|
532
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
533
|
+
end
|
534
|
+
s0 << r2
|
535
|
+
if r2
|
536
|
+
i14, s14 = index, []
|
537
|
+
s15, i15 = [], index
|
538
|
+
loop do
|
539
|
+
r16 = _nt_ws
|
540
|
+
if r16
|
541
|
+
s15 << r16
|
542
|
+
else
|
543
|
+
break
|
544
|
+
end
|
545
|
+
end
|
546
|
+
if s15.empty?
|
547
|
+
@index = i15
|
548
|
+
r15 = nil
|
549
|
+
else
|
550
|
+
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
551
|
+
end
|
552
|
+
s14 << r15
|
553
|
+
if r15
|
554
|
+
r17 = _nt_summary
|
555
|
+
s14 << r17
|
556
|
+
end
|
557
|
+
if s14.last
|
558
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
559
|
+
r14.extend(Header1)
|
560
|
+
else
|
561
|
+
@index = i14
|
562
|
+
r14 = nil
|
563
|
+
end
|
564
|
+
if r14
|
565
|
+
r13 = r14
|
566
|
+
else
|
567
|
+
r13 = instantiate_node(SyntaxNode,input, index...index)
|
568
|
+
end
|
569
|
+
s0 << r13
|
570
|
+
if r13
|
571
|
+
i19, s19 = index, []
|
572
|
+
s20, i20 = [], index
|
573
|
+
loop do
|
574
|
+
r21 = _nt_wsnl
|
575
|
+
if r21
|
576
|
+
s20 << r21
|
577
|
+
else
|
578
|
+
break
|
579
|
+
end
|
580
|
+
end
|
581
|
+
r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
|
582
|
+
s19 << r20
|
583
|
+
if r20
|
584
|
+
r22 = _nt_scriptWrapper
|
585
|
+
s19 << r22
|
586
|
+
end
|
587
|
+
if s19.last
|
588
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
589
|
+
r19.extend(Header2)
|
590
|
+
else
|
591
|
+
@index = i19
|
592
|
+
r19 = nil
|
593
|
+
end
|
594
|
+
if r19
|
595
|
+
r18 = r19
|
596
|
+
else
|
597
|
+
r18 = instantiate_node(SyntaxNode,input, index...index)
|
598
|
+
end
|
599
|
+
s0 << r18
|
600
|
+
if r18
|
601
|
+
s23, i23 = [], index
|
602
|
+
loop do
|
603
|
+
r24 = _nt_nl
|
604
|
+
if r24
|
605
|
+
s23 << r24
|
606
|
+
else
|
607
|
+
break
|
608
|
+
end
|
609
|
+
end
|
610
|
+
if s23.empty?
|
611
|
+
@index = i23
|
612
|
+
r23 = nil
|
613
|
+
else
|
614
|
+
r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
|
615
|
+
end
|
616
|
+
s0 << r23
|
617
|
+
end
|
618
|
+
end
|
619
|
+
end
|
620
|
+
end
|
621
|
+
if s0.last
|
622
|
+
r0 = instantiate_node(HeaderNode,input, i0...index, s0)
|
623
|
+
r0.extend(Header3)
|
624
|
+
else
|
625
|
+
@index = i0
|
626
|
+
r0 = nil
|
627
|
+
end
|
628
|
+
|
629
|
+
node_cache[:header][start_index] = r0
|
630
|
+
|
631
|
+
r0
|
632
|
+
end
|
633
|
+
|
634
|
+
module Summary0
|
635
|
+
end
|
636
|
+
|
637
|
+
module Summary1
|
638
|
+
end
|
639
|
+
|
640
|
+
def _nt_summary
|
641
|
+
start_index = index
|
642
|
+
if node_cache[:summary].has_key?(index)
|
643
|
+
cached = node_cache[:summary][index]
|
644
|
+
if cached
|
645
|
+
node_cache[:summary][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
646
|
+
@index = cached.interval.end
|
647
|
+
end
|
648
|
+
return cached
|
649
|
+
end
|
650
|
+
|
651
|
+
i0, s0 = index, []
|
652
|
+
i1 = index
|
653
|
+
r2 = _nt_word
|
654
|
+
if r2
|
655
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
656
|
+
r1 = r2
|
657
|
+
else
|
658
|
+
r3 = _nt_punctuation
|
659
|
+
if r3
|
660
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
661
|
+
r1 = r3
|
662
|
+
else
|
663
|
+
@index = i1
|
664
|
+
r1 = nil
|
665
|
+
end
|
666
|
+
end
|
667
|
+
s0 << r1
|
668
|
+
if r1
|
669
|
+
s4, i4 = [], index
|
670
|
+
loop do
|
671
|
+
i5, s5 = index, []
|
672
|
+
s6, i6 = [], index
|
673
|
+
loop do
|
674
|
+
r7 = _nt_ws
|
675
|
+
if r7
|
676
|
+
s6 << r7
|
677
|
+
else
|
678
|
+
break
|
679
|
+
end
|
680
|
+
end
|
681
|
+
if s6.empty?
|
682
|
+
@index = i6
|
683
|
+
r6 = nil
|
684
|
+
else
|
685
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
686
|
+
end
|
687
|
+
s5 << r6
|
688
|
+
if r6
|
689
|
+
i8 = index
|
690
|
+
r9 = _nt_word
|
691
|
+
if r9
|
692
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
693
|
+
r8 = r9
|
694
|
+
else
|
695
|
+
r10 = _nt_punctuation
|
696
|
+
if r10
|
697
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
698
|
+
r8 = r10
|
699
|
+
else
|
700
|
+
@index = i8
|
701
|
+
r8 = nil
|
702
|
+
end
|
703
|
+
end
|
704
|
+
s5 << r8
|
705
|
+
end
|
706
|
+
if s5.last
|
707
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
708
|
+
r5.extend(Summary0)
|
709
|
+
else
|
710
|
+
@index = i5
|
711
|
+
r5 = nil
|
712
|
+
end
|
713
|
+
if r5
|
714
|
+
s4 << r5
|
715
|
+
else
|
716
|
+
break
|
717
|
+
end
|
718
|
+
end
|
719
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
720
|
+
s0 << r4
|
721
|
+
end
|
722
|
+
if s0.last
|
723
|
+
r0 = instantiate_node(SummaryNode,input, i0...index, s0)
|
724
|
+
r0.extend(Summary1)
|
725
|
+
else
|
726
|
+
@index = i0
|
727
|
+
r0 = nil
|
728
|
+
end
|
729
|
+
|
730
|
+
node_cache[:summary][start_index] = r0
|
731
|
+
|
732
|
+
r0
|
733
|
+
end
|
734
|
+
|
735
|
+
def _nt_content
|
736
|
+
start_index = index
|
737
|
+
if node_cache[:content].has_key?(index)
|
738
|
+
cached = node_cache[:content][index]
|
739
|
+
if cached
|
740
|
+
node_cache[:content][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
741
|
+
@index = cached.interval.end
|
742
|
+
end
|
743
|
+
return cached
|
744
|
+
end
|
745
|
+
|
746
|
+
s0, i0 = [], index
|
747
|
+
loop do
|
748
|
+
i1 = index
|
749
|
+
r2 = _nt_word
|
750
|
+
if r2
|
751
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
752
|
+
r1 = r2
|
753
|
+
else
|
754
|
+
r3 = _nt_punctuation
|
755
|
+
if r3
|
756
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
757
|
+
r1 = r3
|
758
|
+
else
|
759
|
+
r4 = _nt_inlineTag
|
760
|
+
if r4
|
761
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
762
|
+
r1 = r4
|
763
|
+
else
|
764
|
+
r5 = _nt_logicTag
|
765
|
+
if r5
|
766
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
767
|
+
r1 = r5
|
768
|
+
else
|
769
|
+
r6 = _nt_link
|
770
|
+
if r6
|
771
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
772
|
+
r1 = r6
|
773
|
+
else
|
774
|
+
r7 = _nt_endp
|
775
|
+
if r7
|
776
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
777
|
+
r1 = r7
|
778
|
+
else
|
779
|
+
r8 = _nt_nl
|
780
|
+
if r8
|
781
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
782
|
+
r1 = r8
|
783
|
+
else
|
784
|
+
r9 = _nt_ws
|
785
|
+
if r9
|
786
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
787
|
+
r1 = r9
|
788
|
+
else
|
789
|
+
@index = i1
|
790
|
+
r1 = nil
|
791
|
+
end
|
792
|
+
end
|
793
|
+
end
|
794
|
+
end
|
795
|
+
end
|
796
|
+
end
|
797
|
+
end
|
798
|
+
end
|
799
|
+
if r1
|
800
|
+
s0 << r1
|
801
|
+
else
|
802
|
+
break
|
803
|
+
end
|
804
|
+
end
|
805
|
+
r0 = instantiate_node(ContentNode,input, i0...index, s0)
|
806
|
+
|
807
|
+
node_cache[:content][start_index] = r0
|
808
|
+
|
809
|
+
r0
|
810
|
+
end
|
811
|
+
|
812
|
+
module Link0
|
813
|
+
def word
|
814
|
+
elements[1]
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
module Link1
|
819
|
+
def keyword
|
820
|
+
elements[3]
|
821
|
+
end
|
822
|
+
end
|
823
|
+
|
824
|
+
module Link2
|
825
|
+
end
|
826
|
+
|
827
|
+
def _nt_link
|
828
|
+
start_index = index
|
829
|
+
if node_cache[:link].has_key?(index)
|
830
|
+
cached = node_cache[:link][index]
|
831
|
+
if cached
|
832
|
+
node_cache[:link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
833
|
+
@index = cached.interval.end
|
834
|
+
end
|
835
|
+
return cached
|
836
|
+
end
|
837
|
+
|
838
|
+
i0, s0 = index, []
|
839
|
+
if (match_len = has_terminal?('[', false, index))
|
840
|
+
r1 = true
|
841
|
+
@index += match_len
|
842
|
+
else
|
843
|
+
terminal_parse_failure('[')
|
844
|
+
r1 = nil
|
845
|
+
end
|
846
|
+
s0 << r1
|
847
|
+
if r1
|
848
|
+
s2, i2 = [], index
|
849
|
+
loop do
|
850
|
+
i3, s3 = index, []
|
851
|
+
s4, i4 = [], index
|
852
|
+
loop do
|
853
|
+
r5 = _nt_ws
|
854
|
+
if r5
|
855
|
+
s4 << r5
|
856
|
+
else
|
857
|
+
break
|
858
|
+
end
|
859
|
+
end
|
860
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
861
|
+
s3 << r4
|
862
|
+
if r4
|
863
|
+
r6 = _nt_word
|
864
|
+
s3 << r6
|
865
|
+
end
|
866
|
+
if s3.last
|
867
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
868
|
+
r3.extend(Link0)
|
869
|
+
else
|
870
|
+
@index = i3
|
871
|
+
r3 = nil
|
872
|
+
end
|
873
|
+
if r3
|
874
|
+
s2 << r3
|
875
|
+
else
|
876
|
+
break
|
877
|
+
end
|
878
|
+
end
|
879
|
+
if s2.empty?
|
880
|
+
@index = i2
|
881
|
+
r2 = nil
|
882
|
+
else
|
883
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
884
|
+
end
|
885
|
+
s0 << r2
|
886
|
+
if r2
|
887
|
+
i8, s8 = index, []
|
888
|
+
s9, i9 = [], index
|
889
|
+
loop do
|
890
|
+
r10 = _nt_ws
|
891
|
+
if r10
|
892
|
+
s9 << r10
|
893
|
+
else
|
894
|
+
break
|
895
|
+
end
|
896
|
+
end
|
897
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
898
|
+
s8 << r9
|
899
|
+
if r9
|
900
|
+
if (match_len = has_terminal?('|', false, index))
|
901
|
+
r11 = true
|
902
|
+
@index += match_len
|
903
|
+
else
|
904
|
+
terminal_parse_failure('|')
|
905
|
+
r11 = nil
|
906
|
+
end
|
907
|
+
s8 << r11
|
908
|
+
if r11
|
909
|
+
s12, i12 = [], index
|
910
|
+
loop do
|
911
|
+
r13 = _nt_ws
|
912
|
+
if r13
|
913
|
+
s12 << r13
|
914
|
+
else
|
915
|
+
break
|
916
|
+
end
|
917
|
+
end
|
918
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
919
|
+
s8 << r12
|
920
|
+
if r12
|
921
|
+
r14 = _nt_keyword
|
922
|
+
s8 << r14
|
923
|
+
end
|
924
|
+
end
|
925
|
+
end
|
926
|
+
if s8.last
|
927
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
928
|
+
r8.extend(Link1)
|
929
|
+
else
|
930
|
+
@index = i8
|
931
|
+
r8 = nil
|
932
|
+
end
|
933
|
+
if r8
|
934
|
+
r7 = r8
|
935
|
+
else
|
936
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
937
|
+
end
|
938
|
+
s0 << r7
|
939
|
+
if r7
|
940
|
+
s15, i15 = [], index
|
941
|
+
loop do
|
942
|
+
r16 = _nt_ws
|
943
|
+
if r16
|
944
|
+
s15 << r16
|
945
|
+
else
|
946
|
+
break
|
947
|
+
end
|
948
|
+
end
|
949
|
+
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
950
|
+
s0 << r15
|
951
|
+
if r15
|
952
|
+
if (match_len = has_terminal?(']', false, index))
|
953
|
+
r17 = true
|
954
|
+
@index += match_len
|
955
|
+
else
|
956
|
+
terminal_parse_failure(']')
|
957
|
+
r17 = nil
|
958
|
+
end
|
959
|
+
s0 << r17
|
960
|
+
end
|
961
|
+
end
|
962
|
+
end
|
963
|
+
end
|
964
|
+
if s0.last
|
965
|
+
r0 = instantiate_node(LinkNode,input, i0...index, s0)
|
966
|
+
r0.extend(Link2)
|
967
|
+
else
|
968
|
+
@index = i0
|
969
|
+
r0 = nil
|
970
|
+
end
|
971
|
+
|
972
|
+
node_cache[:link][start_index] = r0
|
973
|
+
|
974
|
+
r0
|
975
|
+
end
|
976
|
+
|
977
|
+
module Action0
|
978
|
+
def keyword
|
979
|
+
elements[2]
|
980
|
+
end
|
981
|
+
|
982
|
+
def scriptWrapper
|
983
|
+
elements[4]
|
984
|
+
end
|
985
|
+
|
986
|
+
end
|
987
|
+
|
988
|
+
def _nt_action
|
989
|
+
start_index = index
|
990
|
+
if node_cache[:action].has_key?(index)
|
991
|
+
cached = node_cache[:action][index]
|
992
|
+
if cached
|
993
|
+
node_cache[:action][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
994
|
+
@index = cached.interval.end
|
995
|
+
end
|
996
|
+
return cached
|
997
|
+
end
|
998
|
+
|
999
|
+
i0, s0 = index, []
|
1000
|
+
if (match_len = has_terminal?('[', false, index))
|
1001
|
+
r1 = true
|
1002
|
+
@index += match_len
|
1003
|
+
else
|
1004
|
+
terminal_parse_failure('[')
|
1005
|
+
r1 = nil
|
1006
|
+
end
|
1007
|
+
s0 << r1
|
1008
|
+
if r1
|
1009
|
+
s2, i2 = [], index
|
1010
|
+
loop do
|
1011
|
+
r3 = _nt_ws
|
1012
|
+
if r3
|
1013
|
+
s2 << r3
|
1014
|
+
else
|
1015
|
+
break
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1019
|
+
s0 << r2
|
1020
|
+
if r2
|
1021
|
+
r4 = _nt_keyword
|
1022
|
+
s0 << r4
|
1023
|
+
if r4
|
1024
|
+
s5, i5 = [], index
|
1025
|
+
loop do
|
1026
|
+
r6 = _nt_ws
|
1027
|
+
if r6
|
1028
|
+
s5 << r6
|
1029
|
+
else
|
1030
|
+
break
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1034
|
+
s0 << r5
|
1035
|
+
if r5
|
1036
|
+
r7 = _nt_scriptWrapper
|
1037
|
+
s0 << r7
|
1038
|
+
if r7
|
1039
|
+
s8, i8 = [], index
|
1040
|
+
loop do
|
1041
|
+
r9 = _nt_ws
|
1042
|
+
if r9
|
1043
|
+
s8 << r9
|
1044
|
+
else
|
1045
|
+
break
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
1049
|
+
s0 << r8
|
1050
|
+
if r8
|
1051
|
+
if (match_len = has_terminal?(']', false, index))
|
1052
|
+
r10 = true
|
1053
|
+
@index += match_len
|
1054
|
+
else
|
1055
|
+
terminal_parse_failure(']')
|
1056
|
+
r10 = nil
|
1057
|
+
end
|
1058
|
+
s0 << r10
|
1059
|
+
end
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
end
|
1063
|
+
end
|
1064
|
+
end
|
1065
|
+
if s0.last
|
1066
|
+
r0 = instantiate_node(ActionNode,input, i0...index, s0)
|
1067
|
+
r0.extend(Action0)
|
1068
|
+
else
|
1069
|
+
@index = i0
|
1070
|
+
r0 = nil
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
node_cache[:action][start_index] = r0
|
1074
|
+
|
1075
|
+
r0
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
module ScriptWrapper0
|
1079
|
+
def script
|
1080
|
+
elements[2]
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
def _nt_scriptWrapper
|
1086
|
+
start_index = index
|
1087
|
+
if node_cache[:scriptWrapper].has_key?(index)
|
1088
|
+
cached = node_cache[:scriptWrapper][index]
|
1089
|
+
if cached
|
1090
|
+
node_cache[:scriptWrapper][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1091
|
+
@index = cached.interval.end
|
1092
|
+
end
|
1093
|
+
return cached
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
i0, s0 = index, []
|
1097
|
+
if (match_len = has_terminal?('<%', false, index))
|
1098
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1099
|
+
@index += match_len
|
1100
|
+
else
|
1101
|
+
terminal_parse_failure('<%')
|
1102
|
+
r1 = nil
|
1103
|
+
end
|
1104
|
+
s0 << r1
|
1105
|
+
if r1
|
1106
|
+
s2, i2 = [], index
|
1107
|
+
loop do
|
1108
|
+
r3 = _nt_wsnl
|
1109
|
+
if r3
|
1110
|
+
s2 << r3
|
1111
|
+
else
|
1112
|
+
break
|
1113
|
+
end
|
1114
|
+
end
|
1115
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1116
|
+
s0 << r2
|
1117
|
+
if r2
|
1118
|
+
r4 = _nt_script
|
1119
|
+
s0 << r4
|
1120
|
+
if r4
|
1121
|
+
s5, i5 = [], index
|
1122
|
+
loop do
|
1123
|
+
r6 = _nt_wsnl
|
1124
|
+
if r6
|
1125
|
+
s5 << r6
|
1126
|
+
else
|
1127
|
+
break
|
1128
|
+
end
|
1129
|
+
end
|
1130
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1131
|
+
s0 << r5
|
1132
|
+
if r5
|
1133
|
+
if (match_len = has_terminal?('%>', false, index))
|
1134
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1135
|
+
@index += match_len
|
1136
|
+
else
|
1137
|
+
terminal_parse_failure('%>')
|
1138
|
+
r7 = nil
|
1139
|
+
end
|
1140
|
+
s0 << r7
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
if s0.last
|
1146
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1147
|
+
r0.extend(ScriptWrapper0)
|
1148
|
+
else
|
1149
|
+
@index = i0
|
1150
|
+
r0 = nil
|
1151
|
+
end
|
1152
|
+
|
1153
|
+
node_cache[:scriptWrapper][start_index] = r0
|
1154
|
+
|
1155
|
+
r0
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
module Script0
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
module Script1
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
def _nt_script
|
1165
|
+
start_index = index
|
1166
|
+
if node_cache[:script].has_key?(index)
|
1167
|
+
cached = node_cache[:script][index]
|
1168
|
+
if cached
|
1169
|
+
node_cache[:script][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1170
|
+
@index = cached.interval.end
|
1171
|
+
end
|
1172
|
+
return cached
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
s0, i0 = [], index
|
1176
|
+
loop do
|
1177
|
+
i1, s1 = index, []
|
1178
|
+
i2 = index
|
1179
|
+
i3, s3 = index, []
|
1180
|
+
s4, i4 = [], index
|
1181
|
+
loop do
|
1182
|
+
r5 = _nt_wsnl
|
1183
|
+
if r5
|
1184
|
+
s4 << r5
|
1185
|
+
else
|
1186
|
+
break
|
1187
|
+
end
|
1188
|
+
end
|
1189
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1190
|
+
s3 << r4
|
1191
|
+
if r4
|
1192
|
+
if (match_len = has_terminal?('%>', false, index))
|
1193
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1194
|
+
@index += match_len
|
1195
|
+
else
|
1196
|
+
terminal_parse_failure('%>')
|
1197
|
+
r6 = nil
|
1198
|
+
end
|
1199
|
+
s3 << r6
|
1200
|
+
end
|
1201
|
+
if s3.last
|
1202
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1203
|
+
r3.extend(Script0)
|
1204
|
+
else
|
1205
|
+
@index = i3
|
1206
|
+
r3 = nil
|
1207
|
+
end
|
1208
|
+
if r3
|
1209
|
+
r2 = nil
|
1210
|
+
else
|
1211
|
+
@index = i2
|
1212
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1213
|
+
end
|
1214
|
+
s1 << r2
|
1215
|
+
if r2
|
1216
|
+
if index < input_length
|
1217
|
+
r7 = true
|
1218
|
+
@index += 1
|
1219
|
+
else
|
1220
|
+
terminal_parse_failure("any character")
|
1221
|
+
r7 = nil
|
1222
|
+
end
|
1223
|
+
s1 << r7
|
1224
|
+
end
|
1225
|
+
if s1.last
|
1226
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1227
|
+
r1.extend(Script1)
|
1228
|
+
else
|
1229
|
+
@index = i1
|
1230
|
+
r1 = nil
|
1231
|
+
end
|
1232
|
+
if r1
|
1233
|
+
s0 << r1
|
1234
|
+
else
|
1235
|
+
break
|
1236
|
+
end
|
1237
|
+
end
|
1238
|
+
r0 = instantiate_node(ScriptNode,input, i0...index, s0)
|
1239
|
+
|
1240
|
+
node_cache[:script][start_index] = r0
|
1241
|
+
|
1242
|
+
r0
|
1243
|
+
end
|
1244
|
+
|
1245
|
+
module InlineTag0
|
1246
|
+
def script
|
1247
|
+
elements[2]
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
def _nt_inlineTag
|
1253
|
+
start_index = index
|
1254
|
+
if node_cache[:inlineTag].has_key?(index)
|
1255
|
+
cached = node_cache[:inlineTag][index]
|
1256
|
+
if cached
|
1257
|
+
node_cache[:inlineTag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1258
|
+
@index = cached.interval.end
|
1259
|
+
end
|
1260
|
+
return cached
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
i0, s0 = index, []
|
1264
|
+
if (match_len = has_terminal?('<%=', false, index))
|
1265
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1266
|
+
@index += match_len
|
1267
|
+
else
|
1268
|
+
terminal_parse_failure('<%=')
|
1269
|
+
r1 = nil
|
1270
|
+
end
|
1271
|
+
s0 << r1
|
1272
|
+
if r1
|
1273
|
+
s2, i2 = [], index
|
1274
|
+
loop do
|
1275
|
+
r3 = _nt_wsnl
|
1276
|
+
if r3
|
1277
|
+
s2 << r3
|
1278
|
+
else
|
1279
|
+
break
|
1280
|
+
end
|
1281
|
+
end
|
1282
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1283
|
+
s0 << r2
|
1284
|
+
if r2
|
1285
|
+
r4 = _nt_script
|
1286
|
+
s0 << r4
|
1287
|
+
if r4
|
1288
|
+
s5, i5 = [], index
|
1289
|
+
loop do
|
1290
|
+
r6 = _nt_wsnl
|
1291
|
+
if r6
|
1292
|
+
s5 << r6
|
1293
|
+
else
|
1294
|
+
break
|
1295
|
+
end
|
1296
|
+
end
|
1297
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1298
|
+
s0 << r5
|
1299
|
+
if r5
|
1300
|
+
if (match_len = has_terminal?('%>', false, index))
|
1301
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1302
|
+
@index += match_len
|
1303
|
+
else
|
1304
|
+
terminal_parse_failure('%>')
|
1305
|
+
r7 = nil
|
1306
|
+
end
|
1307
|
+
s0 << r7
|
1308
|
+
end
|
1309
|
+
end
|
1310
|
+
end
|
1311
|
+
end
|
1312
|
+
if s0.last
|
1313
|
+
r0 = instantiate_node(InlineTagNode,input, i0...index, s0)
|
1314
|
+
r0.extend(InlineTag0)
|
1315
|
+
else
|
1316
|
+
@index = i0
|
1317
|
+
r0 = nil
|
1318
|
+
end
|
1319
|
+
|
1320
|
+
node_cache[:inlineTag][start_index] = r0
|
1321
|
+
|
1322
|
+
r0
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
def _nt_logicTag
|
1326
|
+
start_index = index
|
1327
|
+
if node_cache[:logicTag].has_key?(index)
|
1328
|
+
cached = node_cache[:logicTag][index]
|
1329
|
+
if cached
|
1330
|
+
node_cache[:logicTag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1331
|
+
@index = cached.interval.end
|
1332
|
+
end
|
1333
|
+
return cached
|
1334
|
+
end
|
1335
|
+
|
1336
|
+
i0 = index
|
1337
|
+
r1 = _nt_ifTag
|
1338
|
+
if r1
|
1339
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1340
|
+
r0 = r1
|
1341
|
+
else
|
1342
|
+
r2 = _nt_scriptTag
|
1343
|
+
if r2
|
1344
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1345
|
+
r0 = r2
|
1346
|
+
else
|
1347
|
+
@index = i0
|
1348
|
+
r0 = nil
|
1349
|
+
end
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
node_cache[:logicTag][start_index] = r0
|
1353
|
+
|
1354
|
+
r0
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
module IfTag0
|
1358
|
+
def condition
|
1359
|
+
elements[4]
|
1360
|
+
end
|
1361
|
+
|
1362
|
+
def content
|
1363
|
+
elements[6]
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
end
|
1367
|
+
|
1368
|
+
module IfTag1
|
1369
|
+
def content
|
1370
|
+
elements[2]
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
end
|
1374
|
+
|
1375
|
+
module IfTag2
|
1376
|
+
def condition
|
1377
|
+
elements[4]
|
1378
|
+
end
|
1379
|
+
|
1380
|
+
def content
|
1381
|
+
elements[6]
|
1382
|
+
end
|
1383
|
+
|
1384
|
+
end
|
1385
|
+
|
1386
|
+
def _nt_ifTag
|
1387
|
+
start_index = index
|
1388
|
+
if node_cache[:ifTag].has_key?(index)
|
1389
|
+
cached = node_cache[:ifTag][index]
|
1390
|
+
if cached
|
1391
|
+
node_cache[:ifTag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1392
|
+
@index = cached.interval.end
|
1393
|
+
end
|
1394
|
+
return cached
|
1395
|
+
end
|
1396
|
+
|
1397
|
+
i0, s0 = index, []
|
1398
|
+
if (match_len = has_terminal?('{{', false, index))
|
1399
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1400
|
+
@index += match_len
|
1401
|
+
else
|
1402
|
+
terminal_parse_failure('{{')
|
1403
|
+
r1 = nil
|
1404
|
+
end
|
1405
|
+
s0 << r1
|
1406
|
+
if r1
|
1407
|
+
s2, i2 = [], index
|
1408
|
+
loop do
|
1409
|
+
r3 = _nt_wsnl
|
1410
|
+
if r3
|
1411
|
+
s2 << r3
|
1412
|
+
else
|
1413
|
+
break
|
1414
|
+
end
|
1415
|
+
end
|
1416
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1417
|
+
s0 << r2
|
1418
|
+
if r2
|
1419
|
+
if (match_len = has_terminal?('if', false, index))
|
1420
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1421
|
+
@index += match_len
|
1422
|
+
else
|
1423
|
+
terminal_parse_failure('if')
|
1424
|
+
r4 = nil
|
1425
|
+
end
|
1426
|
+
s0 << r4
|
1427
|
+
if r4
|
1428
|
+
s5, i5 = [], index
|
1429
|
+
loop do
|
1430
|
+
r6 = _nt_wsnl
|
1431
|
+
if r6
|
1432
|
+
s5 << r6
|
1433
|
+
else
|
1434
|
+
break
|
1435
|
+
end
|
1436
|
+
end
|
1437
|
+
if s5.empty?
|
1438
|
+
@index = i5
|
1439
|
+
r5 = nil
|
1440
|
+
else
|
1441
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1442
|
+
end
|
1443
|
+
s0 << r5
|
1444
|
+
if r5
|
1445
|
+
r7 = _nt_condition
|
1446
|
+
s0 << r7
|
1447
|
+
if r7
|
1448
|
+
s8, i8 = [], index
|
1449
|
+
loop do
|
1450
|
+
r9 = _nt_wsnl
|
1451
|
+
if r9
|
1452
|
+
s8 << r9
|
1453
|
+
else
|
1454
|
+
break
|
1455
|
+
end
|
1456
|
+
end
|
1457
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
1458
|
+
s0 << r8
|
1459
|
+
if r8
|
1460
|
+
r10 = _nt_content
|
1461
|
+
s0 << r10
|
1462
|
+
if r10
|
1463
|
+
s11, i11 = [], index
|
1464
|
+
loop do
|
1465
|
+
r12 = _nt_wsnl
|
1466
|
+
if r12
|
1467
|
+
s11 << r12
|
1468
|
+
else
|
1469
|
+
break
|
1470
|
+
end
|
1471
|
+
end
|
1472
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
1473
|
+
s0 << r11
|
1474
|
+
if r11
|
1475
|
+
s13, i13 = [], index
|
1476
|
+
loop do
|
1477
|
+
i14, s14 = index, []
|
1478
|
+
if (match_len = has_terminal?('|', false, index))
|
1479
|
+
r15 = true
|
1480
|
+
@index += match_len
|
1481
|
+
else
|
1482
|
+
terminal_parse_failure('|')
|
1483
|
+
r15 = nil
|
1484
|
+
end
|
1485
|
+
s14 << r15
|
1486
|
+
if r15
|
1487
|
+
s16, i16 = [], index
|
1488
|
+
loop do
|
1489
|
+
r17 = _nt_wsnl
|
1490
|
+
if r17
|
1491
|
+
s16 << r17
|
1492
|
+
else
|
1493
|
+
break
|
1494
|
+
end
|
1495
|
+
end
|
1496
|
+
r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
|
1497
|
+
s14 << r16
|
1498
|
+
if r16
|
1499
|
+
if (match_len = has_terminal?('if', false, index))
|
1500
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1501
|
+
@index += match_len
|
1502
|
+
else
|
1503
|
+
terminal_parse_failure('if')
|
1504
|
+
r18 = nil
|
1505
|
+
end
|
1506
|
+
s14 << r18
|
1507
|
+
if r18
|
1508
|
+
s19, i19 = [], index
|
1509
|
+
loop do
|
1510
|
+
r20 = _nt_wsnl
|
1511
|
+
if r20
|
1512
|
+
s19 << r20
|
1513
|
+
else
|
1514
|
+
break
|
1515
|
+
end
|
1516
|
+
end
|
1517
|
+
if s19.empty?
|
1518
|
+
@index = i19
|
1519
|
+
r19 = nil
|
1520
|
+
else
|
1521
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
1522
|
+
end
|
1523
|
+
s14 << r19
|
1524
|
+
if r19
|
1525
|
+
r21 = _nt_condition
|
1526
|
+
s14 << r21
|
1527
|
+
if r21
|
1528
|
+
s22, i22 = [], index
|
1529
|
+
loop do
|
1530
|
+
r23 = _nt_wsnl
|
1531
|
+
if r23
|
1532
|
+
s22 << r23
|
1533
|
+
else
|
1534
|
+
break
|
1535
|
+
end
|
1536
|
+
end
|
1537
|
+
r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
|
1538
|
+
s14 << r22
|
1539
|
+
if r22
|
1540
|
+
r24 = _nt_content
|
1541
|
+
s14 << r24
|
1542
|
+
if r24
|
1543
|
+
s25, i25 = [], index
|
1544
|
+
loop do
|
1545
|
+
r26 = _nt_wsnl
|
1546
|
+
if r26
|
1547
|
+
s25 << r26
|
1548
|
+
else
|
1549
|
+
break
|
1550
|
+
end
|
1551
|
+
end
|
1552
|
+
r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
|
1553
|
+
s14 << r25
|
1554
|
+
end
|
1555
|
+
end
|
1556
|
+
end
|
1557
|
+
end
|
1558
|
+
end
|
1559
|
+
end
|
1560
|
+
end
|
1561
|
+
if s14.last
|
1562
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
1563
|
+
r14.extend(IfTag0)
|
1564
|
+
else
|
1565
|
+
@index = i14
|
1566
|
+
r14 = nil
|
1567
|
+
end
|
1568
|
+
if r14
|
1569
|
+
s13 << r14
|
1570
|
+
else
|
1571
|
+
break
|
1572
|
+
end
|
1573
|
+
end
|
1574
|
+
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
1575
|
+
s0 << r13
|
1576
|
+
if r13
|
1577
|
+
i28, s28 = index, []
|
1578
|
+
if (match_len = has_terminal?('|', false, index))
|
1579
|
+
r29 = true
|
1580
|
+
@index += match_len
|
1581
|
+
else
|
1582
|
+
terminal_parse_failure('|')
|
1583
|
+
r29 = nil
|
1584
|
+
end
|
1585
|
+
s28 << r29
|
1586
|
+
if r29
|
1587
|
+
s30, i30 = [], index
|
1588
|
+
loop do
|
1589
|
+
r31 = _nt_wsnl
|
1590
|
+
if r31
|
1591
|
+
s30 << r31
|
1592
|
+
else
|
1593
|
+
break
|
1594
|
+
end
|
1595
|
+
end
|
1596
|
+
r30 = instantiate_node(SyntaxNode,input, i30...index, s30)
|
1597
|
+
s28 << r30
|
1598
|
+
if r30
|
1599
|
+
r32 = _nt_content
|
1600
|
+
s28 << r32
|
1601
|
+
if r32
|
1602
|
+
s33, i33 = [], index
|
1603
|
+
loop do
|
1604
|
+
r34 = _nt_wsnl
|
1605
|
+
if r34
|
1606
|
+
s33 << r34
|
1607
|
+
else
|
1608
|
+
break
|
1609
|
+
end
|
1610
|
+
end
|
1611
|
+
r33 = instantiate_node(SyntaxNode,input, i33...index, s33)
|
1612
|
+
s28 << r33
|
1613
|
+
end
|
1614
|
+
end
|
1615
|
+
end
|
1616
|
+
if s28.last
|
1617
|
+
r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
|
1618
|
+
r28.extend(IfTag1)
|
1619
|
+
else
|
1620
|
+
@index = i28
|
1621
|
+
r28 = nil
|
1622
|
+
end
|
1623
|
+
if r28
|
1624
|
+
r27 = r28
|
1625
|
+
else
|
1626
|
+
r27 = instantiate_node(SyntaxNode,input, index...index)
|
1627
|
+
end
|
1628
|
+
s0 << r27
|
1629
|
+
if r27
|
1630
|
+
if (match_len = has_terminal?('}}', false, index))
|
1631
|
+
r35 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1632
|
+
@index += match_len
|
1633
|
+
else
|
1634
|
+
terminal_parse_failure('}}')
|
1635
|
+
r35 = nil
|
1636
|
+
end
|
1637
|
+
s0 << r35
|
1638
|
+
end
|
1639
|
+
end
|
1640
|
+
end
|
1641
|
+
end
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
end
|
1646
|
+
end
|
1647
|
+
end
|
1648
|
+
if s0.last
|
1649
|
+
r0 = instantiate_node(IfTagNode,input, i0...index, s0)
|
1650
|
+
r0.extend(IfTag2)
|
1651
|
+
else
|
1652
|
+
@index = i0
|
1653
|
+
r0 = nil
|
1654
|
+
end
|
1655
|
+
|
1656
|
+
node_cache[:ifTag][start_index] = r0
|
1657
|
+
|
1658
|
+
r0
|
1659
|
+
end
|
1660
|
+
|
1661
|
+
module Condition0
|
1662
|
+
def jsExpr
|
1663
|
+
elements[0]
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
end
|
1667
|
+
|
1668
|
+
def _nt_condition
|
1669
|
+
start_index = index
|
1670
|
+
if node_cache[:condition].has_key?(index)
|
1671
|
+
cached = node_cache[:condition][index]
|
1672
|
+
if cached
|
1673
|
+
node_cache[:condition][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1674
|
+
@index = cached.interval.end
|
1675
|
+
end
|
1676
|
+
return cached
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
i0, s0 = index, []
|
1680
|
+
r1 = _nt_jsExpr
|
1681
|
+
s0 << r1
|
1682
|
+
if r1
|
1683
|
+
s2, i2 = [], index
|
1684
|
+
loop do
|
1685
|
+
r3 = _nt_wsnl
|
1686
|
+
if r3
|
1687
|
+
s2 << r3
|
1688
|
+
else
|
1689
|
+
break
|
1690
|
+
end
|
1691
|
+
end
|
1692
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1693
|
+
s0 << r2
|
1694
|
+
if r2
|
1695
|
+
if (match_len = has_terminal?(':', false, index))
|
1696
|
+
r4 = true
|
1697
|
+
@index += match_len
|
1698
|
+
else
|
1699
|
+
terminal_parse_failure(':')
|
1700
|
+
r4 = nil
|
1701
|
+
end
|
1702
|
+
s0 << r4
|
1703
|
+
end
|
1704
|
+
end
|
1705
|
+
if s0.last
|
1706
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1707
|
+
r0.extend(Condition0)
|
1708
|
+
else
|
1709
|
+
@index = i0
|
1710
|
+
r0 = nil
|
1711
|
+
end
|
1712
|
+
|
1713
|
+
node_cache[:condition][start_index] = r0
|
1714
|
+
|
1715
|
+
r0
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
module ScriptTag0
|
1719
|
+
def scriptWrapper
|
1720
|
+
elements[4]
|
1721
|
+
end
|
1722
|
+
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
def _nt_scriptTag
|
1726
|
+
start_index = index
|
1727
|
+
if node_cache[:scriptTag].has_key?(index)
|
1728
|
+
cached = node_cache[:scriptTag][index]
|
1729
|
+
if cached
|
1730
|
+
node_cache[:scriptTag][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1731
|
+
@index = cached.interval.end
|
1732
|
+
end
|
1733
|
+
return cached
|
1734
|
+
end
|
1735
|
+
|
1736
|
+
i0, s0 = index, []
|
1737
|
+
if (match_len = has_terminal?('{{', false, index))
|
1738
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1739
|
+
@index += match_len
|
1740
|
+
else
|
1741
|
+
terminal_parse_failure('{{')
|
1742
|
+
r1 = nil
|
1743
|
+
end
|
1744
|
+
s0 << r1
|
1745
|
+
if r1
|
1746
|
+
s2, i2 = [], index
|
1747
|
+
loop do
|
1748
|
+
r3 = _nt_ws
|
1749
|
+
if r3
|
1750
|
+
s2 << r3
|
1751
|
+
else
|
1752
|
+
break
|
1753
|
+
end
|
1754
|
+
end
|
1755
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1756
|
+
s0 << r2
|
1757
|
+
if r2
|
1758
|
+
if (match_len = has_terminal?('script', false, index))
|
1759
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1760
|
+
@index += match_len
|
1761
|
+
else
|
1762
|
+
terminal_parse_failure('script')
|
1763
|
+
r4 = nil
|
1764
|
+
end
|
1765
|
+
s0 << r4
|
1766
|
+
if r4
|
1767
|
+
s5, i5 = [], index
|
1768
|
+
loop do
|
1769
|
+
r6 = _nt_ws
|
1770
|
+
if r6
|
1771
|
+
s5 << r6
|
1772
|
+
else
|
1773
|
+
break
|
1774
|
+
end
|
1775
|
+
end
|
1776
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1777
|
+
s0 << r5
|
1778
|
+
if r5
|
1779
|
+
r7 = _nt_scriptWrapper
|
1780
|
+
s0 << r7
|
1781
|
+
if r7
|
1782
|
+
if (match_len = has_terminal?('}}', false, index))
|
1783
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1784
|
+
@index += match_len
|
1785
|
+
else
|
1786
|
+
terminal_parse_failure('}}')
|
1787
|
+
r8 = nil
|
1788
|
+
end
|
1789
|
+
s0 << r8
|
1790
|
+
end
|
1791
|
+
end
|
1792
|
+
end
|
1793
|
+
end
|
1794
|
+
end
|
1795
|
+
if s0.last
|
1796
|
+
r0 = instantiate_node(ScriptTagNode,input, i0...index, s0)
|
1797
|
+
r0.extend(ScriptTag0)
|
1798
|
+
else
|
1799
|
+
@index = i0
|
1800
|
+
r0 = nil
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
node_cache[:scriptTag][start_index] = r0
|
1804
|
+
|
1805
|
+
r0
|
1806
|
+
end
|
1807
|
+
|
1808
|
+
module JsExpr0
|
1809
|
+
end
|
1810
|
+
|
1811
|
+
module JsExpr1
|
1812
|
+
end
|
1813
|
+
|
1814
|
+
def _nt_jsExpr
|
1815
|
+
start_index = index
|
1816
|
+
if node_cache[:jsExpr].has_key?(index)
|
1817
|
+
cached = node_cache[:jsExpr][index]
|
1818
|
+
if cached
|
1819
|
+
node_cache[:jsExpr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1820
|
+
@index = cached.interval.end
|
1821
|
+
end
|
1822
|
+
return cached
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
s0, i0 = [], index
|
1826
|
+
loop do
|
1827
|
+
i1, s1 = index, []
|
1828
|
+
i2 = index
|
1829
|
+
i3, s3 = index, []
|
1830
|
+
s4, i4 = [], index
|
1831
|
+
loop do
|
1832
|
+
r5 = _nt_wsnl
|
1833
|
+
if r5
|
1834
|
+
s4 << r5
|
1835
|
+
else
|
1836
|
+
break
|
1837
|
+
end
|
1838
|
+
end
|
1839
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1840
|
+
s3 << r4
|
1841
|
+
if r4
|
1842
|
+
if (match_len = has_terminal?(':', false, index))
|
1843
|
+
r6 = true
|
1844
|
+
@index += match_len
|
1845
|
+
else
|
1846
|
+
terminal_parse_failure(':')
|
1847
|
+
r6 = nil
|
1848
|
+
end
|
1849
|
+
s3 << r6
|
1850
|
+
end
|
1851
|
+
if s3.last
|
1852
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1853
|
+
r3.extend(JsExpr0)
|
1854
|
+
else
|
1855
|
+
@index = i3
|
1856
|
+
r3 = nil
|
1857
|
+
end
|
1858
|
+
if r3
|
1859
|
+
r2 = nil
|
1860
|
+
else
|
1861
|
+
@index = i2
|
1862
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1863
|
+
end
|
1864
|
+
s1 << r2
|
1865
|
+
if r2
|
1866
|
+
if index < input_length
|
1867
|
+
r7 = true
|
1868
|
+
@index += 1
|
1869
|
+
else
|
1870
|
+
terminal_parse_failure("any character")
|
1871
|
+
r7 = nil
|
1872
|
+
end
|
1873
|
+
s1 << r7
|
1874
|
+
end
|
1875
|
+
if s1.last
|
1876
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1877
|
+
r1.extend(JsExpr1)
|
1878
|
+
else
|
1879
|
+
@index = i1
|
1880
|
+
r1 = nil
|
1881
|
+
end
|
1882
|
+
if r1
|
1883
|
+
s0 << r1
|
1884
|
+
else
|
1885
|
+
break
|
1886
|
+
end
|
1887
|
+
end
|
1888
|
+
r0 = instantiate_node(JSExprNode,input, i0...index, s0)
|
1889
|
+
|
1890
|
+
node_cache[:jsExpr][start_index] = r0
|
1891
|
+
|
1892
|
+
r0
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
def _nt_identifier
|
1896
|
+
start_index = index
|
1897
|
+
if node_cache[:identifier].has_key?(index)
|
1898
|
+
cached = node_cache[:identifier][index]
|
1899
|
+
if cached
|
1900
|
+
node_cache[:identifier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1901
|
+
@index = cached.interval.end
|
1902
|
+
end
|
1903
|
+
return cached
|
1904
|
+
end
|
1905
|
+
|
1906
|
+
s0, i0 = [], index
|
1907
|
+
loop do
|
1908
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
1909
|
+
r1 = true
|
1910
|
+
@index += 1
|
1911
|
+
else
|
1912
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
1913
|
+
r1 = nil
|
1914
|
+
end
|
1915
|
+
if r1
|
1916
|
+
s0 << r1
|
1917
|
+
else
|
1918
|
+
break
|
1919
|
+
end
|
1920
|
+
end
|
1921
|
+
if s0.empty?
|
1922
|
+
@index = i0
|
1923
|
+
r0 = nil
|
1924
|
+
else
|
1925
|
+
r0 = instantiate_node(IdentifierNode,input, i0...index, s0)
|
1926
|
+
end
|
1927
|
+
|
1928
|
+
node_cache[:identifier][start_index] = r0
|
1929
|
+
|
1930
|
+
r0
|
1931
|
+
end
|
1932
|
+
|
1933
|
+
def _nt_state
|
1934
|
+
start_index = index
|
1935
|
+
if node_cache[:state].has_key?(index)
|
1936
|
+
cached = node_cache[:state][index]
|
1937
|
+
if cached
|
1938
|
+
node_cache[:state][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1939
|
+
@index = cached.interval.end
|
1940
|
+
end
|
1941
|
+
return cached
|
1942
|
+
end
|
1943
|
+
|
1944
|
+
s0, i0 = [], index
|
1945
|
+
loop do
|
1946
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
1947
|
+
r1 = true
|
1948
|
+
@index += 1
|
1949
|
+
else
|
1950
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
1951
|
+
r1 = nil
|
1952
|
+
end
|
1953
|
+
if r1
|
1954
|
+
s0 << r1
|
1955
|
+
else
|
1956
|
+
break
|
1957
|
+
end
|
1958
|
+
end
|
1959
|
+
if s0.empty?
|
1960
|
+
@index = i0
|
1961
|
+
r0 = nil
|
1962
|
+
else
|
1963
|
+
r0 = instantiate_node(StateNode,input, i0...index, s0)
|
1964
|
+
end
|
1965
|
+
|
1966
|
+
node_cache[:state][start_index] = r0
|
1967
|
+
|
1968
|
+
r0
|
1969
|
+
end
|
1970
|
+
|
1971
|
+
module String0
|
1972
|
+
end
|
1973
|
+
|
1974
|
+
module String1
|
1975
|
+
end
|
1976
|
+
|
1977
|
+
def _nt_string
|
1978
|
+
start_index = index
|
1979
|
+
if node_cache[:string].has_key?(index)
|
1980
|
+
cached = node_cache[:string][index]
|
1981
|
+
if cached
|
1982
|
+
node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1983
|
+
@index = cached.interval.end
|
1984
|
+
end
|
1985
|
+
return cached
|
1986
|
+
end
|
1987
|
+
|
1988
|
+
i0, s0 = index, []
|
1989
|
+
if (match_len = has_terminal?('"', false, index))
|
1990
|
+
r1 = true
|
1991
|
+
@index += match_len
|
1992
|
+
else
|
1993
|
+
terminal_parse_failure('"')
|
1994
|
+
r1 = nil
|
1995
|
+
end
|
1996
|
+
s0 << r1
|
1997
|
+
if r1
|
1998
|
+
s2, i2 = [], index
|
1999
|
+
loop do
|
2000
|
+
i3 = index
|
2001
|
+
if (match_len = has_terminal?('\"', false, index))
|
2002
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2003
|
+
@index += match_len
|
2004
|
+
else
|
2005
|
+
terminal_parse_failure('\"')
|
2006
|
+
r4 = nil
|
2007
|
+
end
|
2008
|
+
if r4
|
2009
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2010
|
+
r3 = r4
|
2011
|
+
else
|
2012
|
+
i5, s5 = index, []
|
2013
|
+
i6 = index
|
2014
|
+
if (match_len = has_terminal?('"', false, index))
|
2015
|
+
r7 = true
|
2016
|
+
@index += match_len
|
2017
|
+
else
|
2018
|
+
terminal_parse_failure('"')
|
2019
|
+
r7 = nil
|
2020
|
+
end
|
2021
|
+
if r7
|
2022
|
+
r6 = nil
|
2023
|
+
else
|
2024
|
+
@index = i6
|
2025
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
2026
|
+
end
|
2027
|
+
s5 << r6
|
2028
|
+
if r6
|
2029
|
+
if index < input_length
|
2030
|
+
r8 = true
|
2031
|
+
@index += 1
|
2032
|
+
else
|
2033
|
+
terminal_parse_failure("any character")
|
2034
|
+
r8 = nil
|
2035
|
+
end
|
2036
|
+
s5 << r8
|
2037
|
+
end
|
2038
|
+
if s5.last
|
2039
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
2040
|
+
r5.extend(String0)
|
2041
|
+
else
|
2042
|
+
@index = i5
|
2043
|
+
r5 = nil
|
2044
|
+
end
|
2045
|
+
if r5
|
2046
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2047
|
+
r3 = r5
|
2048
|
+
else
|
2049
|
+
@index = i3
|
2050
|
+
r3 = nil
|
2051
|
+
end
|
2052
|
+
end
|
2053
|
+
if r3
|
2054
|
+
s2 << r3
|
2055
|
+
else
|
2056
|
+
break
|
2057
|
+
end
|
2058
|
+
end
|
2059
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2060
|
+
s0 << r2
|
2061
|
+
if r2
|
2062
|
+
if (match_len = has_terminal?('"', false, index))
|
2063
|
+
r9 = true
|
2064
|
+
@index += match_len
|
2065
|
+
else
|
2066
|
+
terminal_parse_failure('"')
|
2067
|
+
r9 = nil
|
2068
|
+
end
|
2069
|
+
s0 << r9
|
2070
|
+
end
|
2071
|
+
end
|
2072
|
+
if s0.last
|
2073
|
+
r0 = instantiate_node(StringNode,input, i0...index, s0)
|
2074
|
+
r0.extend(String1)
|
2075
|
+
else
|
2076
|
+
@index = i0
|
2077
|
+
r0 = nil
|
2078
|
+
end
|
2079
|
+
|
2080
|
+
node_cache[:string][start_index] = r0
|
2081
|
+
|
2082
|
+
r0
|
2083
|
+
end
|
2084
|
+
|
2085
|
+
module Keyword0
|
2086
|
+
end
|
2087
|
+
|
2088
|
+
def _nt_keyword
|
2089
|
+
start_index = index
|
2090
|
+
if node_cache[:keyword].has_key?(index)
|
2091
|
+
cached = node_cache[:keyword][index]
|
2092
|
+
if cached
|
2093
|
+
node_cache[:keyword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2094
|
+
@index = cached.interval.end
|
2095
|
+
end
|
2096
|
+
return cached
|
2097
|
+
end
|
2098
|
+
|
2099
|
+
i0, s0 = index, []
|
2100
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z_]'] ||= Regexp.new(gr), :regexp, index)
|
2101
|
+
r1 = true
|
2102
|
+
@index += 1
|
2103
|
+
else
|
2104
|
+
terminal_parse_failure('[a-zA-Z_]')
|
2105
|
+
r1 = nil
|
2106
|
+
end
|
2107
|
+
s0 << r1
|
2108
|
+
if r1
|
2109
|
+
s2, i2 = [], index
|
2110
|
+
loop do
|
2111
|
+
if has_terminal?(@regexps[gr = '\A[a-zA-Z0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
2112
|
+
r3 = true
|
2113
|
+
@index += 1
|
2114
|
+
else
|
2115
|
+
terminal_parse_failure('[a-zA-Z0-9_]')
|
2116
|
+
r3 = nil
|
2117
|
+
end
|
2118
|
+
if r3
|
2119
|
+
s2 << r3
|
2120
|
+
else
|
2121
|
+
break
|
2122
|
+
end
|
2123
|
+
end
|
2124
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2125
|
+
s0 << r2
|
2126
|
+
end
|
2127
|
+
if s0.last
|
2128
|
+
r0 = instantiate_node(KeywordNode,input, i0...index, s0)
|
2129
|
+
r0.extend(Keyword0)
|
2130
|
+
else
|
2131
|
+
@index = i0
|
2132
|
+
r0 = nil
|
2133
|
+
end
|
2134
|
+
|
2135
|
+
node_cache[:keyword][start_index] = r0
|
2136
|
+
|
2137
|
+
r0
|
2138
|
+
end
|
2139
|
+
|
2140
|
+
module Number0
|
2141
|
+
end
|
2142
|
+
|
2143
|
+
module Number1
|
2144
|
+
end
|
2145
|
+
|
2146
|
+
def _nt_number
|
2147
|
+
start_index = index
|
2148
|
+
if node_cache[:number].has_key?(index)
|
2149
|
+
cached = node_cache[:number][index]
|
2150
|
+
if cached
|
2151
|
+
node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2152
|
+
@index = cached.interval.end
|
2153
|
+
end
|
2154
|
+
return cached
|
2155
|
+
end
|
2156
|
+
|
2157
|
+
i0, s0 = index, []
|
2158
|
+
s1, i1 = [], index
|
2159
|
+
loop do
|
2160
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
2161
|
+
r2 = true
|
2162
|
+
@index += 1
|
2163
|
+
else
|
2164
|
+
terminal_parse_failure('[0-9]')
|
2165
|
+
r2 = nil
|
2166
|
+
end
|
2167
|
+
if r2
|
2168
|
+
s1 << r2
|
2169
|
+
else
|
2170
|
+
break
|
2171
|
+
end
|
2172
|
+
end
|
2173
|
+
if s1.empty?
|
2174
|
+
@index = i1
|
2175
|
+
r1 = nil
|
2176
|
+
else
|
2177
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
2178
|
+
end
|
2179
|
+
s0 << r1
|
2180
|
+
if r1
|
2181
|
+
i4, s4 = index, []
|
2182
|
+
if (match_len = has_terminal?('.', false, index))
|
2183
|
+
r5 = true
|
2184
|
+
@index += match_len
|
2185
|
+
else
|
2186
|
+
terminal_parse_failure('.')
|
2187
|
+
r5 = nil
|
2188
|
+
end
|
2189
|
+
s4 << r5
|
2190
|
+
if r5
|
2191
|
+
s6, i6 = [], index
|
2192
|
+
loop do
|
2193
|
+
if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
|
2194
|
+
r7 = true
|
2195
|
+
@index += 1
|
2196
|
+
else
|
2197
|
+
terminal_parse_failure('[0-9]')
|
2198
|
+
r7 = nil
|
2199
|
+
end
|
2200
|
+
if r7
|
2201
|
+
s6 << r7
|
2202
|
+
else
|
2203
|
+
break
|
2204
|
+
end
|
2205
|
+
end
|
2206
|
+
if s6.empty?
|
2207
|
+
@index = i6
|
2208
|
+
r6 = nil
|
2209
|
+
else
|
2210
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
2211
|
+
end
|
2212
|
+
s4 << r6
|
2213
|
+
end
|
2214
|
+
if s4.last
|
2215
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
2216
|
+
r4.extend(Number0)
|
2217
|
+
else
|
2218
|
+
@index = i4
|
2219
|
+
r4 = nil
|
2220
|
+
end
|
2221
|
+
if r4
|
2222
|
+
r3 = r4
|
2223
|
+
else
|
2224
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
2225
|
+
end
|
2226
|
+
s0 << r3
|
2227
|
+
end
|
2228
|
+
if s0.last
|
2229
|
+
r0 = instantiate_node(NumberNode,input, i0...index, s0)
|
2230
|
+
r0.extend(Number1)
|
2231
|
+
else
|
2232
|
+
@index = i0
|
2233
|
+
r0 = nil
|
2234
|
+
end
|
2235
|
+
|
2236
|
+
node_cache[:number][start_index] = r0
|
2237
|
+
|
2238
|
+
r0
|
2239
|
+
end
|
2240
|
+
|
2241
|
+
def _nt_word
|
2242
|
+
start_index = index
|
2243
|
+
if node_cache[:word].has_key?(index)
|
2244
|
+
cached = node_cache[:word][index]
|
2245
|
+
if cached
|
2246
|
+
node_cache[:word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2247
|
+
@index = cached.interval.end
|
2248
|
+
end
|
2249
|
+
return cached
|
2250
|
+
end
|
2251
|
+
|
2252
|
+
s0, i0 = [], index
|
2253
|
+
loop do
|
2254
|
+
if has_terminal?(@regexps[gr = '\A[a-zñáéíóúüA-ZÑÁÉÍÓÚÜ0-9_]'] ||= Regexp.new(gr), :regexp, index)
|
2255
|
+
r1 = true
|
2256
|
+
@index += 1
|
2257
|
+
else
|
2258
|
+
terminal_parse_failure('[a-zñáéíóúüA-ZÑÁÉÍÓÚÜ0-9_]')
|
2259
|
+
r1 = nil
|
2260
|
+
end
|
2261
|
+
if r1
|
2262
|
+
s0 << r1
|
2263
|
+
else
|
2264
|
+
break
|
2265
|
+
end
|
2266
|
+
end
|
2267
|
+
if s0.empty?
|
2268
|
+
@index = i0
|
2269
|
+
r0 = nil
|
2270
|
+
else
|
2271
|
+
r0 = instantiate_node(WordNode,input, i0...index, s0)
|
2272
|
+
end
|
2273
|
+
|
2274
|
+
node_cache[:word][start_index] = r0
|
2275
|
+
|
2276
|
+
r0
|
2277
|
+
end
|
2278
|
+
|
2279
|
+
module Endp0
|
2280
|
+
def nl
|
2281
|
+
elements[0]
|
2282
|
+
end
|
2283
|
+
|
2284
|
+
end
|
2285
|
+
|
2286
|
+
def _nt_endp
|
2287
|
+
start_index = index
|
2288
|
+
if node_cache[:endp].has_key?(index)
|
2289
|
+
cached = node_cache[:endp][index]
|
2290
|
+
if cached
|
2291
|
+
node_cache[:endp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2292
|
+
@index = cached.interval.end
|
2293
|
+
end
|
2294
|
+
return cached
|
2295
|
+
end
|
2296
|
+
|
2297
|
+
i0, s0 = index, []
|
2298
|
+
r1 = _nt_nl
|
2299
|
+
s0 << r1
|
2300
|
+
if r1
|
2301
|
+
s2, i2 = [], index
|
2302
|
+
loop do
|
2303
|
+
r3 = _nt_nl
|
2304
|
+
if r3
|
2305
|
+
s2 << r3
|
2306
|
+
else
|
2307
|
+
break
|
2308
|
+
end
|
2309
|
+
end
|
2310
|
+
if s2.empty?
|
2311
|
+
@index = i2
|
2312
|
+
r2 = nil
|
2313
|
+
else
|
2314
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
2315
|
+
end
|
2316
|
+
s0 << r2
|
2317
|
+
end
|
2318
|
+
if s0.last
|
2319
|
+
r0 = instantiate_node(EndParagraphNode,input, i0...index, s0)
|
2320
|
+
r0.extend(Endp0)
|
2321
|
+
else
|
2322
|
+
@index = i0
|
2323
|
+
r0 = nil
|
2324
|
+
end
|
2325
|
+
|
2326
|
+
node_cache[:endp][start_index] = r0
|
2327
|
+
|
2328
|
+
r0
|
2329
|
+
end
|
2330
|
+
|
2331
|
+
def _nt_punctuation
|
2332
|
+
start_index = index
|
2333
|
+
if node_cache[:punctuation].has_key?(index)
|
2334
|
+
cached = node_cache[:punctuation][index]
|
2335
|
+
if cached
|
2336
|
+
node_cache[:punctuation][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2337
|
+
@index = cached.interval.end
|
2338
|
+
end
|
2339
|
+
return cached
|
2340
|
+
end
|
2341
|
+
|
2342
|
+
i0 = index
|
2343
|
+
if (match_len = has_terminal?(':', false, index))
|
2344
|
+
r1 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2345
|
+
@index += match_len
|
2346
|
+
else
|
2347
|
+
terminal_parse_failure(':')
|
2348
|
+
r1 = nil
|
2349
|
+
end
|
2350
|
+
if r1
|
2351
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2352
|
+
r0 = r1
|
2353
|
+
else
|
2354
|
+
if (match_len = has_terminal?(';', false, index))
|
2355
|
+
r2 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2356
|
+
@index += match_len
|
2357
|
+
else
|
2358
|
+
terminal_parse_failure(';')
|
2359
|
+
r2 = nil
|
2360
|
+
end
|
2361
|
+
if r2
|
2362
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2363
|
+
r0 = r2
|
2364
|
+
else
|
2365
|
+
if (match_len = has_terminal?('.', false, index))
|
2366
|
+
r3 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2367
|
+
@index += match_len
|
2368
|
+
else
|
2369
|
+
terminal_parse_failure('.')
|
2370
|
+
r3 = nil
|
2371
|
+
end
|
2372
|
+
if r3
|
2373
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2374
|
+
r0 = r3
|
2375
|
+
else
|
2376
|
+
if (match_len = has_terminal?(',', false, index))
|
2377
|
+
r4 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2378
|
+
@index += match_len
|
2379
|
+
else
|
2380
|
+
terminal_parse_failure(',')
|
2381
|
+
r4 = nil
|
2382
|
+
end
|
2383
|
+
if r4
|
2384
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2385
|
+
r0 = r4
|
2386
|
+
else
|
2387
|
+
if (match_len = has_terminal?('(', false, index))
|
2388
|
+
r5 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2389
|
+
@index += match_len
|
2390
|
+
else
|
2391
|
+
terminal_parse_failure('(')
|
2392
|
+
r5 = nil
|
2393
|
+
end
|
2394
|
+
if r5
|
2395
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2396
|
+
r0 = r5
|
2397
|
+
else
|
2398
|
+
if (match_len = has_terminal?(')', false, index))
|
2399
|
+
r6 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2400
|
+
@index += match_len
|
2401
|
+
else
|
2402
|
+
terminal_parse_failure(')')
|
2403
|
+
r6 = nil
|
2404
|
+
end
|
2405
|
+
if r6
|
2406
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2407
|
+
r0 = r6
|
2408
|
+
else
|
2409
|
+
if (match_len = has_terminal?("'", false, index))
|
2410
|
+
r7 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2411
|
+
@index += match_len
|
2412
|
+
else
|
2413
|
+
terminal_parse_failure("'")
|
2414
|
+
r7 = nil
|
2415
|
+
end
|
2416
|
+
if r7
|
2417
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2418
|
+
r0 = r7
|
2419
|
+
else
|
2420
|
+
if (match_len = has_terminal?("?", false, index))
|
2421
|
+
r8 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2422
|
+
@index += match_len
|
2423
|
+
else
|
2424
|
+
terminal_parse_failure("?")
|
2425
|
+
r8 = nil
|
2426
|
+
end
|
2427
|
+
if r8
|
2428
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
2429
|
+
r0 = r8
|
2430
|
+
else
|
2431
|
+
if (match_len = has_terminal?("!", false, index))
|
2432
|
+
r9 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2433
|
+
@index += match_len
|
2434
|
+
else
|
2435
|
+
terminal_parse_failure("!")
|
2436
|
+
r9 = nil
|
2437
|
+
end
|
2438
|
+
if r9
|
2439
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
2440
|
+
r0 = r9
|
2441
|
+
else
|
2442
|
+
if (match_len = has_terminal?('--', false, index))
|
2443
|
+
r10 = instantiate_node(PunctuationNode,input, index...(index + match_len))
|
2444
|
+
@index += match_len
|
2445
|
+
else
|
2446
|
+
terminal_parse_failure('--')
|
2447
|
+
r10 = nil
|
2448
|
+
end
|
2449
|
+
if r10
|
2450
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
2451
|
+
r0 = r10
|
2452
|
+
else
|
2453
|
+
@index = i0
|
2454
|
+
r0 = nil
|
2455
|
+
end
|
2456
|
+
end
|
2457
|
+
end
|
2458
|
+
end
|
2459
|
+
end
|
2460
|
+
end
|
2461
|
+
end
|
2462
|
+
end
|
2463
|
+
end
|
2464
|
+
end
|
2465
|
+
|
2466
|
+
node_cache[:punctuation][start_index] = r0
|
2467
|
+
|
2468
|
+
r0
|
2469
|
+
end
|
2470
|
+
|
2471
|
+
def _nt_wsnl
|
2472
|
+
start_index = index
|
2473
|
+
if node_cache[:wsnl].has_key?(index)
|
2474
|
+
cached = node_cache[:wsnl][index]
|
2475
|
+
if cached
|
2476
|
+
node_cache[:wsnl][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2477
|
+
@index = cached.interval.end
|
2478
|
+
end
|
2479
|
+
return cached
|
2480
|
+
end
|
2481
|
+
|
2482
|
+
if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
|
2483
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2484
|
+
@index += 1
|
2485
|
+
else
|
2486
|
+
terminal_parse_failure('[\\s]')
|
2487
|
+
r0 = nil
|
2488
|
+
end
|
2489
|
+
|
2490
|
+
node_cache[:wsnl][start_index] = r0
|
2491
|
+
|
2492
|
+
r0
|
2493
|
+
end
|
2494
|
+
|
2495
|
+
def _nt_ws
|
2496
|
+
start_index = index
|
2497
|
+
if node_cache[:ws].has_key?(index)
|
2498
|
+
cached = node_cache[:ws][index]
|
2499
|
+
if cached
|
2500
|
+
node_cache[:ws][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2501
|
+
@index = cached.interval.end
|
2502
|
+
end
|
2503
|
+
return cached
|
2504
|
+
end
|
2505
|
+
|
2506
|
+
if has_terminal?(@regexps[gr = '\A[ \\t]'] ||= Regexp.new(gr), :regexp, index)
|
2507
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2508
|
+
@index += 1
|
2509
|
+
else
|
2510
|
+
terminal_parse_failure('[ \\t]')
|
2511
|
+
r0 = nil
|
2512
|
+
end
|
2513
|
+
|
2514
|
+
node_cache[:ws][start_index] = r0
|
2515
|
+
|
2516
|
+
r0
|
2517
|
+
end
|
2518
|
+
|
2519
|
+
def _nt_nl
|
2520
|
+
start_index = index
|
2521
|
+
if node_cache[:nl].has_key?(index)
|
2522
|
+
cached = node_cache[:nl][index]
|
2523
|
+
if cached
|
2524
|
+
node_cache[:nl][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2525
|
+
@index = cached.interval.end
|
2526
|
+
end
|
2527
|
+
return cached
|
2528
|
+
end
|
2529
|
+
|
2530
|
+
i0 = index
|
2531
|
+
if (match_len = has_terminal?("\r\n", false, index))
|
2532
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2533
|
+
@index += match_len
|
2534
|
+
else
|
2535
|
+
terminal_parse_failure("\r\n")
|
2536
|
+
r1 = nil
|
2537
|
+
end
|
2538
|
+
if r1
|
2539
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2540
|
+
r0 = r1
|
2541
|
+
else
|
2542
|
+
if (match_len = has_terminal?("\r", false, index))
|
2543
|
+
r2 = true
|
2544
|
+
@index += match_len
|
2545
|
+
else
|
2546
|
+
terminal_parse_failure("\r")
|
2547
|
+
r2 = nil
|
2548
|
+
end
|
2549
|
+
if r2
|
2550
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2551
|
+
r0 = r2
|
2552
|
+
else
|
2553
|
+
if (match_len = has_terminal?("\n", false, index))
|
2554
|
+
r3 = instantiate_node(NewLineNode,input, index...(index + match_len))
|
2555
|
+
@index += match_len
|
2556
|
+
else
|
2557
|
+
terminal_parse_failure("\n")
|
2558
|
+
r3 = nil
|
2559
|
+
end
|
2560
|
+
if r3
|
2561
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2562
|
+
r0 = r3
|
2563
|
+
else
|
2564
|
+
@index = i0
|
2565
|
+
r0 = nil
|
2566
|
+
end
|
2567
|
+
end
|
2568
|
+
end
|
2569
|
+
|
2570
|
+
node_cache[:nl][start_index] = r0
|
2571
|
+
|
2572
|
+
r0
|
2573
|
+
end
|
2574
|
+
|
2575
|
+
def _nt_eof
|
2576
|
+
start_index = index
|
2577
|
+
if node_cache[:eof].has_key?(index)
|
2578
|
+
cached = node_cache[:eof][index]
|
2579
|
+
if cached
|
2580
|
+
node_cache[:eof][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2581
|
+
@index = cached.interval.end
|
2582
|
+
end
|
2583
|
+
return cached
|
2584
|
+
end
|
2585
|
+
|
2586
|
+
i0 = index
|
2587
|
+
if index < input_length
|
2588
|
+
r1 = true
|
2589
|
+
@index += 1
|
2590
|
+
else
|
2591
|
+
terminal_parse_failure("any character")
|
2592
|
+
r1 = nil
|
2593
|
+
end
|
2594
|
+
if r1
|
2595
|
+
r0 = nil
|
2596
|
+
else
|
2597
|
+
@index = i0
|
2598
|
+
r0 = instantiate_node(SyntaxNode,input, index...index)
|
2599
|
+
end
|
2600
|
+
|
2601
|
+
node_cache[:eof][start_index] = r0
|
2602
|
+
|
2603
|
+
r0
|
2604
|
+
end
|
2605
|
+
|
2606
|
+
end
|
2607
|
+
|
2608
|
+
class DracoonGrammarParser < Treetop::Runtime::CompiledParser
|
2609
|
+
include DracoonGrammar
|
2610
|
+
end
|
2611
|
+
|