ruby-ll 2.1.1 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +362 -19
- data/README.md +23 -18
- data/ext/c/extconf.rb +1 -1
- data/lib/ll/code_generator.rb +1 -1
- data/lib/ll/lexer.rb +5 -5
- data/lib/ll/setup.rb +8 -6
- data/lib/ll/version.rb +1 -1
- data/lib/ll.rb +19 -19
- data/ruby-ll.gemspec +2 -5
- metadata +9 -13
- data/doc/DCO.md +0 -25
- data/lib/ll/bootstrap/parser.rb +0 -326
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e1faade684ee6c30dbceab3e16db55cd11d94a89933649d324009e1fd033f33
|
4
|
+
data.tar.gz: 2cbd469bbd142d904cbed8feb4557bd813744ab20cb5af9a5decc1f04eaca957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d8910a725c85f891ca9162d7d56893cac42eee64fed9e8cd00ba565e14eb7d34f204ea90ced3b8783b1ab411fb3595fdb849780b7a5babfe4c7674be8822f26
|
7
|
+
data.tar.gz: f9f08de4719772842c6693dc7fde5212b2eb94d1086a673f1557d6ea97a6f8f7f6ec5403a358a4d13fe0c714cdb6518e488fd460d740b0508a9799c59ffceb74
|
data/LICENSE
CHANGED
@@ -1,19 +1,362 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
Mozilla Public License, version 2.0
|
2
|
+
|
3
|
+
1. Definitions
|
4
|
+
|
5
|
+
1.1. "Contributor"
|
6
|
+
|
7
|
+
means each individual or legal entity that creates, contributes to the
|
8
|
+
creation of, or owns Covered Software.
|
9
|
+
|
10
|
+
1.2. "Contributor Version"
|
11
|
+
|
12
|
+
means the combination of the Contributions of others (if any) used by a
|
13
|
+
Contributor and that particular Contributor's Contribution.
|
14
|
+
|
15
|
+
1.3. "Contribution"
|
16
|
+
|
17
|
+
means Covered Software of a particular Contributor.
|
18
|
+
|
19
|
+
1.4. "Covered Software"
|
20
|
+
|
21
|
+
means Source Code Form to which the initial Contributor has attached the
|
22
|
+
notice in Exhibit A, the Executable Form of such Source Code Form, and
|
23
|
+
Modifications of such Source Code Form, in each case including portions
|
24
|
+
thereof.
|
25
|
+
|
26
|
+
1.5. "Incompatible With Secondary Licenses"
|
27
|
+
means
|
28
|
+
|
29
|
+
a. that the initial Contributor has attached the notice described in
|
30
|
+
Exhibit B to the Covered Software; or
|
31
|
+
|
32
|
+
b. that the Covered Software was made available under the terms of
|
33
|
+
version 1.1 or earlier of the License, but not also under the terms of
|
34
|
+
a Secondary License.
|
35
|
+
|
36
|
+
1.6. "Executable Form"
|
37
|
+
|
38
|
+
means any form of the work other than Source Code Form.
|
39
|
+
|
40
|
+
1.7. "Larger Work"
|
41
|
+
|
42
|
+
means a work that combines Covered Software with other material, in a
|
43
|
+
separate file or files, that is not Covered Software.
|
44
|
+
|
45
|
+
1.8. "License"
|
46
|
+
|
47
|
+
means this document.
|
48
|
+
|
49
|
+
1.9. "Licensable"
|
50
|
+
|
51
|
+
means having the right to grant, to the maximum extent possible, whether
|
52
|
+
at the time of the initial grant or subsequently, any and all of the
|
53
|
+
rights conveyed by this License.
|
54
|
+
|
55
|
+
1.10. "Modifications"
|
56
|
+
|
57
|
+
means any of the following:
|
58
|
+
|
59
|
+
a. any file in Source Code Form that results from an addition to,
|
60
|
+
deletion from, or modification of the contents of Covered Software; or
|
61
|
+
|
62
|
+
b. any new file in Source Code Form that contains any Covered Software.
|
63
|
+
|
64
|
+
1.11. "Patent Claims" of a Contributor
|
65
|
+
|
66
|
+
means any patent claim(s), including without limitation, method,
|
67
|
+
process, and apparatus claims, in any patent Licensable by such
|
68
|
+
Contributor that would be infringed, but for the grant of the License,
|
69
|
+
by the making, using, selling, offering for sale, having made, import,
|
70
|
+
or transfer of either its Contributions or its Contributor Version.
|
71
|
+
|
72
|
+
1.12. "Secondary License"
|
73
|
+
|
74
|
+
means either the GNU General Public License, Version 2.0, the GNU Lesser
|
75
|
+
General Public License, Version 2.1, the GNU Affero General Public
|
76
|
+
License, Version 3.0, or any later versions of those licenses.
|
77
|
+
|
78
|
+
1.13. "Source Code Form"
|
79
|
+
|
80
|
+
means the form of the work preferred for making modifications.
|
81
|
+
|
82
|
+
1.14. "You" (or "Your")
|
83
|
+
|
84
|
+
means an individual or a legal entity exercising rights under this
|
85
|
+
License. For legal entities, "You" includes any entity that controls, is
|
86
|
+
controlled by, or is under common control with You. For purposes of this
|
87
|
+
definition, "control" means (a) the power, direct or indirect, to cause
|
88
|
+
the direction or management of such entity, whether by contract or
|
89
|
+
otherwise, or (b) ownership of more than fifty percent (50%) of the
|
90
|
+
outstanding shares or beneficial ownership of such entity.
|
91
|
+
|
92
|
+
|
93
|
+
2. License Grants and Conditions
|
94
|
+
|
95
|
+
2.1. Grants
|
96
|
+
|
97
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
98
|
+
non-exclusive license:
|
99
|
+
|
100
|
+
a. under intellectual property rights (other than patent or trademark)
|
101
|
+
Licensable by such Contributor to use, reproduce, make available,
|
102
|
+
modify, display, perform, distribute, and otherwise exploit its
|
103
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
104
|
+
as part of a Larger Work; and
|
105
|
+
|
106
|
+
b. under Patent Claims of such Contributor to make, use, sell, offer for
|
107
|
+
sale, have made, import, and otherwise transfer either its
|
108
|
+
Contributions or its Contributor Version.
|
109
|
+
|
110
|
+
2.2. Effective Date
|
111
|
+
|
112
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
113
|
+
become effective for each Contribution on the date the Contributor first
|
114
|
+
distributes such Contribution.
|
115
|
+
|
116
|
+
2.3. Limitations on Grant Scope
|
117
|
+
|
118
|
+
The licenses granted in this Section 2 are the only rights granted under
|
119
|
+
this License. No additional rights or licenses will be implied from the
|
120
|
+
distribution or licensing of Covered Software under this License.
|
121
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
122
|
+
Contributor:
|
123
|
+
|
124
|
+
a. for any code that a Contributor has removed from Covered Software; or
|
125
|
+
|
126
|
+
b. for infringements caused by: (i) Your and any other third party's
|
127
|
+
modifications of Covered Software, or (ii) the combination of its
|
128
|
+
Contributions with other software (except as part of its Contributor
|
129
|
+
Version); or
|
130
|
+
|
131
|
+
c. under Patent Claims infringed by Covered Software in the absence of
|
132
|
+
its Contributions.
|
133
|
+
|
134
|
+
This License does not grant any rights in the trademarks, service marks,
|
135
|
+
or logos of any Contributor (except as may be necessary to comply with
|
136
|
+
the notice requirements in Section 3.4).
|
137
|
+
|
138
|
+
2.4. Subsequent Licenses
|
139
|
+
|
140
|
+
No Contributor makes additional grants as a result of Your choice to
|
141
|
+
distribute the Covered Software under a subsequent version of this
|
142
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
143
|
+
permitted under the terms of Section 3.3).
|
144
|
+
|
145
|
+
2.5. Representation
|
146
|
+
|
147
|
+
Each Contributor represents that the Contributor believes its
|
148
|
+
Contributions are its original creation(s) or it has sufficient rights to
|
149
|
+
grant the rights to its Contributions conveyed by this License.
|
150
|
+
|
151
|
+
2.6. Fair Use
|
152
|
+
|
153
|
+
This License is not intended to limit any rights You have under
|
154
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
155
|
+
equivalents.
|
156
|
+
|
157
|
+
2.7. Conditions
|
158
|
+
|
159
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
|
160
|
+
Section 2.1.
|
161
|
+
|
162
|
+
|
163
|
+
3. Responsibilities
|
164
|
+
|
165
|
+
3.1. Distribution of Source Form
|
166
|
+
|
167
|
+
All distribution of Covered Software in Source Code Form, including any
|
168
|
+
Modifications that You create or to which You contribute, must be under
|
169
|
+
the terms of this License. You must inform recipients that the Source
|
170
|
+
Code Form of the Covered Software is governed by the terms of this
|
171
|
+
License, and how they can obtain a copy of this License. You may not
|
172
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
173
|
+
Form.
|
174
|
+
|
175
|
+
3.2. Distribution of Executable Form
|
176
|
+
|
177
|
+
If You distribute Covered Software in Executable Form then:
|
178
|
+
|
179
|
+
a. such Covered Software must also be made available in Source Code Form,
|
180
|
+
as described in Section 3.1, and You must inform recipients of the
|
181
|
+
Executable Form how they can obtain a copy of such Source Code Form by
|
182
|
+
reasonable means in a timely manner, at a charge no more than the cost
|
183
|
+
of distribution to the recipient; and
|
184
|
+
|
185
|
+
b. You may distribute such Executable Form under the terms of this
|
186
|
+
License, or sublicense it under different terms, provided that the
|
187
|
+
license for the Executable Form does not attempt to limit or alter the
|
188
|
+
recipients' rights in the Source Code Form under this License.
|
189
|
+
|
190
|
+
3.3. Distribution of a Larger Work
|
191
|
+
|
192
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
193
|
+
provided that You also comply with the requirements of this License for
|
194
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
195
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
196
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
197
|
+
License permits You to additionally distribute such Covered Software
|
198
|
+
under the terms of such Secondary License(s), so that the recipient of
|
199
|
+
the Larger Work may, at their option, further distribute the Covered
|
200
|
+
Software under the terms of either this License or such Secondary
|
201
|
+
License(s).
|
202
|
+
|
203
|
+
3.4. Notices
|
204
|
+
|
205
|
+
You may not remove or alter the substance of any license notices
|
206
|
+
(including copyright notices, patent notices, disclaimers of warranty, or
|
207
|
+
limitations of liability) contained within the Source Code Form of the
|
208
|
+
Covered Software, except that You may alter any license notices to the
|
209
|
+
extent required to remedy known factual inaccuracies.
|
210
|
+
|
211
|
+
3.5. Application of Additional Terms
|
212
|
+
|
213
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
214
|
+
indemnity or liability obligations to one or more recipients of Covered
|
215
|
+
Software. However, You may do so only on Your own behalf, and not on
|
216
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
217
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
218
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
219
|
+
liability incurred by such Contributor as a result of warranty, support,
|
220
|
+
indemnity or liability terms You offer. You may include additional
|
221
|
+
disclaimers of warranty and limitations of liability specific to any
|
222
|
+
jurisdiction.
|
223
|
+
|
224
|
+
4. Inability to Comply Due to Statute or Regulation
|
225
|
+
|
226
|
+
If it is impossible for You to comply with any of the terms of this License
|
227
|
+
with respect to some or all of the Covered Software due to statute,
|
228
|
+
judicial order, or regulation then You must: (a) comply with the terms of
|
229
|
+
this License to the maximum extent possible; and (b) describe the
|
230
|
+
limitations and the code they affect. Such description must be placed in a
|
231
|
+
text file included with all distributions of the Covered Software under
|
232
|
+
this License. Except to the extent prohibited by statute or regulation,
|
233
|
+
such description must be sufficiently detailed for a recipient of ordinary
|
234
|
+
skill to be able to understand it.
|
235
|
+
|
236
|
+
5. Termination
|
237
|
+
|
238
|
+
5.1. The rights granted under this License will terminate automatically if You
|
239
|
+
fail to comply with any of its terms. However, if You become compliant,
|
240
|
+
then the rights granted under this License from a particular Contributor
|
241
|
+
are reinstated (a) provisionally, unless and until such Contributor
|
242
|
+
explicitly and finally terminates Your grants, and (b) on an ongoing
|
243
|
+
basis, if such Contributor fails to notify You of the non-compliance by
|
244
|
+
some reasonable means prior to 60 days after You have come back into
|
245
|
+
compliance. Moreover, Your grants from a particular Contributor are
|
246
|
+
reinstated on an ongoing basis if such Contributor notifies You of the
|
247
|
+
non-compliance by some reasonable means, this is the first time You have
|
248
|
+
received notice of non-compliance with this License from such
|
249
|
+
Contributor, and You become compliant prior to 30 days after Your receipt
|
250
|
+
of the notice.
|
251
|
+
|
252
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
253
|
+
infringement claim (excluding declaratory judgment actions,
|
254
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
255
|
+
directly or indirectly infringes any patent, then the rights granted to
|
256
|
+
You by any and all Contributors for the Covered Software under Section
|
257
|
+
2.1 of this License shall terminate.
|
258
|
+
|
259
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
|
260
|
+
license agreements (excluding distributors and resellers) which have been
|
261
|
+
validly granted by You or Your distributors under this License prior to
|
262
|
+
termination shall survive termination.
|
263
|
+
|
264
|
+
6. Disclaimer of Warranty
|
265
|
+
|
266
|
+
Covered Software is provided under this License on an "as is" basis,
|
267
|
+
without warranty of any kind, either expressed, implied, or statutory,
|
268
|
+
including, without limitation, warranties that the Covered Software is free
|
269
|
+
of defects, merchantable, fit for a particular purpose or non-infringing.
|
270
|
+
The entire risk as to the quality and performance of the Covered Software
|
271
|
+
is with You. Should any Covered Software prove defective in any respect,
|
272
|
+
You (not any Contributor) assume the cost of any necessary servicing,
|
273
|
+
repair, or correction. This disclaimer of warranty constitutes an essential
|
274
|
+
part of this License. No use of any Covered Software is authorized under
|
275
|
+
this License except under this disclaimer.
|
276
|
+
|
277
|
+
7. Limitation of Liability
|
278
|
+
|
279
|
+
Under no circumstances and under no legal theory, whether tort (including
|
280
|
+
negligence), contract, or otherwise, shall any Contributor, or anyone who
|
281
|
+
distributes Covered Software as permitted above, be liable to You for any
|
282
|
+
direct, indirect, special, incidental, or consequential damages of any
|
283
|
+
character including, without limitation, damages for lost profits, loss of
|
284
|
+
goodwill, work stoppage, computer failure or malfunction, or any and all
|
285
|
+
other commercial damages or losses, even if such party shall have been
|
286
|
+
informed of the possibility of such damages. This limitation of liability
|
287
|
+
shall not apply to liability for death or personal injury resulting from
|
288
|
+
such party's negligence to the extent applicable law prohibits such
|
289
|
+
limitation. Some jurisdictions do not allow the exclusion or limitation of
|
290
|
+
incidental or consequential damages, so this exclusion and limitation may
|
291
|
+
not apply to You.
|
292
|
+
|
293
|
+
8. Litigation
|
294
|
+
|
295
|
+
Any litigation relating to this License may be brought only in the courts
|
296
|
+
of a jurisdiction where the defendant maintains its principal place of
|
297
|
+
business and such litigation shall be governed by laws of that
|
298
|
+
jurisdiction, without reference to its conflict-of-law provisions. Nothing
|
299
|
+
in this Section shall prevent a party's ability to bring cross-claims or
|
300
|
+
counter-claims.
|
301
|
+
|
302
|
+
9. Miscellaneous
|
303
|
+
|
304
|
+
This License represents the complete agreement concerning the subject
|
305
|
+
matter hereof. If any provision of this License is held to be
|
306
|
+
unenforceable, such provision shall be reformed only to the extent
|
307
|
+
necessary to make it enforceable. Any law or regulation which provides that
|
308
|
+
the language of a contract shall be construed against the drafter shall not
|
309
|
+
be used to construe this License against a Contributor.
|
310
|
+
|
311
|
+
|
312
|
+
10. Versions of the License
|
313
|
+
|
314
|
+
10.1. New Versions
|
315
|
+
|
316
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
317
|
+
10.3, no one other than the license steward has the right to modify or
|
318
|
+
publish new versions of this License. Each version will be given a
|
319
|
+
distinguishing version number.
|
320
|
+
|
321
|
+
10.2. Effect of New Versions
|
322
|
+
|
323
|
+
You may distribute the Covered Software under the terms of the version
|
324
|
+
of the License under which You originally received the Covered Software,
|
325
|
+
or under the terms of any subsequent version published by the license
|
326
|
+
steward.
|
327
|
+
|
328
|
+
10.3. Modified Versions
|
329
|
+
|
330
|
+
If you create software not governed by this License, and you want to
|
331
|
+
create a new license for such software, you may create and use a
|
332
|
+
modified version of this License if you rename the license and remove
|
333
|
+
any references to the name of the license steward (except to note that
|
334
|
+
such modified license differs from this License).
|
335
|
+
|
336
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
337
|
+
Licenses If You choose to distribute Source Code Form that is
|
338
|
+
Incompatible With Secondary Licenses under the terms of this version of
|
339
|
+
the License, the notice described in Exhibit B of this License must be
|
340
|
+
attached.
|
341
|
+
|
342
|
+
Exhibit A - Source Code Form License Notice
|
343
|
+
|
344
|
+
This Source Code Form is subject to the
|
345
|
+
terms of the Mozilla Public License, v.
|
346
|
+
2.0. If a copy of the MPL was not
|
347
|
+
distributed with this file, You can
|
348
|
+
obtain one at
|
349
|
+
http://mozilla.org/MPL/2.0/.
|
350
|
+
|
351
|
+
If it is not possible or desirable to put the notice in a particular file,
|
352
|
+
then You may include the notice in a location (such as a LICENSE file in a
|
353
|
+
relevant directory) where a recipient would be likely to look for such a
|
354
|
+
notice.
|
355
|
+
|
356
|
+
You may add additional accurate notices of copyright ownership.
|
357
|
+
|
358
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
359
|
+
|
360
|
+
This Source Code Form is "Incompatible
|
361
|
+
With Secondary Licenses", as defined by
|
362
|
+
the Mozilla Public License, v. 2.0.
|
data/README.md
CHANGED
@@ -27,20 +27,20 @@ For more information on LL parsing, see
|
|
27
27
|
|
28
28
|
## Requirements
|
29
29
|
|
30
|
-
| Ruby | Required
|
31
|
-
|
32
|
-
| MRI | >=
|
33
|
-
|
|
34
|
-
|
|
35
|
-
| Maglev | Not supported
|
36
|
-
| Topaz | Not supported
|
37
|
-
| mruby | Not supported
|
30
|
+
| Ruby | Required
|
31
|
+
|:---------|:--------------
|
32
|
+
| MRI | >= 2.6.0
|
33
|
+
| JRuby | >= 9.0
|
34
|
+
| Rubinius | Not supported
|
35
|
+
| Maglev | Not supported
|
36
|
+
| Topaz | Not supported
|
37
|
+
| mruby | Not supported
|
38
38
|
|
39
|
-
For MRI
|
40
|
-
|
41
|
-
|
39
|
+
For MRI you'll need a C90 compatible compiler such as clang or gcc. For JRuby
|
40
|
+
you don't need any compilers to be installed as the .jar is packaged with the
|
41
|
+
Gem itself.
|
42
42
|
|
43
|
-
When hacking on
|
43
|
+
When hacking on ruby-ll you'll also need to have the following installed:
|
44
44
|
|
45
45
|
* Ragel 6 for building the grammar lexer
|
46
46
|
* javac for building the JRuby extension
|
@@ -265,8 +265,8 @@ Code blocks can also be added:
|
|
265
265
|
| B { 'B' }
|
266
266
|
;
|
267
267
|
|
268
|
-
When the terminal `A` would be processed the returned value would be
|
269
|
-
terminal `B` the returned value would be
|
268
|
+
When the terminal `A` would be processed the returned value would be `'A'`, for
|
269
|
+
terminal `B` the returned value would be `'B'`.
|
270
270
|
|
271
271
|
Code blocks have access to an array called `val` which contains the values of
|
272
272
|
every step of a branch. For example:
|
@@ -285,7 +285,7 @@ If no explicit code block is defined then ruby-ll will generate one for you. If
|
|
285
285
|
a branch consists out of only a single step (e.g. `A = B;`) then only the first
|
286
286
|
value is returned, otherwise all values are returned.
|
287
287
|
|
288
|
-
This means that in the following example the output will be whatever value
|
288
|
+
This means that in the following example the output will be whatever value `C`
|
289
289
|
contains:
|
290
290
|
|
291
291
|
A = B { p val[0] };
|
@@ -482,9 +482,14 @@ slight allocation overhead but it beats having to deal with race conditions.
|
|
482
482
|
|
483
483
|
## License
|
484
484
|
|
485
|
-
All source code in this repository is
|
486
|
-
|
487
|
-
|
485
|
+
All source code in this repository is subject to the terms of the Mozilla Public
|
486
|
+
License, version 2.0 unless stated otherwise. A copy of this license can be
|
487
|
+
found the file "LICENSE" or at <https://www.mozilla.org/MPL/2.0/>.
|
488
|
+
|
489
|
+
The following files are licensed under a different license:
|
490
|
+
|
491
|
+
* ext/c/khash.h: MIT license (see source code)
|
492
|
+
* ext/c/kvec.h: MIT license (see source code)
|
488
493
|
|
489
494
|
[racc]: https://github.com/tenderlove/racc
|
490
495
|
[oga]: https://github.com/yorickpeterse/oga
|
data/ext/c/extconf.rb
CHANGED
data/lib/ll/code_generator.rb
CHANGED
data/lib/ll/lexer.rb
CHANGED
@@ -8,7 +8,7 @@ module LL
|
|
8
8
|
#
|
9
9
|
class Lexer
|
10
10
|
|
11
|
-
# line
|
11
|
+
# line 9 "lib/ll/lexer.rb"
|
12
12
|
class << self
|
13
13
|
attr_accessor :_ll_lexer_trans_keys
|
14
14
|
private :_ll_lexer_trans_keys, :_ll_lexer_trans_keys=
|
@@ -264,7 +264,7 @@ self.ll_lexer_en_main = 22;
|
|
264
264
|
_ll_lexer_trans_targs = self.class.send(:_ll_lexer_trans_targs)
|
265
265
|
|
266
266
|
|
267
|
-
# line
|
267
|
+
# line 263 "lib/ll/lexer.rb"
|
268
268
|
begin
|
269
269
|
testEof = false
|
270
270
|
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
@@ -292,7 +292,7 @@ begin
|
|
292
292
|
begin
|
293
293
|
ts = p
|
294
294
|
end
|
295
|
-
# line
|
295
|
+
# line 291 "lib/ll/lexer.rb"
|
296
296
|
end
|
297
297
|
_keys = cs << 1
|
298
298
|
_inds = _ll_lexer_index_offsets[cs]
|
@@ -503,7 +503,7 @@ te = p+1
|
|
503
503
|
# line 168 "lib/ll/lexer.rl"
|
504
504
|
begin
|
505
505
|
act = 23; end
|
506
|
-
# line
|
506
|
+
# line 502 "lib/ll/lexer.rb"
|
507
507
|
end
|
508
508
|
end
|
509
509
|
end
|
@@ -513,7 +513,7 @@ act = 23; end
|
|
513
513
|
# line 1 "NONE"
|
514
514
|
begin
|
515
515
|
ts = nil; end
|
516
|
-
# line
|
516
|
+
# line 512 "lib/ll/lexer.rb"
|
517
517
|
end
|
518
518
|
|
519
519
|
if cs == 0
|
data/lib/ll/setup.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require 'll/version'
|
2
|
+
require 'll/driver'
|
3
|
+
require 'll/driver_config'
|
4
|
+
require 'll/parser_error'
|
5
|
+
require 'll/configuration_compiler'
|
6
|
+
require 'libll'
|
7
7
|
|
8
8
|
#:nocov:
|
9
9
|
if RUBY_PLATFORM == 'java'
|
10
|
+
require 'jruby'
|
11
|
+
|
10
12
|
org.libll.Libll.load(JRuby.runtime)
|
11
13
|
end
|
12
14
|
#:nocov:
|
data/lib/ll/version.rb
CHANGED
data/lib/ll.rb
CHANGED
@@ -6,22 +6,22 @@ require 'optparse'
|
|
6
6
|
require 'ast'
|
7
7
|
require 'ansi/code'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
require 'll/setup'
|
10
|
+
require 'll/source_line'
|
11
|
+
require 'll/lexer'
|
12
|
+
require 'll/token'
|
13
|
+
require 'll/parser'
|
14
|
+
require 'll/grammar_compiler'
|
15
|
+
require 'll/code_generator'
|
16
|
+
require 'll/compiled_grammar'
|
17
|
+
require 'll/rule'
|
18
|
+
require 'll/branch'
|
19
|
+
require 'll/terminal'
|
20
|
+
require 'll/epsilon'
|
21
|
+
require 'll/operator'
|
22
|
+
require 'll/message'
|
23
|
+
require 'll/ast/node'
|
24
|
+
require 'll/erb_context'
|
25
|
+
require 'll/configuration_compiler'
|
26
|
+
require 'll/compiled_configuration'
|
27
|
+
require 'll/cli'
|
data/ruby-ll.gemspec
CHANGED
@@ -4,11 +4,11 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'ruby-ll'
|
5
5
|
s.version = LL::VERSION
|
6
6
|
s.authors = ['Yorick Peterse']
|
7
|
-
s.email = 'yorickpeterse
|
7
|
+
s.email = 'yorick@yorickpeterse.com'
|
8
8
|
s.summary = 'An LL(1) parser generator for Ruby.'
|
9
9
|
s.homepage = 'https://github.com/yorickpeterse/ruby-ll'
|
10
10
|
s.description = s.summary
|
11
|
-
s.license = '
|
11
|
+
s.license = 'MPL-2.0'
|
12
12
|
|
13
13
|
s.files = Dir.glob([
|
14
14
|
'checkum/**/*',
|
@@ -31,9 +31,6 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.extensions = ['ext/c/extconf.rb']
|
32
32
|
end
|
33
33
|
|
34
|
-
s.has_rdoc = 'yard'
|
35
|
-
s.required_ruby_version = '>= 1.9.3'
|
36
|
-
|
37
34
|
s.add_dependency 'ast'
|
38
35
|
s.add_dependency 'ansi'
|
39
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-ll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yorick Peterse
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: An LL(1) parser generator for Ruby.
|
140
|
-
email: yorickpeterse
|
140
|
+
email: yorick@yorickpeterse.com
|
141
141
|
executables:
|
142
142
|
- ruby-ll
|
143
143
|
extensions:
|
@@ -148,7 +148,6 @@ files:
|
|
148
148
|
- LICENSE
|
149
149
|
- README.md
|
150
150
|
- bin/ruby-ll
|
151
|
-
- doc/DCO.md
|
152
151
|
- doc/css/common.css
|
153
152
|
- doc/driver_architecture.md
|
154
153
|
- ext/c/driver.c
|
@@ -166,7 +165,6 @@ files:
|
|
166
165
|
- ext/java/org/libll/DriverConfig.java
|
167
166
|
- lib/ll.rb
|
168
167
|
- lib/ll/ast/node.rb
|
169
|
-
- lib/ll/bootstrap/parser.rb
|
170
168
|
- lib/ll/branch.rb
|
171
169
|
- lib/ll/cli.rb
|
172
170
|
- lib/ll/code_generator.rb
|
@@ -193,9 +191,9 @@ files:
|
|
193
191
|
- ruby-ll.gemspec
|
194
192
|
homepage: https://github.com/yorickpeterse/ruby-ll
|
195
193
|
licenses:
|
196
|
-
-
|
194
|
+
- MPL-2.0
|
197
195
|
metadata: {}
|
198
|
-
post_install_message:
|
196
|
+
post_install_message:
|
199
197
|
rdoc_options: []
|
200
198
|
require_paths:
|
201
199
|
- lib
|
@@ -203,17 +201,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
201
|
requirements:
|
204
202
|
- - ">="
|
205
203
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
204
|
+
version: '0'
|
207
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
206
|
requirements:
|
209
207
|
- - ">="
|
210
208
|
- !ruby/object:Gem::Version
|
211
209
|
version: '0'
|
212
210
|
requirements: []
|
213
|
-
|
214
|
-
|
215
|
-
signing_key:
|
211
|
+
rubygems_version: 3.4.8
|
212
|
+
signing_key:
|
216
213
|
specification_version: 4
|
217
214
|
summary: An LL(1) parser generator for Ruby.
|
218
215
|
test_files: []
|
219
|
-
has_rdoc: yard
|
data/doc/DCO.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# Developer's Certificate of Origin 1.0
|
2
|
-
|
3
|
-
By making a contribution to this project, I certify that:
|
4
|
-
|
5
|
-
1. The contribution was created in whole or in part by me and I
|
6
|
-
have the right to submit it under the open source license
|
7
|
-
indicated in the file LICENSE; or
|
8
|
-
|
9
|
-
2. The contribution is based upon previous work that, to the best
|
10
|
-
of my knowledge, is covered under an appropriate open source
|
11
|
-
license and I have the right under that license to submit that
|
12
|
-
work with modifications, whether created in whole or in part
|
13
|
-
by me, under the same open source license (unless I am
|
14
|
-
permitted to submit under a different license), as indicated
|
15
|
-
in the file LICENSE; or
|
16
|
-
|
17
|
-
3. The contribution was provided directly to me by some other
|
18
|
-
person who certified (1), (2) or (3) and I have not modified
|
19
|
-
it.
|
20
|
-
|
21
|
-
4. I understand and agree that this project and the contribution
|
22
|
-
are public and that a record of the contribution (including all
|
23
|
-
personal information I submit with it, including my sign-off) is
|
24
|
-
maintained indefinitely and may be redistributed consistent with
|
25
|
-
this project or the open source license(s) involved.
|
data/lib/ll/bootstrap/parser.rb
DELETED
@@ -1,326 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.4.12
|
4
|
-
# from Racc grammer file "".
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'racc/parser.rb'
|
8
|
-
module LL
|
9
|
-
module Bootstrap
|
10
|
-
class Parser < Racc::Parser
|
11
|
-
|
12
|
-
##
|
13
|
-
# @see [LL::Lexer#initialize]
|
14
|
-
#
|
15
|
-
def initialize(*args)
|
16
|
-
@lexer = Lexer.new(*args)
|
17
|
-
end
|
18
|
-
|
19
|
-
##
|
20
|
-
# Yields the next token from the lexer.
|
21
|
-
#
|
22
|
-
# @yieldparam [Array]
|
23
|
-
#
|
24
|
-
def yield_next_token
|
25
|
-
@lexer.advance do |token|
|
26
|
-
yield [token.type, token]
|
27
|
-
end
|
28
|
-
|
29
|
-
yield [false, false]
|
30
|
-
end
|
31
|
-
|
32
|
-
##
|
33
|
-
# @see [LL::AST::Node#initialize]
|
34
|
-
# @return [LL::AST::Node]
|
35
|
-
#
|
36
|
-
def s(*args)
|
37
|
-
return AST::Node.new(*args)
|
38
|
-
end
|
39
|
-
|
40
|
-
##
|
41
|
-
# Parses the input and returns the corresponding AST.
|
42
|
-
#
|
43
|
-
# @return [LL::AST::Node]
|
44
|
-
#
|
45
|
-
def parse
|
46
|
-
return yyparse(self, :yield_next_token)
|
47
|
-
end
|
48
|
-
|
49
|
-
# vim: set ft=racc:
|
50
|
-
##### State transition tables begin ###
|
51
|
-
|
52
|
-
racc_action_table = [
|
53
|
-
14, 28, 16, 14, 26, 29, 10, 11, 12, 13,
|
54
|
-
14, 10, 11, 12, 13, 14, 14, 14, 14, 22,
|
55
|
-
33, 33, 22, 24, 25, 37, 38, 14, 22, 40,
|
56
|
-
41, 14, 28 ]
|
57
|
-
|
58
|
-
racc_action_check = [
|
59
|
-
19, 18, 1, 10, 18, 19, 0, 0, 0, 0,
|
60
|
-
0, 2, 2, 2, 2, 2, 24, 40, 11, 12,
|
61
|
-
24, 40, 13, 15, 16, 27, 28, 31, 34, 35,
|
62
|
-
36, 38, 42 ]
|
63
|
-
|
64
|
-
racc_action_pointer = [
|
65
|
-
3, 2, 8, nil, nil, nil, nil, nil, nil, nil,
|
66
|
-
-4, 11, 17, 20, nil, 15, 24, nil, -8, -7,
|
67
|
-
nil, nil, nil, nil, 9, nil, nil, 13, 17, nil,
|
68
|
-
nil, 20, nil, nil, 26, 19, 18, nil, 24, nil,
|
69
|
-
10, nil, 23, nil, nil ]
|
70
|
-
|
71
|
-
racc_action_default = [
|
72
|
-
-2, -30, -1, -4, -5, -6, -7, -8, -9, -10,
|
73
|
-
-30, -30, -30, -30, -20, -30, -30, -3, -30, -30,
|
74
|
-
-18, -16, -29, -17, -30, 45, -11, -30, -30, -15,
|
75
|
-
-19, -21, -22, -23, -24, -26, -30, -12, -30, -25,
|
76
|
-
-30, -28, -13, -27, -14 ]
|
77
|
-
|
78
|
-
racc_goto_table = [
|
79
|
-
15, 27, 15, 1, 21, 23, 36, 3, 2, 17,
|
80
|
-
18, 19, nil, nil, nil, nil, nil, nil, nil, 30,
|
81
|
-
nil, nil, 43, nil, nil, 44, 39, nil, nil, nil,
|
82
|
-
nil, 30, nil, nil, nil, nil, nil, nil, 42 ]
|
83
|
-
|
84
|
-
racc_goto_check = [
|
85
|
-
10, 11, 10, 1, 13, 13, 17, 3, 2, 3,
|
86
|
-
10, 12, nil, nil, nil, nil, nil, nil, nil, 10,
|
87
|
-
nil, nil, 17, nil, nil, 11, 13, nil, nil, nil,
|
88
|
-
nil, 10, nil, nil, nil, nil, nil, nil, 10 ]
|
89
|
-
|
90
|
-
racc_goto_pointer = [
|
91
|
-
nil, 3, 8, 7, nil, nil, nil, nil, nil, nil,
|
92
|
-
0, -17, 0, -8, nil, nil, nil, -18 ]
|
93
|
-
|
94
|
-
racc_goto_default = [
|
95
|
-
nil, nil, nil, nil, 4, 5, 6, 7, 8, 9,
|
96
|
-
20, nil, 31, nil, 34, 32, 35, nil ]
|
97
|
-
|
98
|
-
racc_reduce_table = [
|
99
|
-
0, 0, :racc_error,
|
100
|
-
1, 14, :_reduce_1,
|
101
|
-
0, 14, :_reduce_2,
|
102
|
-
2, 15, :_reduce_3,
|
103
|
-
1, 15, :_reduce_4,
|
104
|
-
1, 16, :_reduce_none,
|
105
|
-
1, 16, :_reduce_none,
|
106
|
-
1, 17, :_reduce_none,
|
107
|
-
1, 17, :_reduce_none,
|
108
|
-
1, 17, :_reduce_none,
|
109
|
-
1, 17, :_reduce_none,
|
110
|
-
3, 19, :_reduce_11,
|
111
|
-
4, 19, :_reduce_12,
|
112
|
-
3, 24, :_reduce_13,
|
113
|
-
4, 24, :_reduce_14,
|
114
|
-
3, 20, :_reduce_15,
|
115
|
-
2, 21, :_reduce_16,
|
116
|
-
2, 22, :_reduce_17,
|
117
|
-
1, 25, :_reduce_18,
|
118
|
-
2, 25, :_reduce_19,
|
119
|
-
1, 23, :_reduce_20,
|
120
|
-
1, 27, :_reduce_21,
|
121
|
-
1, 27, :_reduce_22,
|
122
|
-
1, 28, :_reduce_23,
|
123
|
-
1, 29, :_reduce_24,
|
124
|
-
2, 29, :_reduce_25,
|
125
|
-
1, 30, :_reduce_26,
|
126
|
-
3, 30, :_reduce_27,
|
127
|
-
4, 18, :_reduce_28,
|
128
|
-
1, 26, :_reduce_29 ]
|
129
|
-
|
130
|
-
racc_reduce_n = 30
|
131
|
-
|
132
|
-
racc_shift_n = 45
|
133
|
-
|
134
|
-
racc_token_table = {
|
135
|
-
false => 0,
|
136
|
-
:error => 1,
|
137
|
-
:T_RUBY => 2,
|
138
|
-
:T_NAME => 3,
|
139
|
-
:T_TERMINALS => 4,
|
140
|
-
:T_INNER => 5,
|
141
|
-
:T_HEADER => 6,
|
142
|
-
:T_IDENT => 7,
|
143
|
-
:T_EQUALS => 8,
|
144
|
-
:T_COLON => 9,
|
145
|
-
:T_PIPE => 10,
|
146
|
-
:T_EPSILON => 11,
|
147
|
-
:T_SEMICOLON => 12 }
|
148
|
-
|
149
|
-
racc_nt_base = 13
|
150
|
-
|
151
|
-
racc_use_result_var = false
|
152
|
-
|
153
|
-
Racc_arg = [
|
154
|
-
racc_action_table,
|
155
|
-
racc_action_check,
|
156
|
-
racc_action_default,
|
157
|
-
racc_action_pointer,
|
158
|
-
racc_goto_table,
|
159
|
-
racc_goto_check,
|
160
|
-
racc_goto_default,
|
161
|
-
racc_goto_pointer,
|
162
|
-
racc_nt_base,
|
163
|
-
racc_reduce_table,
|
164
|
-
racc_token_table,
|
165
|
-
racc_shift_n,
|
166
|
-
racc_reduce_n,
|
167
|
-
racc_use_result_var ]
|
168
|
-
|
169
|
-
Racc_token_to_s_table = [
|
170
|
-
"$end",
|
171
|
-
"error",
|
172
|
-
"T_RUBY",
|
173
|
-
"T_NAME",
|
174
|
-
"T_TERMINALS",
|
175
|
-
"T_INNER",
|
176
|
-
"T_HEADER",
|
177
|
-
"T_IDENT",
|
178
|
-
"T_EQUALS",
|
179
|
-
"T_COLON",
|
180
|
-
"T_PIPE",
|
181
|
-
"T_EPSILON",
|
182
|
-
"T_SEMICOLON",
|
183
|
-
"$start",
|
184
|
-
"grammar",
|
185
|
-
"elements",
|
186
|
-
"element",
|
187
|
-
"directive",
|
188
|
-
"rule",
|
189
|
-
"name",
|
190
|
-
"terminals",
|
191
|
-
"inner",
|
192
|
-
"header",
|
193
|
-
"ident",
|
194
|
-
"name_ns",
|
195
|
-
"idents",
|
196
|
-
"ruby",
|
197
|
-
"idents_or_epsilon",
|
198
|
-
"epsilon",
|
199
|
-
"branch",
|
200
|
-
"branches" ]
|
201
|
-
|
202
|
-
Racc_debug_parser = false
|
203
|
-
|
204
|
-
##### State transition tables end #####
|
205
|
-
|
206
|
-
# reduce 0 omitted
|
207
|
-
|
208
|
-
def _reduce_1(val, _values)
|
209
|
-
s(:grammar, val[0])
|
210
|
-
end
|
211
|
-
|
212
|
-
def _reduce_2(val, _values)
|
213
|
-
s(:grammar)
|
214
|
-
end
|
215
|
-
|
216
|
-
def _reduce_3(val, _values)
|
217
|
-
val[0] << val[1]
|
218
|
-
end
|
219
|
-
|
220
|
-
def _reduce_4(val, _values)
|
221
|
-
val
|
222
|
-
end
|
223
|
-
|
224
|
-
# reduce 5 omitted
|
225
|
-
|
226
|
-
# reduce 6 omitted
|
227
|
-
|
228
|
-
# reduce 7 omitted
|
229
|
-
|
230
|
-
# reduce 8 omitted
|
231
|
-
|
232
|
-
# reduce 9 omitted
|
233
|
-
|
234
|
-
# reduce 10 omitted
|
235
|
-
|
236
|
-
def _reduce_11(val, _values)
|
237
|
-
s(:name, [val[1]], :source_line => val[0].source_line)
|
238
|
-
|
239
|
-
end
|
240
|
-
|
241
|
-
def _reduce_12(val, _values)
|
242
|
-
s(:name, [val[1], *val[2]], :source_line => val[0].source_line)
|
243
|
-
|
244
|
-
end
|
245
|
-
|
246
|
-
def _reduce_13(val, _values)
|
247
|
-
[val[2]]
|
248
|
-
end
|
249
|
-
|
250
|
-
def _reduce_14(val, _values)
|
251
|
-
[val[2]] + val[3]
|
252
|
-
end
|
253
|
-
|
254
|
-
def _reduce_15(val, _values)
|
255
|
-
s(:terminals, val[1], :source_line => val[0].source_line)
|
256
|
-
|
257
|
-
end
|
258
|
-
|
259
|
-
def _reduce_16(val, _values)
|
260
|
-
s(:inner, [val[1]], :source_line => val[0].source_line)
|
261
|
-
end
|
262
|
-
|
263
|
-
def _reduce_17(val, _values)
|
264
|
-
s(:header, [val[1]], :source_line => val[0].source_line)
|
265
|
-
end
|
266
|
-
|
267
|
-
def _reduce_18(val, _values)
|
268
|
-
val
|
269
|
-
end
|
270
|
-
|
271
|
-
def _reduce_19(val, _values)
|
272
|
-
val[0] << val[1]
|
273
|
-
end
|
274
|
-
|
275
|
-
def _reduce_20(val, _values)
|
276
|
-
s(:ident, [val[0].value], :source_line => val[0].source_line)
|
277
|
-
end
|
278
|
-
|
279
|
-
def _reduce_21(val, _values)
|
280
|
-
s(:steps, val[0], :source_line => val[0][0].source_line)
|
281
|
-
|
282
|
-
end
|
283
|
-
|
284
|
-
def _reduce_22(val, _values)
|
285
|
-
s(:steps, [val[0]], :source_line => val[0].source_line)
|
286
|
-
|
287
|
-
end
|
288
|
-
|
289
|
-
def _reduce_23(val, _values)
|
290
|
-
s(:epsilon, [], :source_line => val[0].source_line)
|
291
|
-
end
|
292
|
-
|
293
|
-
def _reduce_24(val, _values)
|
294
|
-
s(:branch, [val[0]], :source_line => val[0].source_line)
|
295
|
-
|
296
|
-
end
|
297
|
-
|
298
|
-
def _reduce_25(val, _values)
|
299
|
-
s(:branch, [val[0], val[1]], :source_line => val[0].source_line)
|
300
|
-
|
301
|
-
end
|
302
|
-
|
303
|
-
def _reduce_26(val, _values)
|
304
|
-
val
|
305
|
-
end
|
306
|
-
|
307
|
-
def _reduce_27(val, _values)
|
308
|
-
[val[0]] + val[2]
|
309
|
-
end
|
310
|
-
|
311
|
-
def _reduce_28(val, _values)
|
312
|
-
s(:rule, [val[0], *val[2]], :source_line => val[0].source_line)
|
313
|
-
|
314
|
-
end
|
315
|
-
|
316
|
-
def _reduce_29(val, _values)
|
317
|
-
s(:ruby, [val[0].value], :source_line => val[0].source_line)
|
318
|
-
end
|
319
|
-
|
320
|
-
def _reduce_none(val, _values)
|
321
|
-
val[0]
|
322
|
-
end
|
323
|
-
|
324
|
-
end # class Parser
|
325
|
-
end # module Bootstrap
|
326
|
-
end # module LL
|