pegex 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/tree.tml ADDED
@@ -0,0 +1,449 @@
1
+ === Single Regex - Single Capture
2
+ --- grammar
3
+ a: /x*(y*)z*<EOL>/
4
+ --- input
5
+ xxxyyyyzzz
6
+ --- tree
7
+ yyyy
8
+ --- wrap
9
+ a: yyyy
10
+
11
+ === Single Regex - Multi Capture
12
+ --- grammar
13
+ a: /(x*)(y*)(z*)<EOL>/
14
+ --- input
15
+ xxxyyyyzzz
16
+ --- tree
17
+ - xxx
18
+ - yyyy
19
+ - zzz
20
+ --- wrap
21
+ a:
22
+ - xxx
23
+ - yyyy
24
+ - zzz
25
+
26
+ === Multi Group Regex
27
+ --- grammar
28
+ t: /.*(x).*(y).*(z).*/
29
+ --- input: aaaxbbbyccczddd
30
+ --- tree
31
+ - x
32
+ - y
33
+ - z
34
+ --- wrap
35
+ t:
36
+ - x
37
+ - y
38
+ - z
39
+
40
+ === Single Regex - No Capture
41
+ --- grammar
42
+ a: /x*y*z*<EOL>/
43
+ --- input
44
+ xxxyyyyzzz
45
+ --- tree
46
+ []
47
+ --- wrap
48
+ a: []
49
+
50
+ === Non capture Regex
51
+ --- grammar
52
+ a: <b> <b>* -<c>* .<d>*
53
+ b: /b/
54
+ c: /c+/
55
+ d: /d/
56
+ --- input: bbccdd
57
+ --- tree
58
+ - []
59
+ - []
60
+ --- wrapSKIP
61
+ a:
62
+ - []
63
+ - []
64
+
65
+ === A subrule
66
+ --- SKIP
67
+ --- grammar
68
+ a: <b> /(y+)/ <EOL>
69
+ b: /(x+)/
70
+ --- input
71
+ xxxyyyy
72
+ --- tree
73
+ - xxx
74
+ - yyyy
75
+ --- wrap
76
+ a:
77
+ - b: xxx
78
+ - yyyy
79
+
80
+ === Multi match regex in subrule
81
+ --- grammar
82
+ a: <b>
83
+ b: /(x*)y*(z*)<EOL>/
84
+ --- input
85
+ xxxyyyyzzz
86
+ --- tree
87
+ - xxx
88
+ - zzz
89
+ --- wrap
90
+ a:
91
+ b:
92
+ - xxx
93
+ - zzz
94
+
95
+ === Any rule group
96
+ --- grammar
97
+ a: ( <b> | <c> )
98
+ b: /(bleh)/
99
+ c: /(x*)y*(z*)<EOL>?/
100
+ --- input
101
+ xxxyyyyzzz
102
+ --- tree
103
+ - xxx
104
+ - zzz
105
+ --- wrap
106
+ a:
107
+ c:
108
+ - xxx
109
+ - zzz
110
+
111
+ === + Modifier
112
+ --- SKIP
113
+ --- grammar
114
+ a: ( b c )+ <EOL>
115
+ b: /(x*)/
116
+ c: /(y+)/
117
+ --- input
118
+ xxyyxy
119
+ --- tree
120
+ - - - xx
121
+ - yy
122
+ - - x
123
+ - y
124
+ --- wrap
125
+ a:
126
+ - - - b: xx
127
+ - c: yy
128
+ - - b: x
129
+ - c: y
130
+
131
+ === Wrap Pass and Skip
132
+ --- grammar
133
+ a: +<b> -<c> .<d>
134
+ b: /(b+)/
135
+ c: /(c+)/
136
+ d: /(d+)/
137
+ --- input: bbccdd
138
+ --- tree
139
+ - b: bb
140
+ - cc
141
+ --- wrap
142
+ a:
143
+ - b: bb
144
+ - cc
145
+
146
+ === Pass and Skip Multi
147
+ --- grammar
148
+ a: <b>* -<c>* .<d>*
149
+ b: /(b)/
150
+ c: /(c)/
151
+ d: /(d)/
152
+ --- input: bccdd
153
+ --- tree
154
+ - - b
155
+ - - c
156
+ - c
157
+ --- wrap
158
+ a:
159
+ - - b: b
160
+ - - c
161
+ - c
162
+
163
+ === Skip Bracketed
164
+ --- grammar
165
+ a: <b> .( <c> <d> )
166
+ b: /(b)/
167
+ c: /(c+)/
168
+ d: /(d+)/
169
+ --- input: bcccd
170
+ --- tree
171
+ b
172
+ --- wrap
173
+ a:
174
+ b: b
175
+
176
+ === Assertions
177
+ --- grammar
178
+ a: !<b> =<c> <c>
179
+ b: /b/
180
+ c: /(c+)/
181
+ --- input: ccc
182
+ --- tree
183
+ ccc
184
+ --- wrap
185
+ a:
186
+ c: ccc
187
+
188
+ === Assertion not captured
189
+ --- SKIP
190
+ --- grammar
191
+ a: =x x y EOL
192
+ x: /(x+)/
193
+ y: /(y+)/
194
+ --- input
195
+ xxxyyyy
196
+ --- tree
197
+ - xxx
198
+ - yyyy
199
+ --- wrap
200
+ a:
201
+ - x: xxx
202
+ - y: yyyy
203
+
204
+ === Empty regex group plus rule
205
+ --- SKIP
206
+ --- grammar
207
+ a: <b>* <c> <EOL>
208
+ b: /xxx/
209
+ c: /(yyy)/
210
+ --- input
211
+ xxxyyy
212
+ --- tree
213
+ - []
214
+ - yyy
215
+ --- wrap
216
+ a:
217
+ - []
218
+ - c: yyy
219
+
220
+ === Rule to Rule to Rule
221
+ --- SKIP
222
+ --- grammar
223
+ a: <b>
224
+ b: <c>*
225
+ c: <d> <EOL>
226
+ d: /x(y)z/
227
+ --- input
228
+ xyz
229
+ xyz
230
+ --- tree
231
+ - - y
232
+ - - y
233
+ --- wrap
234
+ a:
235
+ b:
236
+ - c:
237
+ - d: y
238
+ - c:
239
+ - d: y
240
+
241
+ === List and Separators
242
+ --- grammar
243
+ a: <b> <c>+ % <d>
244
+ b: /(b)/
245
+ c: /(c+)/
246
+ d: /(d+)/
247
+ --- input: bcccdccddc
248
+ --- tree
249
+ - b
250
+ - - ccc
251
+ - d
252
+ - cc
253
+ - dd
254
+ - c
255
+ --- wrap
256
+ a:
257
+ - b: b
258
+ - - c: ccc
259
+ - d: d
260
+ - c: cc
261
+ - d: dd
262
+ - c: c
263
+
264
+ === Rule with Separator
265
+ --- SKIP
266
+ --- grammar
267
+ a: <c>* % <d>
268
+ c: /(c+)/
269
+ d: /d+/
270
+ --- input: cccdccddc
271
+ --- tree
272
+ - ccc
273
+ - cc
274
+ - c
275
+ --- wrap
276
+ a:
277
+ - c: ccc
278
+ - c: cc
279
+ - c: c
280
+
281
+ === List without Separators
282
+ --- grammar
283
+ a: <b> <c>* % <d> <b>
284
+ b: /(b)/
285
+ c: /(c+)/
286
+ d: /d+/
287
+ --- input: bb
288
+ --- tree
289
+ - b
290
+ - []
291
+ - b
292
+ --- wrap
293
+ a:
294
+ - b: b
295
+ - []
296
+ - b: b
297
+
298
+ === Whitespace Matchers
299
+ --- grammar
300
+ TOP: /<ws>*(<DOT>)~(<DOT>*)~/
301
+ --- input
302
+ .
303
+ ..
304
+
305
+ --- tree
306
+ - .
307
+ - ..
308
+ --- wrap
309
+ TOP:
310
+ - .
311
+ - ..
312
+
313
+ === Automatically Pass TOP
314
+ --- grammar
315
+ b: /(b)/
316
+ TOP: <b> <c>*
317
+ c: /(c)/
318
+ --- input: bcc
319
+ --- tree
320
+ - b
321
+ - - c
322
+ - c
323
+ --- wrap
324
+ TOP:
325
+ - b: b
326
+ - - c: c
327
+ - c: c
328
+
329
+ === Empty Stars
330
+ --- grammar
331
+ a: ( <b>* <c> )+ <b>*
332
+ b: /(b)/
333
+ c: /(c+)/
334
+ --- input: cc
335
+ --- tree
336
+ - - - []
337
+ - cc
338
+ - []
339
+ --- wrap
340
+ a:
341
+ - - - []
342
+ - c: cc
343
+ - []
344
+
345
+ === Exact Quantifier
346
+ --- grammar
347
+ a: <b>3
348
+ b: /(b)/
349
+ --- input: bbb
350
+ --- tree
351
+ - b
352
+ - b
353
+ - b
354
+ --- wrap
355
+ a:
356
+ - b: b
357
+ - b: b
358
+ - b: b
359
+
360
+ === Quantifier with Separator
361
+ --- grammar
362
+ a: <b>2-4 %% /,/
363
+ b: /(b)/
364
+ --- input: b,b,b,
365
+ --- tree
366
+ - b
367
+ - b
368
+ - b
369
+ --- wrap
370
+ a:
371
+ - b: b
372
+ - b: b
373
+ - b: b
374
+
375
+ === Quantifier with Separator, Trailing OK
376
+ --- grammar
377
+ a: <b>2-4 %% /,/
378
+ b: /(b)/
379
+ --- input: b,b,b,
380
+ --- tree
381
+ - b
382
+ - b
383
+ - b
384
+ --- wrap
385
+ a:
386
+ - b: b
387
+ - b: b
388
+ - b: b
389
+
390
+ === Quantifier on the Separator
391
+ --- SKIP
392
+ --- grammar
393
+ a: <b>2-4 %% <c>*
394
+ b: /(b)/
395
+ c: /<COMMA>/
396
+ --- input: b,b,,,,bb,
397
+ --- tree
398
+ - b
399
+ - b
400
+ - b
401
+ - b
402
+ --- wrap
403
+ a:
404
+ - b: b
405
+ - b: b
406
+ - b: b
407
+ - b: b
408
+
409
+ === Tilde matching
410
+ --- grammar
411
+ a: ~ <b> ~~ <b>+
412
+ b: /(b)/
413
+ c: /<COMMA>/
414
+ --- input: b bb
415
+ --- tree
416
+ - b
417
+ - - b
418
+ - b
419
+ --- wrap
420
+ a:
421
+ - b: b
422
+ - - b: b
423
+ - b: b
424
+
425
+ # TODO - deal with psych null output
426
+ === False Values
427
+ --- grammar
428
+ a: <zero> <empty> <undef>
429
+ zero: /(b+)/
430
+ empty: /(c+)/
431
+ undef: /(d+)/
432
+ --- input: bbccdd
433
+ --- ast
434
+ - 0
435
+ - ''
436
+ -
437
+
438
+ === Wrap
439
+ --- grammar
440
+ a: <b> <c> <d>
441
+ b: /(b+)/
442
+ c: /(c+)/
443
+ d: /(d+)/
444
+ --- input: bbccdd
445
+ --- wrap
446
+ a:
447
+ - b: bb
448
+ - c: cc
449
+ - d: dd
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pegex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ingy döt Net
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: testml-lite
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.1
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.1
30
+ description: ! 'Pegex is a Acmeist parser framework. It allows you to easily create
31
+ parsers
32
+
33
+ that will work equivalently in lots of programming languages!
34
+
35
+ '
36
+ email: ingy@ingy.net
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - .gemspec
42
+ - CHANGELOG.yaml
43
+ - Gemfile
44
+ - Gemfile.lock
45
+ - LICENSE
46
+ - README.rdoc
47
+ - Rakefile
48
+ - lib/pegex.rb
49
+ - lib/pegex/compiler.rb
50
+ - lib/pegex/grammar.rb
51
+ - lib/pegex/grammar/atoms.rb
52
+ - lib/pegex/input.rb
53
+ - lib/pegex/parser.rb
54
+ - lib/pegex/pegex/ast.rb
55
+ - lib/pegex/pegex/grammar.rb
56
+ - lib/pegex/receiver.rb
57
+ - lib/pegex/tree.rb
58
+ - lib/pegex/tree/wrap.rb
59
+ - test/compiler-checks.rb
60
+ - test/compiler-checks.tml
61
+ - test/compiler-equivalence.rb
62
+ - test/compiler.rb
63
+ - test/compiler.tml
64
+ - test/error.rb
65
+ - test/export_ok.rb
66
+ - test/grammar-api.rb
67
+ - test/lib/recursive_sort.rb
68
+ - test/lib/test_pegex.rb
69
+ - test/lib/testast.rb
70
+ - test/lib/xxx.rb
71
+ - test/tree-pegex.tml
72
+ - test/tree.rb
73
+ - test/tree.tml
74
+ homepage: http://pegex.org
75
+ licenses:
76
+ - MIT
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: 1.9.1
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 1.8.23
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Acmeist PEG Parsing Framework
99
+ test_files: []