parser 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.yardopts +16 -4
- data/Gemfile +0 -2
- data/README.md +5 -5
- data/Rakefile +5 -0
- data/doc/AST_FORMAT.md +200 -200
- data/doc/css/.gitkeep +0 -0
- data/doc/css/common.css +68 -0
- data/lib/parser/builders/default.rb +13 -3
- data/lib/parser/lexer.rl +2 -2
- data/lib/parser/source/range.rb +1 -1
- data/lib/parser/version.rb +1 -1
- data/parser.gemspec +2 -1
- data/test/parse_helper.rb +4 -4
- data/test/test_lexer.rb +4 -3
- data/test/test_parser.rb +10 -0
- data/test/test_source_range.rb +8 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d8bc198add0c9c9e021a8181852b1181acb18b
|
4
|
+
data.tar.gz: 8f88c887edf5beec84bffaf73eaf010067d1b311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aab5ebeaf4117abc466c56bf10a69398e426a6976cb23f013a4629a40ef28692bd2a001fff899a755b932ff83e47ec220e4935d8f51fde456a2b632c171ebfc
|
7
|
+
data.tar.gz: 231b1dcb3345a4b692fd2f4e9efb50f4d836a848cd0ce9002b6b99a06c6345767bb3cce4ea299ea76990a858c1e7eaebcbbd4ef9a23e57e6d11d90b6114f9c09
|
data/.gitignore
CHANGED
data/.yardopts
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
-
|
4
|
-
-
|
1
|
+
./lib/parser/**/*.rb ./lib/parser.rb
|
2
|
+
-m markdown
|
3
|
+
-M kramdown
|
4
|
+
-o ./yardoc
|
5
|
+
-r ./README.md
|
6
|
+
--private
|
7
|
+
--protected
|
8
|
+
--asset ./doc/css/common.css:css/common.css
|
9
|
+
--verbose
|
10
|
+
--exclude lib/parser/ruby18.rb
|
11
|
+
--exclude lib/parser/ruby19.rb
|
12
|
+
--exclude lib/parser/ruby20.rb
|
13
|
+
--exclude lib/parser/ruby21.rb
|
14
|
+
-
|
15
|
+
./doc/*.md
|
16
|
+
LICENSE.txt
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Code Climate](https://codeclimate.com/github/whitequark/parser.png)](https://codeclimate.com/github/whitequark/parser)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/whitequark/parser/badge.png?branch=master)](https://coveralls.io/r/whitequark/parser)
|
6
6
|
|
7
|
-
_Parser_ is a Ruby parser written in pure Ruby.
|
7
|
+
_Parser_ is a production-ready Ruby parser written in pure Ruby. It performs on par or better than Ripper, Melbourne, JRubyParser or ruby_parser.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -14,18 +14,18 @@ _Parser_ is a Ruby parser written in pure Ruby.
|
|
14
14
|
|
15
15
|
Parse a chunk of code:
|
16
16
|
|
17
|
-
|
17
|
+
~~~ ruby
|
18
18
|
require 'parser/ruby20'
|
19
19
|
|
20
20
|
p Parser::Ruby20.parse("2 + 2")
|
21
21
|
# (send
|
22
22
|
# (int 2) :+
|
23
23
|
# (int 2))
|
24
|
-
|
24
|
+
~~~
|
25
25
|
|
26
26
|
Parse a chunk of code and display all diagnostics:
|
27
27
|
|
28
|
-
|
28
|
+
~~~ ruby
|
29
29
|
parser = Parser::Ruby20.new
|
30
30
|
parser.diagnostics.consumer = lambda do |diag|
|
31
31
|
puts diag.render
|
@@ -41,7 +41,7 @@ p parser.parse(buffer)
|
|
41
41
|
# (send nil :foo
|
42
42
|
# (splat
|
43
43
|
# (send nil :bar)))
|
44
|
-
|
44
|
+
~~~
|
45
45
|
|
46
46
|
If you reuse the same parser object for multiple `#parse` runs, you need to `#reset` it.
|
47
47
|
|
data/Rakefile
CHANGED
data/doc/AST_FORMAT.md
CHANGED
@@ -15,7 +15,7 @@ AST and Source Location RFC
|
|
15
15
|
|
16
16
|
Format:
|
17
17
|
|
18
|
-
|
18
|
+
~~~
|
19
19
|
(true)
|
20
20
|
"true"
|
21
21
|
~~~~ expression
|
@@ -27,27 +27,27 @@ Format:
|
|
27
27
|
(nil)
|
28
28
|
"nil"
|
29
29
|
~~~ expression
|
30
|
-
|
30
|
+
~~~
|
31
31
|
|
32
32
|
### Integer
|
33
33
|
|
34
34
|
Format:
|
35
35
|
|
36
|
-
|
36
|
+
~~~
|
37
37
|
(int 123)
|
38
38
|
"123"
|
39
39
|
~~~ expression
|
40
|
-
|
40
|
+
~~~
|
41
41
|
|
42
42
|
### Float
|
43
43
|
|
44
44
|
Format:
|
45
45
|
|
46
|
-
|
46
|
+
~~~
|
47
47
|
(float 1.0)
|
48
48
|
"1.0"
|
49
49
|
~~~ expression
|
50
|
-
|
50
|
+
~~~
|
51
51
|
|
52
52
|
### String
|
53
53
|
|
@@ -55,24 +55,24 @@ Format:
|
|
55
55
|
|
56
56
|
Format:
|
57
57
|
|
58
|
-
|
58
|
+
~~~
|
59
59
|
(str "foo")
|
60
60
|
"'foo'"
|
61
61
|
^ begin
|
62
62
|
^ end
|
63
63
|
~~~~~ expresion
|
64
|
-
|
64
|
+
~~~
|
65
65
|
|
66
66
|
#### With interpolation
|
67
67
|
|
68
68
|
Format:
|
69
69
|
|
70
|
-
|
70
|
+
~~~
|
71
71
|
(dstr (str "foo") (lvar bar) (str "baz"))
|
72
72
|
'"foo#{bar}baz"'
|
73
73
|
^ begin ^ end
|
74
74
|
~~~~~~~~~~~~~~ expression
|
75
|
-
|
75
|
+
~~~
|
76
76
|
|
77
77
|
### Symbol
|
78
78
|
|
@@ -80,7 +80,7 @@ Format:
|
|
80
80
|
|
81
81
|
Format:
|
82
82
|
|
83
|
-
|
83
|
+
~~~
|
84
84
|
(sym :foo)
|
85
85
|
":foo"
|
86
86
|
~~~~ expresion
|
@@ -89,29 +89,29 @@ Format:
|
|
89
89
|
^ begin
|
90
90
|
^ end
|
91
91
|
~~~~~~ expression
|
92
|
-
|
92
|
+
~~~
|
93
93
|
|
94
94
|
#### With interpolation
|
95
95
|
|
96
96
|
Format:
|
97
97
|
|
98
|
-
|
98
|
+
~~~
|
99
99
|
(dsym (str "foo") (lvar bar) (str "baz"))
|
100
100
|
':"foo#{bar}baz"'
|
101
101
|
^ begin ^ end
|
102
102
|
~~~~~~~~~~~~~~~ expression
|
103
|
-
|
103
|
+
~~~
|
104
104
|
|
105
105
|
### Execute-string
|
106
106
|
|
107
107
|
Format:
|
108
108
|
|
109
|
-
|
109
|
+
~~~
|
110
110
|
(xstr (str "foo") (lvar bar))
|
111
111
|
"`foo#{bar}`"
|
112
112
|
^ begin ^ end
|
113
113
|
~~~~~~~~~~~ expression
|
114
|
-
|
114
|
+
~~~
|
115
115
|
|
116
116
|
### Regexp
|
117
117
|
|
@@ -119,22 +119,22 @@ Format:
|
|
119
119
|
|
120
120
|
Format:
|
121
121
|
|
122
|
-
|
122
|
+
~~~
|
123
123
|
(regopt :i :m)
|
124
124
|
"im"
|
125
125
|
~~ expression
|
126
|
-
|
126
|
+
~~~
|
127
127
|
|
128
128
|
#### Regexp
|
129
129
|
|
130
130
|
Format:
|
131
131
|
|
132
|
-
|
132
|
+
~~~
|
133
133
|
(regexp (str "foo") (lvar :bar) (regopt :i))
|
134
134
|
"/foo#{bar}/i"
|
135
135
|
^ begin ^ end
|
136
136
|
~~~~~~~~~~~ expression
|
137
|
-
|
137
|
+
~~~
|
138
138
|
|
139
139
|
### Array
|
140
140
|
|
@@ -142,12 +142,12 @@ Format:
|
|
142
142
|
|
143
143
|
Format:
|
144
144
|
|
145
|
-
|
145
|
+
~~~
|
146
146
|
(array (int 1) (int 2))
|
147
147
|
|
148
148
|
"[1, 2]"
|
149
149
|
~~~~~~ expression
|
150
|
-
|
150
|
+
~~~
|
151
151
|
|
152
152
|
#### Splat
|
153
153
|
|
@@ -155,24 +155,24 @@ Can also be used in argument lists: `foo(bar, *baz)`
|
|
155
155
|
|
156
156
|
Format:
|
157
157
|
|
158
|
-
|
158
|
+
~~~
|
159
159
|
(splat (lvar :foo))
|
160
160
|
"*foo"
|
161
161
|
^ operator
|
162
162
|
~~~~ expression
|
163
|
-
|
163
|
+
~~~
|
164
164
|
|
165
165
|
#### With interpolation
|
166
166
|
|
167
167
|
Format:
|
168
168
|
|
169
|
-
|
169
|
+
~~~
|
170
170
|
(array (int 1) (splat (lvar :foo)) (int 2))
|
171
171
|
|
172
172
|
"[1, *foo, 2]"
|
173
173
|
^ begin ^ end
|
174
174
|
~~~~~~~~~~~~ expression
|
175
|
-
|
175
|
+
~~~
|
176
176
|
|
177
177
|
### Hash
|
178
178
|
|
@@ -182,35 +182,35 @@ Format:
|
|
182
182
|
|
183
183
|
Format:
|
184
184
|
|
185
|
-
|
185
|
+
~~~
|
186
186
|
(pair (int 1) (int 2))
|
187
187
|
"1 => 2"
|
188
188
|
~~ operator
|
189
189
|
~~~~~~ expression
|
190
|
-
|
190
|
+
~~~
|
191
191
|
|
192
192
|
##### With label (1.9)
|
193
193
|
|
194
194
|
Format:
|
195
195
|
|
196
|
-
|
196
|
+
~~~
|
197
197
|
(pair (sym :answer) (int 42))
|
198
198
|
"answer: 42"
|
199
199
|
^ operator (pair)
|
200
200
|
~~~~~~ expression (sym)
|
201
201
|
~~~~~~~~~~ expression (pair)
|
202
|
-
|
202
|
+
~~~
|
203
203
|
|
204
204
|
#### Plain
|
205
205
|
|
206
206
|
Format:
|
207
207
|
|
208
|
-
|
208
|
+
~~~
|
209
209
|
(hash (pair (int 1) (int 2)) (pair (int 3) (int 4)))
|
210
210
|
"{1 => 2, 3 => 4}"
|
211
211
|
^ begin ^ end
|
212
212
|
~~~~~~~~~~~~~~~~ expression
|
213
|
-
|
213
|
+
~~~
|
214
214
|
|
215
215
|
#### Keyword splat (2.0)
|
216
216
|
|
@@ -218,23 +218,23 @@ Can also be used in argument lists: `foo(bar, **baz)`
|
|
218
218
|
|
219
219
|
Format:
|
220
220
|
|
221
|
-
|
221
|
+
~~~
|
222
222
|
(kwsplat (lvar :foo))
|
223
223
|
"**foo"
|
224
224
|
~~ operator
|
225
225
|
~~~~~ expression
|
226
|
-
|
226
|
+
~~~
|
227
227
|
|
228
228
|
#### With interpolation (2.0)
|
229
229
|
|
230
230
|
Format:
|
231
231
|
|
232
|
-
|
232
|
+
~~~
|
233
233
|
(hash (pair (sym :foo) (int 2)) (kwsplat (lvar :bar)))
|
234
234
|
"{ foo: 2, **bar }"
|
235
235
|
^ begin ^ end
|
236
236
|
~~~~~~~~~~~~~~~~~ expression
|
237
|
-
|
237
|
+
~~~
|
238
238
|
|
239
239
|
### Range
|
240
240
|
|
@@ -242,23 +242,23 @@ Format:
|
|
242
242
|
|
243
243
|
Format:
|
244
244
|
|
245
|
-
|
245
|
+
~~~
|
246
246
|
(irange (int 1) (int 2))
|
247
247
|
"1..2"
|
248
248
|
~~ operator
|
249
249
|
~~~~ expression
|
250
|
-
|
250
|
+
~~~
|
251
251
|
|
252
252
|
#### Exclusive
|
253
253
|
|
254
254
|
Format:
|
255
255
|
|
256
|
-
|
256
|
+
~~~
|
257
257
|
(erange (int 1) (int 2))
|
258
258
|
"1...2"
|
259
259
|
~~~ operator
|
260
260
|
~~~~~ expression
|
261
|
-
|
261
|
+
~~~
|
262
262
|
|
263
263
|
## Access
|
264
264
|
|
@@ -266,51 +266,51 @@ Format:
|
|
266
266
|
|
267
267
|
Format:
|
268
268
|
|
269
|
-
|
269
|
+
~~~
|
270
270
|
(self)
|
271
271
|
"self"
|
272
272
|
~~~~ expression
|
273
|
-
|
273
|
+
~~~
|
274
274
|
|
275
275
|
### Local variable
|
276
276
|
|
277
277
|
Format:
|
278
278
|
|
279
|
-
|
279
|
+
~~~
|
280
280
|
(lvar :foo)
|
281
281
|
"foo"
|
282
282
|
~~~ expression
|
283
|
-
|
283
|
+
~~~
|
284
284
|
|
285
285
|
### Instance variable
|
286
286
|
|
287
287
|
Format:
|
288
288
|
|
289
|
-
|
289
|
+
~~~
|
290
290
|
(ivar :@foo)
|
291
291
|
"@foo"
|
292
292
|
~~~~ expression
|
293
|
-
|
293
|
+
~~~
|
294
294
|
|
295
295
|
### Class variable
|
296
296
|
|
297
297
|
Format:
|
298
298
|
|
299
|
-
|
299
|
+
~~~
|
300
300
|
(cvar :$foo)
|
301
301
|
"$foo"
|
302
302
|
~~~~ expression
|
303
|
-
|
303
|
+
~~~
|
304
304
|
|
305
305
|
### Global variable
|
306
306
|
|
307
307
|
Format:
|
308
308
|
|
309
|
-
|
309
|
+
~~~
|
310
310
|
(gvar :$foo)
|
311
311
|
"$foo"
|
312
312
|
~~~~ expression
|
313
|
-
|
313
|
+
~~~
|
314
314
|
|
315
315
|
### Constant
|
316
316
|
|
@@ -318,42 +318,42 @@ Format:
|
|
318
318
|
|
319
319
|
Format:
|
320
320
|
|
321
|
-
|
321
|
+
~~~
|
322
322
|
(const (cbase) :Foo)
|
323
323
|
"::Foo"
|
324
324
|
~~~ name
|
325
325
|
~~ double_colon
|
326
326
|
~~~~~ expression
|
327
|
-
|
327
|
+
~~~
|
328
328
|
|
329
329
|
#### Scoped constant
|
330
330
|
|
331
331
|
Format:
|
332
332
|
|
333
|
-
|
333
|
+
~~~
|
334
334
|
(const (lvar :a) :Foo)
|
335
335
|
"a::Foo"
|
336
336
|
~~~ name
|
337
337
|
~~ double_colon
|
338
338
|
~~~~~~ expression
|
339
|
-
|
339
|
+
~~~
|
340
340
|
|
341
341
|
#### Unscoped constant
|
342
342
|
|
343
343
|
Format:
|
344
344
|
|
345
|
-
|
345
|
+
~~~
|
346
346
|
(const nil :Foo)
|
347
347
|
"Foo"
|
348
348
|
~~~ name
|
349
349
|
~~~ expression
|
350
|
-
|
350
|
+
~~~
|
351
351
|
|
352
352
|
### defined?
|
353
353
|
|
354
354
|
Format:
|
355
355
|
|
356
|
-
|
356
|
+
~~~
|
357
357
|
(defined? (lvar :a))
|
358
358
|
"defined? a"
|
359
359
|
~~~~~~~~ keyword
|
@@ -364,7 +364,7 @@ Format:
|
|
364
364
|
^ begin
|
365
365
|
^ end
|
366
366
|
~~~~~~~~~~~ expression
|
367
|
-
|
367
|
+
~~~
|
368
368
|
|
369
369
|
## Assignment
|
370
370
|
|
@@ -372,23 +372,23 @@ Format:
|
|
372
372
|
|
373
373
|
Format:
|
374
374
|
|
375
|
-
|
375
|
+
~~~
|
376
376
|
(lvasgn :foo (lvar :bar))
|
377
377
|
"foo = bar"
|
378
378
|
^ operator
|
379
379
|
~~~~~~~~~ expression
|
380
|
-
|
380
|
+
~~~
|
381
381
|
|
382
382
|
### To instance variable
|
383
383
|
|
384
384
|
Format:
|
385
385
|
|
386
|
-
|
386
|
+
~~~
|
387
387
|
(ivasgn :@foo (lvar :bar))
|
388
388
|
"@foo = bar"
|
389
389
|
^ operator
|
390
390
|
~~~~~~~~~~ expression
|
391
|
-
|
391
|
+
~~~
|
392
392
|
|
393
393
|
### To class variable
|
394
394
|
|
@@ -396,34 +396,34 @@ Format:
|
|
396
396
|
|
397
397
|
Format:
|
398
398
|
|
399
|
-
|
399
|
+
~~~
|
400
400
|
(cvdecl :@@foo (lvar :bar))
|
401
401
|
"@@foo = bar"
|
402
402
|
^ operator
|
403
403
|
~~~~~~~~~~~ expression
|
404
|
-
|
404
|
+
~~~
|
405
405
|
|
406
406
|
#### Inside a method scope
|
407
407
|
|
408
408
|
Format:
|
409
409
|
|
410
|
-
|
410
|
+
~~~
|
411
411
|
(cvasgn :@@foo (lvar :bar))
|
412
412
|
"@@foo = bar"
|
413
413
|
^ operator
|
414
414
|
~~~~~~~~~~~ expression
|
415
|
-
|
415
|
+
~~~
|
416
416
|
|
417
417
|
### To global variable
|
418
418
|
|
419
419
|
Format:
|
420
420
|
|
421
|
-
|
421
|
+
~~~
|
422
422
|
(gvasgn :$foo (lvar :bar))
|
423
423
|
"$foo = bar"
|
424
424
|
^ operator
|
425
425
|
~~~~~~~~~~ expression
|
426
|
-
|
426
|
+
~~~
|
427
427
|
|
428
428
|
### To constant
|
429
429
|
|
@@ -431,37 +431,37 @@ Format:
|
|
431
431
|
|
432
432
|
Format:
|
433
433
|
|
434
|
-
|
434
|
+
~~~
|
435
435
|
(cdecl (cbase) :Foo (int 1))
|
436
436
|
"::Foo = 1"
|
437
437
|
~~~ name
|
438
438
|
~ operator
|
439
439
|
~~~~~~~ expression
|
440
|
-
|
440
|
+
~~~
|
441
441
|
|
442
442
|
#### Scoped constant
|
443
443
|
|
444
444
|
Format:
|
445
445
|
|
446
|
-
|
446
|
+
~~~
|
447
447
|
(cdecl (lvar :a) :Foo (int 1))
|
448
448
|
"a::Foo = 1"
|
449
449
|
~~~ name
|
450
450
|
~ operator
|
451
451
|
~~~~~~~~ expression
|
452
|
-
|
452
|
+
~~~
|
453
453
|
|
454
454
|
#### Unscoped constant
|
455
455
|
|
456
456
|
Format:
|
457
457
|
|
458
|
-
|
458
|
+
~~~
|
459
459
|
(cdecl nil :Foo (int 1))
|
460
460
|
"Foo = 1"
|
461
461
|
~~~ name
|
462
462
|
~ operator
|
463
463
|
~~~~~~~ expression
|
464
|
-
|
464
|
+
~~~
|
465
465
|
|
466
466
|
|
467
467
|
### Multiple assignment
|
@@ -470,7 +470,7 @@ Format:
|
|
470
470
|
|
471
471
|
Format:
|
472
472
|
|
473
|
-
|
473
|
+
~~~
|
474
474
|
(mlhs (lvasgn :a) (lvasgn :b))
|
475
475
|
"a, b"
|
476
476
|
~~~~ expression
|
@@ -478,7 +478,7 @@ Format:
|
|
478
478
|
^ begin
|
479
479
|
^ end
|
480
480
|
~~~~~~ expression
|
481
|
-
|
481
|
+
~~~
|
482
482
|
|
483
483
|
#### Assignment
|
484
484
|
|
@@ -490,7 +490,7 @@ assignments (`send`).
|
|
490
490
|
|
491
491
|
Format:
|
492
492
|
|
493
|
-
|
493
|
+
~~~
|
494
494
|
(masgn (mlhs (lvasgn :foo) (lvasgn :bar)) (array (int 1) (int 2)))
|
495
495
|
"foo, bar = 1, 2"
|
496
496
|
^ operator
|
@@ -504,7 +504,7 @@ Format:
|
|
504
504
|
|
505
505
|
(masgn (mlhs (send (self) :a=) (send (self) :[]= (int 1))) (lvar :a))
|
506
506
|
"self.a, self[1] = a"
|
507
|
-
|
507
|
+
~~~
|
508
508
|
|
509
509
|
### Binary operator-assignment
|
510
510
|
|
@@ -514,7 +514,7 @@ Binary operator-assignment features the same "incomplete assignments" and "incom
|
|
514
514
|
|
515
515
|
Format:
|
516
516
|
|
517
|
-
|
517
|
+
~~~
|
518
518
|
(op-asgn (lvasgn :a) :+ (int 1))
|
519
519
|
"a += 1"
|
520
520
|
~~ operator
|
@@ -522,22 +522,22 @@ Format:
|
|
522
522
|
|
523
523
|
(op-asgn (ivasgn :a) :+ (int 1))
|
524
524
|
"@a += 1"
|
525
|
-
|
525
|
+
~~~
|
526
526
|
|
527
527
|
Ruby_parser output for reference:
|
528
|
-
|
528
|
+
~~~
|
529
529
|
"a += 1"
|
530
530
|
s(:lasgn, :a, s(:call, s(:lvar, :a), :+, s(:int, 1)))
|
531
531
|
|
532
532
|
"@a += 1"
|
533
533
|
s(:iasgn, :@a, s(:call, s(:ivar, :@a), :+, s(:int, 1)))
|
534
|
-
|
534
|
+
~~~
|
535
535
|
|
536
536
|
#### Method binary operator-assignment
|
537
537
|
|
538
538
|
Format:
|
539
539
|
|
540
|
-
|
540
|
+
~~~
|
541
541
|
(op-asgn (send (ivar :@a) :b) :+ (int 1))
|
542
542
|
"@a.b += 1"
|
543
543
|
~ selector (send)
|
@@ -551,16 +551,16 @@ Format:
|
|
551
551
|
~~~~~~~~ expression (send)
|
552
552
|
~~ operator (op-asgn)
|
553
553
|
~~~~~~~~~~~~~ expression (op-asgn)
|
554
|
-
|
554
|
+
~~~
|
555
555
|
|
556
556
|
Ruby_parser output for reference:
|
557
|
-
|
557
|
+
~~~
|
558
558
|
"@a.b += 1"
|
559
559
|
s(:op_asgn2, s(:ivar, :@a), :b=, :+, s(:int, 1))
|
560
560
|
|
561
561
|
"@a[0, 1] += 1"
|
562
562
|
s(:op_asgn1, s(:ivar, :@a), s(:arglist, s(:int, 0), s(:int, 1)), :+, s(:int, 1))
|
563
|
-
|
563
|
+
~~~
|
564
564
|
|
565
565
|
### Logical operator-assignment
|
566
566
|
|
@@ -570,7 +570,7 @@ Logical operator-assignment features the same "incomplete assignments" and "inco
|
|
570
570
|
|
571
571
|
Format:
|
572
572
|
|
573
|
-
|
573
|
+
~~~
|
574
574
|
(or-asgn (iasgn :@a) (int 1))
|
575
575
|
"@a ||= 1"
|
576
576
|
~~~ operator
|
@@ -580,22 +580,22 @@ Format:
|
|
580
580
|
"a &&= 1"
|
581
581
|
~~~ operator
|
582
582
|
~~~~~~~ expression
|
583
|
-
|
583
|
+
~~~
|
584
584
|
|
585
585
|
Ruby_parser output for reference:
|
586
|
-
|
586
|
+
~~~
|
587
587
|
"@a ||= 1"
|
588
588
|
s(:op_asgn_or, s(:ivar, :@a), s(:iasgn, :@a, s(:int, 1)))
|
589
589
|
|
590
590
|
"a &&= 1"
|
591
591
|
s(:op_asgn_and, s(:lvar, :a), s(:lasgn, :a, s(:int, 1)))
|
592
|
-
|
592
|
+
~~~
|
593
593
|
|
594
594
|
#### Method logical operator-assignment
|
595
595
|
|
596
596
|
Format:
|
597
597
|
|
598
|
-
|
598
|
+
~~~
|
599
599
|
(or-asgn (send (ivar :@foo) :bar) (int 1))
|
600
600
|
"@foo.bar ||= 1"
|
601
601
|
~~~ selector (send)
|
@@ -617,17 +617,17 @@ Format:
|
|
617
617
|
~~~ operator (or-asgn)
|
618
618
|
~~~~~~~~~~~~~~~~ expression (or-asgn)
|
619
619
|
|
620
|
-
|
620
|
+
~~~
|
621
621
|
|
622
622
|
Ruby_parser output for reference:
|
623
|
-
|
623
|
+
~~~
|
624
624
|
"@foo.bar &&= 1"
|
625
625
|
s(:op_asgn2, s(:ivar, :@foo), :bar=, :"&&", s(:int, 1))
|
626
626
|
|
627
627
|
"@foo[0] ||= 1"
|
628
628
|
s(:op_asgn1, s(:ivar, :@foo), s(:arglist, s(:int, 0)), :"||", s(:int, 1))
|
629
629
|
|
630
|
-
|
630
|
+
~~~
|
631
631
|
|
632
632
|
## Class and module definition
|
633
633
|
|
@@ -635,18 +635,18 @@ s(:op_asgn1, s(:ivar, :@foo), s(:arglist, s(:int, 0)), :"||", s(:int, 1))
|
|
635
635
|
|
636
636
|
Format:
|
637
637
|
|
638
|
-
|
638
|
+
~~~
|
639
639
|
(module (const nil :Foo) (nil))
|
640
640
|
"module Foo; end"
|
641
641
|
~~~~~~ keyword
|
642
642
|
~~~ end
|
643
|
-
|
643
|
+
~~~
|
644
644
|
|
645
645
|
### Class
|
646
646
|
|
647
647
|
Format:
|
648
648
|
|
649
|
-
|
649
|
+
~~~
|
650
650
|
(class (const nil :Foo) (const nil :Bar) (nil))
|
651
651
|
"class Foo < Bar; end"
|
652
652
|
~~~~~ keyword ~~~ end
|
@@ -658,20 +658,20 @@ Format:
|
|
658
658
|
~~~~~ keyword
|
659
659
|
~~~ end
|
660
660
|
~~~~~~~~~~~~~~ expression
|
661
|
-
|
661
|
+
~~~
|
662
662
|
|
663
663
|
### Singleton class
|
664
664
|
|
665
665
|
Format:
|
666
666
|
|
667
|
-
|
667
|
+
~~~
|
668
668
|
(sclass (lvar :a) (nil))
|
669
669
|
"class << a; end"
|
670
670
|
~~~~~ keyword
|
671
671
|
~~ operator
|
672
672
|
~~~ end
|
673
673
|
~~~~~~~~~~~~~~~ expression
|
674
|
-
|
674
|
+
~~~
|
675
675
|
|
676
676
|
## Method (un)definition
|
677
677
|
|
@@ -679,38 +679,38 @@ Format:
|
|
679
679
|
|
680
680
|
Format:
|
681
681
|
|
682
|
-
|
682
|
+
~~~
|
683
683
|
(def :foo (args) nil)
|
684
684
|
"def foo; end"
|
685
685
|
~~~ keyword
|
686
686
|
~~~ name
|
687
687
|
~~~ end
|
688
688
|
~~~~~~~~~~~~ expression
|
689
|
-
|
689
|
+
~~~
|
690
690
|
|
691
691
|
### Singleton methods
|
692
692
|
|
693
693
|
Format:
|
694
694
|
|
695
|
-
|
695
|
+
~~~
|
696
696
|
(defs (self) (args) nil)
|
697
697
|
"def self.foo; end"
|
698
698
|
~~~ keyword
|
699
699
|
~~~ name
|
700
700
|
~~~ end
|
701
701
|
~~~~~~~~~~~~~~~~~ expression
|
702
|
-
|
702
|
+
~~~
|
703
703
|
|
704
704
|
### Undefinition
|
705
705
|
|
706
706
|
Format:
|
707
707
|
|
708
|
-
|
708
|
+
~~~
|
709
709
|
(undef (sym :foo) (sym :bar) (dsym (str "foo") (int 1)))
|
710
710
|
"undef foo :bar :"foo#{1}""
|
711
711
|
~~~~~ keyword
|
712
712
|
~~~~~~~~~~~~~~~~~~~~~~~~~ expression
|
713
|
-
|
713
|
+
~~~
|
714
714
|
|
715
715
|
## Aliasing
|
716
716
|
|
@@ -718,18 +718,18 @@ Format:
|
|
718
718
|
|
719
719
|
Format:
|
720
720
|
|
721
|
-
|
721
|
+
~~~
|
722
722
|
(alias (sym :foo) (dsym (str "foo") (int 1)))
|
723
723
|
"alias foo :"foo#{1}""
|
724
724
|
~~~~~ keyword
|
725
725
|
~~~~~~~~~~~~~~~~~~~~ expression
|
726
|
-
|
726
|
+
~~~
|
727
727
|
|
728
728
|
### Global variable aliasing
|
729
729
|
|
730
730
|
Format:
|
731
731
|
|
732
|
-
|
732
|
+
~~~
|
733
733
|
(alias (gvar :$foo) (gvar :$bar))
|
734
734
|
"alias $foo $bar"
|
735
735
|
~~~~~ keyword
|
@@ -739,51 +739,51 @@ Format:
|
|
739
739
|
"alias $foo $&"
|
740
740
|
~~~~~ keyword
|
741
741
|
~~~~~~~~~~~~~~~ expression
|
742
|
-
|
742
|
+
~~~
|
743
743
|
|
744
744
|
## Formal arguments
|
745
745
|
|
746
746
|
Format:
|
747
747
|
|
748
|
-
|
748
|
+
~~~
|
749
749
|
(args (arg :foo))
|
750
750
|
"(foo)"
|
751
751
|
~~~~~ expression
|
752
|
-
|
752
|
+
~~~
|
753
753
|
|
754
754
|
### Required argument
|
755
755
|
|
756
756
|
Format:
|
757
757
|
|
758
|
-
|
758
|
+
~~~
|
759
759
|
(arg :foo)
|
760
760
|
"foo"
|
761
761
|
~~~ expression
|
762
762
|
~~~ name
|
763
|
-
|
763
|
+
~~~
|
764
764
|
|
765
765
|
### Optional argument
|
766
766
|
|
767
767
|
Format:
|
768
768
|
|
769
|
-
|
769
|
+
~~~
|
770
770
|
(optarg :foo (int 1))
|
771
771
|
"foo = 1"
|
772
772
|
~~~~~~~ expression
|
773
773
|
^ operator
|
774
774
|
~~~ name
|
775
|
-
|
775
|
+
~~~
|
776
776
|
|
777
777
|
### Named splat argument
|
778
778
|
|
779
779
|
Format:
|
780
780
|
|
781
|
-
|
781
|
+
~~~
|
782
782
|
(restarg :foo)
|
783
783
|
"*foo"
|
784
784
|
~~~~ expression
|
785
785
|
~~~ name
|
786
|
-
|
786
|
+
~~~
|
787
787
|
|
788
788
|
Begin of the `expression` points to `*`.
|
789
789
|
|
@@ -791,22 +791,22 @@ Begin of the `expression` points to `*`.
|
|
791
791
|
|
792
792
|
Format:
|
793
793
|
|
794
|
-
|
794
|
+
~~~
|
795
795
|
(restarg)
|
796
796
|
"*"
|
797
797
|
^ expression
|
798
|
-
|
798
|
+
~~~
|
799
799
|
|
800
800
|
### Block argument
|
801
801
|
|
802
802
|
Format:
|
803
803
|
|
804
|
-
|
804
|
+
~~~
|
805
805
|
(blockarg :foo)
|
806
806
|
"&foo"
|
807
807
|
~~~ name
|
808
808
|
~~~~ expression
|
809
|
-
|
809
|
+
~~~
|
810
810
|
|
811
811
|
Begin of the `expression` points to `&`.
|
812
812
|
|
@@ -818,7 +818,7 @@ if they were on the lhs of a multiple assignment.
|
|
818
818
|
|
819
819
|
Format:
|
820
820
|
|
821
|
-
|
821
|
+
~~~
|
822
822
|
(args (arg_expr (ivasgn :@bar)))
|
823
823
|
"|@bar|"
|
824
824
|
|
@@ -830,70 +830,70 @@ Format:
|
|
830
830
|
|
831
831
|
(args (blockarg_expr (ivasgn :@bar)))
|
832
832
|
"|&@bar|"
|
833
|
-
|
833
|
+
~~~
|
834
834
|
|
835
835
|
### Block shadow arguments
|
836
836
|
|
837
837
|
Format:
|
838
838
|
|
839
|
-
|
839
|
+
~~~
|
840
840
|
(args (shadowarg :foo) (shadowarg :bar))
|
841
841
|
"|; foo, bar|"
|
842
|
-
|
842
|
+
~~~
|
843
843
|
|
844
844
|
### Decomposition
|
845
845
|
|
846
846
|
Format:
|
847
847
|
|
848
|
-
|
848
|
+
~~~
|
849
849
|
(def :f (args (arg :a) (mlhs (arg :foo) (restarg :bar))))
|
850
850
|
"def f(a, (foo, *bar)); end"
|
851
851
|
^ begin ^ end
|
852
852
|
~~~~~~~~~~~ expression
|
853
|
-
|
853
|
+
~~~
|
854
854
|
|
855
855
|
### Required keyword argument
|
856
856
|
|
857
857
|
Format:
|
858
858
|
|
859
|
-
|
859
|
+
~~~
|
860
860
|
(kwarg :foo (int 1))
|
861
861
|
"foo:"
|
862
862
|
~~~~ expression
|
863
863
|
~~~~ name
|
864
|
-
|
864
|
+
~~~
|
865
865
|
|
866
866
|
### Optional keyword argument
|
867
867
|
|
868
868
|
Format:
|
869
869
|
|
870
|
-
|
870
|
+
~~~
|
871
871
|
(kwoptarg :foo (int 1))
|
872
872
|
"foo: 1"
|
873
873
|
~~~~~~ expression
|
874
874
|
~~~~ name
|
875
|
-
|
875
|
+
~~~
|
876
876
|
|
877
877
|
### Named keyword splat argument
|
878
878
|
|
879
879
|
Format:
|
880
880
|
|
881
|
-
|
881
|
+
~~~
|
882
882
|
(kwrestarg :foo)
|
883
883
|
"**foo"
|
884
884
|
~~~~~ expression
|
885
885
|
~~~ name
|
886
|
-
|
886
|
+
~~~
|
887
887
|
|
888
888
|
### Unnamed keyword splat argument
|
889
889
|
|
890
890
|
Format:
|
891
891
|
|
892
|
-
|
892
|
+
~~~
|
893
893
|
(kwrestarg)
|
894
894
|
"**"
|
895
895
|
~~ expression
|
896
|
-
|
896
|
+
~~~
|
897
897
|
|
898
898
|
## Send
|
899
899
|
|
@@ -901,20 +901,20 @@ Format:
|
|
901
901
|
|
902
902
|
Format:
|
903
903
|
|
904
|
-
|
904
|
+
~~~
|
905
905
|
(send nil :foo (lvar :bar))
|
906
906
|
"foo(bar)"
|
907
907
|
~~~ selector
|
908
908
|
^ begin
|
909
909
|
^ end
|
910
910
|
~~~~~~~~ expression
|
911
|
-
|
911
|
+
~~~
|
912
912
|
|
913
913
|
### To receiver
|
914
914
|
|
915
915
|
Format:
|
916
916
|
|
917
|
-
|
917
|
+
~~~
|
918
918
|
(send (lvar :foo) :bar (int 1))
|
919
919
|
"foo.bar(1)"
|
920
920
|
~~~ selector
|
@@ -949,12 +949,12 @@ Format:
|
|
949
949
|
^ operator
|
950
950
|
~~~~~~~~~~~~~~~ expression
|
951
951
|
|
952
|
-
|
952
|
+
~~~
|
953
953
|
|
954
954
|
### To superclass
|
955
955
|
|
956
956
|
Format of super with arguments:
|
957
|
-
|
957
|
+
~~~
|
958
958
|
(super (lvar :a))
|
959
959
|
"super a"
|
960
960
|
~~~~~ keyword
|
@@ -966,49 +966,49 @@ Format of super with arguments:
|
|
966
966
|
^ end
|
967
967
|
~~~~~ keyword
|
968
968
|
~~~~~~~ expression
|
969
|
-
|
969
|
+
~~~
|
970
970
|
|
971
971
|
Format of super without arguments (**z**ero-arity):
|
972
|
-
|
972
|
+
~~~
|
973
973
|
(zsuper)
|
974
974
|
"super"
|
975
975
|
~~~~~ keyword
|
976
976
|
~~~~~ expression
|
977
|
-
|
977
|
+
~~~
|
978
978
|
|
979
979
|
### To block argument
|
980
980
|
|
981
981
|
Format:
|
982
982
|
|
983
|
-
|
983
|
+
~~~
|
984
984
|
(yield (lvar :foo))
|
985
985
|
"yield(foo)"
|
986
986
|
~~~~~ keyword
|
987
987
|
^ begin
|
988
988
|
^ end
|
989
989
|
~~~~~~~~~~ expression
|
990
|
-
|
990
|
+
~~~
|
991
991
|
|
992
992
|
### Passing a literal block
|
993
993
|
|
994
|
-
|
994
|
+
~~~
|
995
995
|
(block (send nil :foo) (args (arg :bar)) (begin ...))
|
996
996
|
"foo do |bar|; end"
|
997
997
|
~~ begin
|
998
998
|
~~~ end
|
999
999
|
~~~~~~~~~~~~~ expression
|
1000
|
-
|
1000
|
+
~~~
|
1001
1001
|
|
1002
1002
|
### Passing expression as block
|
1003
1003
|
|
1004
1004
|
Used when passing expression as block `foo(&bar)`
|
1005
1005
|
|
1006
|
-
|
1006
|
+
~~~
|
1007
1007
|
(send nil :foo (int 1) (block-pass (lvar :foo)))
|
1008
1008
|
"foo(1, &foo)"
|
1009
1009
|
^ operator
|
1010
1010
|
~~~~ expression
|
1011
|
-
|
1011
|
+
~~~
|
1012
1012
|
|
1013
1013
|
## Control flow
|
1014
1014
|
|
@@ -1018,24 +1018,24 @@ Used when passing expression as block `foo(&bar)`
|
|
1018
1018
|
|
1019
1019
|
Format:
|
1020
1020
|
|
1021
|
-
|
1021
|
+
~~~
|
1022
1022
|
(and (lvar :foo) (lvar :bar))
|
1023
1023
|
"foo and bar"
|
1024
1024
|
~~~ operator
|
1025
1025
|
~~~~~~~~~~~ expression
|
1026
|
-
|
1026
|
+
~~~
|
1027
1027
|
|
1028
1028
|
#### Unary (! not) (1.8)
|
1029
1029
|
|
1030
1030
|
Format:
|
1031
1031
|
|
1032
|
-
|
1032
|
+
~~~
|
1033
1033
|
(not (lvar :foo))
|
1034
1034
|
"!foo"
|
1035
1035
|
^ operator
|
1036
1036
|
"not foo"
|
1037
1037
|
~~~ operator
|
1038
|
-
|
1038
|
+
~~~
|
1039
1039
|
|
1040
1040
|
### Branching
|
1041
1041
|
|
@@ -1043,7 +1043,7 @@ Format:
|
|
1043
1043
|
|
1044
1044
|
Format:
|
1045
1045
|
|
1046
|
-
|
1046
|
+
~~~
|
1047
1047
|
(if (lvar :cond) (lvar :iftrue) nil)
|
1048
1048
|
"if cond then iftrue; end"
|
1049
1049
|
~~ keyword
|
@@ -1075,13 +1075,13 @@ Format:
|
|
1075
1075
|
"iftrue unless cond"
|
1076
1076
|
~~~~~~ keyword
|
1077
1077
|
~~~~~~~~~~~~~~~~~~ expression
|
1078
|
-
|
1078
|
+
~~~
|
1079
1079
|
|
1080
1080
|
#### With else
|
1081
1081
|
|
1082
1082
|
Format:
|
1083
1083
|
|
1084
|
-
|
1084
|
+
~~~
|
1085
1085
|
(if (lvar :cond) (lvar :iftrue) (lvar :iffalse))
|
1086
1086
|
"if cond then iftrue; else; iffalse; end"
|
1087
1087
|
~~ keyword
|
@@ -1109,13 +1109,13 @@ Format:
|
|
1109
1109
|
~~~~ else
|
1110
1110
|
~~~ end
|
1111
1111
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression
|
1112
|
-
|
1112
|
+
~~~
|
1113
1113
|
|
1114
1114
|
#### With elsif
|
1115
1115
|
|
1116
1116
|
Format:
|
1117
1117
|
|
1118
|
-
|
1118
|
+
~~~
|
1119
1119
|
(if (lvar :cond1) (int 1) (if (lvar :cond2 (int 2) (int 3))))
|
1120
1120
|
"if cond1; 1; elsif cond2; 2; else 3; end"
|
1121
1121
|
~~ keyword (left)
|
@@ -1124,19 +1124,19 @@ Format:
|
|
1124
1124
|
~~~~~ keyword (right)
|
1125
1125
|
~~~~ else (right)
|
1126
1126
|
~~~ end (right)
|
1127
|
-
|
1127
|
+
~~~
|
1128
1128
|
|
1129
1129
|
#### Ternary
|
1130
1130
|
|
1131
1131
|
Format:
|
1132
1132
|
|
1133
|
-
|
1133
|
+
~~~
|
1134
1134
|
(if (lvar :cond) (lvar :iftrue) (lvar :iffalse))
|
1135
1135
|
"cond ? iftrue : iffalse"
|
1136
1136
|
^ question
|
1137
1137
|
^ colon
|
1138
1138
|
~~~~~~~~~~~~~~~~~~~~~~~ expression
|
1139
|
-
|
1139
|
+
~~~
|
1140
1140
|
|
1141
1141
|
### Case matching
|
1142
1142
|
|
@@ -1144,7 +1144,7 @@ Format:
|
|
1144
1144
|
|
1145
1145
|
Format:
|
1146
1146
|
|
1147
|
-
|
1147
|
+
~~~
|
1148
1148
|
(when (regexp "foo" (regopt)) (begin (lvar :bar)))
|
1149
1149
|
"when /foo/ then bar"
|
1150
1150
|
~~~~ keyword
|
@@ -1159,7 +1159,7 @@ Format:
|
|
1159
1159
|
|
1160
1160
|
(when (splat (lvar :foo)) (send nil :meth))
|
1161
1161
|
"when *foo; meth"
|
1162
|
-
|
1162
|
+
~~~
|
1163
1163
|
|
1164
1164
|
#### Case-expression clause
|
1165
1165
|
|
@@ -1167,21 +1167,21 @@ Format:
|
|
1167
1167
|
|
1168
1168
|
Format:
|
1169
1169
|
|
1170
|
-
|
1170
|
+
~~~
|
1171
1171
|
(case (lvar :foo) (when (str "bar") (lvar :bar)) nil)
|
1172
1172
|
"case foo; when "bar"; bar; end"
|
1173
1173
|
~~~~ keyword ~~~ end
|
1174
|
-
|
1174
|
+
~~~
|
1175
1175
|
|
1176
1176
|
##### With else
|
1177
1177
|
|
1178
1178
|
Format:
|
1179
1179
|
|
1180
|
-
|
1180
|
+
~~~
|
1181
1181
|
(case (lvar :foo) (when (str "bar") (lvar :bar)) (lvar :baz))
|
1182
1182
|
"case foo; when "bar"; bar; else baz; end"
|
1183
1183
|
~~~~ keyword ~~~~ else ~~~ end
|
1184
|
-
|
1184
|
+
~~~
|
1185
1185
|
|
1186
1186
|
#### Case-conditions clause
|
1187
1187
|
|
@@ -1189,17 +1189,17 @@ Format:
|
|
1189
1189
|
|
1190
1190
|
Format:
|
1191
1191
|
|
1192
|
-
|
1192
|
+
~~~
|
1193
1193
|
(case nil (when (lvar :bar) (lvar :bar)) nil)
|
1194
1194
|
"case; when bar; bar; end"
|
1195
1195
|
~~~~ keyword ~~~ end
|
1196
|
-
|
1196
|
+
~~~
|
1197
1197
|
|
1198
1198
|
##### With else
|
1199
1199
|
|
1200
1200
|
Format:
|
1201
1201
|
|
1202
|
-
|
1202
|
+
~~~
|
1203
1203
|
(case nil (when (lvar :bar) (lvar :bar)) (lvar :baz))
|
1204
1204
|
"case; when bar; bar; else baz; end"
|
1205
1205
|
~~~~ keyword ~~~~ else ~~~ end
|
@@ -1209,7 +1209,7 @@ Format:
|
|
1209
1209
|
~~~~ keyword
|
1210
1210
|
~~~~ else
|
1211
1211
|
~~~ end
|
1212
|
-
|
1212
|
+
~~~
|
1213
1213
|
|
1214
1214
|
### Looping
|
1215
1215
|
|
@@ -1217,7 +1217,7 @@ Format:
|
|
1217
1217
|
|
1218
1218
|
Format:
|
1219
1219
|
|
1220
|
-
|
1220
|
+
~~~
|
1221
1221
|
(while (lvar :condition) (send nil :foo))
|
1222
1222
|
"while condition do foo; end"
|
1223
1223
|
~~~~~ keyword
|
@@ -1250,13 +1250,13 @@ Format:
|
|
1250
1250
|
"foo until condition"
|
1251
1251
|
~~~~~ keyword
|
1252
1252
|
~~~~~~~~~~~~~~~~~~~ expression
|
1253
|
-
|
1253
|
+
~~~
|
1254
1254
|
|
1255
1255
|
#### With postcondition
|
1256
1256
|
|
1257
1257
|
Format:
|
1258
1258
|
|
1259
|
-
|
1259
|
+
~~~
|
1260
1260
|
(while-post (lvar :condition) (begin (send nil :foo)))
|
1261
1261
|
"begin; foo; end while condition"
|
1262
1262
|
~~~~~ begin (begin)
|
@@ -1268,13 +1268,13 @@ Format:
|
|
1268
1268
|
~~~~~ begin (begin)
|
1269
1269
|
~~~ end (begin)
|
1270
1270
|
~~~~~ keyword (until-post)
|
1271
|
-
|
1271
|
+
~~~
|
1272
1272
|
|
1273
1273
|
#### For-in
|
1274
1274
|
|
1275
1275
|
Format:
|
1276
1276
|
|
1277
|
-
|
1277
|
+
~~~
|
1278
1278
|
(for (lasgn :a) (lvar :array) (send nil :p (lvar :a)))
|
1279
1279
|
"for a in array do p a; end"
|
1280
1280
|
~~~ keyword
|
@@ -1291,51 +1291,51 @@ Format:
|
|
1291
1291
|
(mlhs (lasgn :a) (lasgn :b)) (lvar :array)
|
1292
1292
|
(send nil :p (lvar :a) (lvar :b)))
|
1293
1293
|
"for a, b in array; p a, b; end"
|
1294
|
-
|
1294
|
+
~~~
|
1295
1295
|
|
1296
1296
|
#### Break
|
1297
1297
|
|
1298
1298
|
Format:
|
1299
1299
|
|
1300
|
-
|
1300
|
+
~~~
|
1301
1301
|
(break (int 1))
|
1302
1302
|
"break 1"
|
1303
1303
|
~~~~~ keyword
|
1304
1304
|
~~~~~~~ expression
|
1305
|
-
|
1305
|
+
~~~
|
1306
1306
|
|
1307
1307
|
#### Next
|
1308
1308
|
|
1309
1309
|
Format:
|
1310
1310
|
|
1311
|
-
|
1311
|
+
~~~
|
1312
1312
|
(next (int 1))
|
1313
1313
|
"next 1"
|
1314
1314
|
~~~~ keyword
|
1315
1315
|
~~~~~~ expression
|
1316
|
-
|
1316
|
+
~~~
|
1317
1317
|
|
1318
1318
|
#### Redo
|
1319
1319
|
|
1320
1320
|
Format:
|
1321
1321
|
|
1322
|
-
|
1322
|
+
~~~
|
1323
1323
|
(redo)
|
1324
1324
|
"redo"
|
1325
1325
|
~~~~ keyword
|
1326
1326
|
~~~~ expression
|
1327
|
-
|
1327
|
+
~~~
|
1328
1328
|
|
1329
1329
|
### Return
|
1330
1330
|
|
1331
1331
|
Format:
|
1332
1332
|
|
1333
|
-
|
1333
|
+
~~~
|
1334
1334
|
(return (lvar :foo))
|
1335
1335
|
"return(foo)"
|
1336
1336
|
~~~~~~ keyword
|
1337
1337
|
~~~~~~~~~~~ expression
|
1338
|
-
|
1338
|
+
~~~
|
1339
1339
|
|
1340
1340
|
### Exception handling
|
1341
1341
|
|
@@ -1343,7 +1343,7 @@ Format:
|
|
1343
1343
|
|
1344
1344
|
Format:
|
1345
1345
|
|
1346
|
-
|
1346
|
+
~~~
|
1347
1347
|
(resbody (array (const nil :Exception) (const nil :A)) (lvasgn :bar) (int 1))
|
1348
1348
|
"rescue Exception, A => bar; 1"
|
1349
1349
|
~~~~~~ keyword ~~ assoc
|
@@ -1365,7 +1365,7 @@ Format:
|
|
1365
1365
|
(resbody nil nil (int 1))
|
1366
1366
|
"rescue; 1"
|
1367
1367
|
~~~~~~ keyword
|
1368
|
-
|
1368
|
+
~~~
|
1369
1369
|
|
1370
1370
|
#### Rescue statement
|
1371
1371
|
|
@@ -1373,7 +1373,7 @@ Format:
|
|
1373
1373
|
|
1374
1374
|
Format:
|
1375
1375
|
|
1376
|
-
|
1376
|
+
~~~
|
1377
1377
|
(begin
|
1378
1378
|
(rescue (send nil :foo) (resbody ...) (resbody ...) nil))
|
1379
1379
|
"begin; foo; rescue Exception; rescue; end"
|
@@ -1381,37 +1381,37 @@ Format:
|
|
1381
1381
|
~~~~~~~~~~~~~~~~~ expression (rescue.resbody/1)
|
1382
1382
|
~~~~~~~ expression (rescue.resbody/2)
|
1383
1383
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression (rescue)
|
1384
|
-
|
1384
|
+
~~~
|
1385
1385
|
|
1386
1386
|
##### With else
|
1387
1387
|
|
1388
1388
|
Format:
|
1389
1389
|
|
1390
|
-
|
1390
|
+
~~~
|
1391
1391
|
(begin
|
1392
1392
|
(rescue (send nil :foo) (resbody ...) (resbody ...) (true)))
|
1393
1393
|
"begin; foo; rescue Exception; rescue; else true end"
|
1394
1394
|
~~~~~ begin ~~~~ else (rescue)
|
1395
1395
|
~~~ end
|
1396
|
-
|
1396
|
+
~~~
|
1397
1397
|
|
1398
1398
|
#### Ensure statement
|
1399
1399
|
|
1400
1400
|
Format:
|
1401
1401
|
|
1402
|
-
|
1402
|
+
~~~
|
1403
1403
|
(begin
|
1404
1404
|
(ensure (send nil :foo) (send nil :bar))
|
1405
1405
|
"begin; foo; ensure; bar; end"
|
1406
1406
|
~~~~~ begin ~~~~~~ keyword (ensure)
|
1407
1407
|
~~~ end
|
1408
|
-
|
1408
|
+
~~~
|
1409
1409
|
|
1410
1410
|
#### Rescue with ensure
|
1411
1411
|
|
1412
1412
|
Format:
|
1413
1413
|
|
1414
|
-
|
1414
|
+
~~~
|
1415
1415
|
(begin
|
1416
1416
|
(ensure
|
1417
1417
|
(rescue (send nil :foo) (resbody ...) (int 1))
|
@@ -1423,24 +1423,24 @@ Format:
|
|
1423
1423
|
~~~~~~ keyword (ensure)
|
1424
1424
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression (ensure)
|
1425
1425
|
~~~ end
|
1426
|
-
|
1426
|
+
~~~
|
1427
1427
|
|
1428
1428
|
#### Retry
|
1429
1429
|
|
1430
1430
|
Format:
|
1431
1431
|
|
1432
|
-
|
1432
|
+
~~~
|
1433
1433
|
(retry)
|
1434
1434
|
"retry"
|
1435
1435
|
~~~~~ keyword
|
1436
1436
|
~~~~~ expression
|
1437
|
-
|
1437
|
+
~~~
|
1438
1438
|
|
1439
1439
|
### BEGIN and END
|
1440
1440
|
|
1441
1441
|
Format:
|
1442
1442
|
|
1443
|
-
|
1443
|
+
~~~
|
1444
1444
|
(preexe (send nil :puts (str "foo")))
|
1445
1445
|
"BEGIN { puts "foo" }"
|
1446
1446
|
~~~~~ keyword
|
@@ -1452,5 +1452,5 @@ Format:
|
|
1452
1452
|
~~~ keyword
|
1453
1453
|
^ begin ^ end
|
1454
1454
|
~~~~~~~~~~~~~~~~~~ expression
|
1455
|
-
|
1455
|
+
~~~
|
1456
1456
|
|