dparse.ast 48/334(14%) line coverage

      
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
281
291
301
311
321
331
341
351
361
371
381
391
401
411
421
431
441
451
461
471
481
491
501
511
521
531
541
551
561
571
581
591
601
611
621
631
641
651
661
671
681
691
701
711
721
731
741
751
760
770
780
790
800
810
820
830
840
850
860
870
880
890
900
910
920
930
940
950
960
970
980
990
1000
1010
1020
1030
1040
1050
1060
1070
1080
1090
1100
1110
1120
1130
1140
1150
1160
1170
1180
1190
1200
1210
1220
1230
1240
1250
1260
1270
1280
1290
1300
1310
1320
1330
1340
1350
1360
1370
1380
1390
1400
1410
1420
1430
1440
1450
1460
1470
1480
1490
1500
1510
1520
1530
1540
1550
1560
1570
1580
1590
1600
1610
1620
1630
1640
1650
1660
1670
1680
1690
1700
1710
1720
1730
1740
1750
1760
1770
1780
1790
1800
1810
1820
1830
1840
1850
1860
1870
1880
1890
1900
1910
1920
1930
1940
1950
1960
1970
1980
1990
2000
2010
2020
2030
2040
2050
2060
2070
2080
2090
2100
2110
2120
2130
2140
2150
2160
2170
2180
2190
2200
2210
2220
2230
2240
2250
2260
2270
2280
2290
2300
2310
2320
2330
2340
2350
2360
2370
2380
2390
2400
2410
2420
2430
2440
2450
2460
2470
2480
2490
2500
2510
2520
2530
2540
2550
2560
2570
2580
2590
2600
2610
2620
2630
2640
2650
2660
2670
2680
2690
2700
2710
2720
2730
2740
2750
2760
2770
2780
2790
2800
2810
2820
2830
2840
2850
2860
2870
2880
2890
2900
2910
2920
2930
2940
2950
2960
2970
2980
2990
3000
3010
3020
3030
3040
3050
3060
3070
3080
3090
3100
3110
3120
3130
3140
3150
3160
3170
3180
3190
3200
3210
3220
3230
3240
3250
3260
3270
3280
3290
3300
3310
3320
3330
3340
3350
3360
3370
3380
3390
3400
3410
3420
3430
3440
3450
3460
3470
3480
3490
3500
3510
3520
3530
3540
3550
3560
3570
3580
3590
3600
3610
3620
3630
3640
3650
3660
3670
3680
3690
3700
3710
3720
3730
3740
3750
3760
3770
3780
3790
3800
3810
3820
3830
3840
3850
3860
3870
3880
3890
3900
3910
3920
3930
3940
3950
3960
3970
3980
3990
4000
4010
4020
4030
4040
4050
4060
4070
4080
4090
4100
4110
4120
4130
4140
4150
4160
4170
4180
4190
4200
4210
4220
4230
4240
4250
4260
4270
4280
4290
4300
4310
4320
4330
4340
4350
4360
4370
4380
4390
4400
4410
4420
4430
4440
4450
4460
4470
4480
4490
4500
4510
4520
4530
4540
4550
4560
4570
4580
4590
4600
4610
4620
4630
4640
4650
4660
4670
4680
4690
4700
4710
4720
4730
4740
4750
4760
4770
4780
4790
4800
4810
4820
4830
4840
4850
4860
4870
4880
4890
4900
4910
4920
4930
4940
4950
4960
4970
4980
4990
5000
5010
5020
5030
5040
5050
5060
5070
5080
5090
5100
5110
5120
5130
5140
5150
5160
5170
5180
5190
5200
5210
5220
5230
5240
5250
5260
5270
5280
5290
5300
5310
5320
5330
5340
5350
5360
5370
5380
5390
5400
5410
5420
5430
5440
5450
5460
5470
5480
5490
5500
5510
5520
5530
5540
5550
5560
5570
5580
5590
5600
5610
5620
5630
5640
5650
5660
5670
5680
5690
5700
5710
5720
5730
5740
5750
5760
5770
5780
5790
5800
5810
5820
5830
5840
5850
5860
5870
5880
5890
5900
5910
5920
5930
5940
5950
5960
5970
5980
5990
6000
6010
6020
6030
6040
6050
6060
6070
6080
6090
6100
6110
6120
6130
6140
6150
6160
6170
6180
6190
6200
6210
6220
6230
6240
6250
6260
6270
6280
6290
6300
6310
6320
6330
6340
6350
6360
6370
6380
6390
6400
6410
6420
6430
6440
6450
6460
6470
6480
6490
6500
6510
6520
6530
6540
6550
6560
6570
6580
6590
6600
6610
6620
6630
6640
6650
6660
6670
6680
6690
6700
6710
6720
6730
6740
6750
6760
6770
6780
6790
6800
6810
6820
6830
6840
6850
6860
6870
6880
6890
6900
6910
6920
6930
6940
6950
6960
6970
6980
6990
7000
7010
7020
7030
7040
7050
7060
7070
7080
7090
7100
7110
7120
7130
7140
7150
7160
7170
7180
7190
7200
7210
7220
7230
7240
7250
7260
7270
7280
7290
7300
7310
7320
7330
7340
7350
7360
7370
7380
7390
7400
7410
7420
7430
7440
7450
7460
7470
7480
7490
7500
7510
7520
7530
7540
7550
7560
7570
7580
7590
7600
7610
7620
7630
7640
7650
7660
7670
7680
7690
7700
7710
7720
7730
7740
7750
7760
7770
7780
7790
7800
7810
7820
7830
7840
7850
7860
7870
7880
7890
7900
7910
7920
7930
7940
7950
7960
7970
7980
7990
8000
8010
8020
8030
8040
8050
8060
8070
8080
8090
8100
8110
8120
8130
8140
8150
8160
8170
8180
8190
8200
8210
8220
8230
8240
8250
8260
8270
8280
8290
8300
8310
8320
8330
8340
8350
8360
8370
8380
8390
8400
8410
8420
8430
8440
8450
8460
8470
8480
8490
8500
8510
8520
8530
8540
8550
8560
8570
8580
8590
8600
8610
8620
8630
8640
8650
8660
8670
8680
8690
8700
8710
8720
8730
8740
8750
8760
8770
8780
8790
8800
8810
8820
8830
8840
8850
8860
8870
8880
8890
8900
8910
8920
8930
8940
8950
8960
8970
8980
8990
9000
9010
9020
9030
9040
9050
9060
9070
9080
9090
9100
9110
9120
9130
9140
9150
9160
9170
9180
9190
9200
9210
9220
9230
9240
9250
9260
9270
9280
9290
9300
9310
9320
9330
9340
9350
9360
9370
9380
9390
9400
9410
9420
9430
9440
9450
9460
9470
9480
9490
9500
9510
9520
9530
9540
9550
9560
9570
9580
9590
9600
9610
9620
9630
9640
9650
9660
9670
9680
9690
9700
9710
9720
9730
9740
9750
9760
9770
9780
9790
9800
9810
9820
9830
9840
9850
9860
9870
9880
9890
9900
9910
9920
9930
9940
9950
9960
9970
9980
9990
10000
10010
10020
10030
10040
10050
10060
10070
10080
10090
10100
10110
10120
10130
10140
10150
10160
10170
10180
10190
10200
10210
10220
10230
10240
10250
10260
10270
10280
10290
10300
10310
10320
10330
10340
10350
10360
10370
10380
10390
10400
10410
10420
10430
10440
10450
10460
10470
10480
10490
10500
10510
10520
10530
10540
10550
10560
10570
10580
10590
10600
10610
10620
10630
10640
10650
10660
10670
10680
10690
10700
10710
10720
10730
10740
10750
10760
10770
10780
10790
10800
10810
10820
10830
10840
10850
10860
10870
10880
10890
10900
10910
10920
10930
10940
10950
10960
10970
10980
10990
11000
11010
11020
11030
11040
11050
11060
11070
11080
11090
11100
11110
11120
11130
11140
11150
11160
11170
11180
11190
11200
11210
11220
11230
11240
11250
11260
11270
11280
11290
11300
11310
11320
11330
11340
11350
11360
11370
11380
11390
11400
11410
11420
11430
11440
11450
11460
11470
11480
11490
11500
11510
11520
11530
11540
11550
11560
11570
11580
11590
11600
11610
11620
11630
11640
11650
11660
11670
11680
11690
11700
11710
11720
11730
11740
11750
11760
11770
11780
11790
11800
11810
11820
11830
11840
11850
11860
11870
11880
11890
11900
11910
11920
11930
11940
11950
11960
11970
11980
11990
12000
12010
12020
12030
12040
12050
12060
12070
12080
12090
12100
12110
12120
12130
12140
12150
12160
12170
12180
12190
12200
12210
12220
12230
12240
12250
12260
12270
12280
12290
12300
12310
12320
12330
12340
12350
12360
12370
12380
12390
12400
12410
12420
12430
12440
12450
12460
12470
12480
12490
12500
12510
12520
12530
12540
12550
12560
12570
12580
12590
12600
12610
12620
12630
12640
12650
12660
12670
12680
12690
12700
12710
12720
12730
12740
12750
12760
12770
12780
12790
12800
12810
12820
12830
12840
12850
12860
12870
12880
12890
12900
12910
12920
12930
12940
12950
12960
12970
12980
12990
13000
13010
13020
13030
13040
13050
13060
13070
13080
13090
13100
13110
13120
13130
13140
13150
13160
13170
13180
13190
13200
13210
13220
13230
13240
13250
13260
13270
13280
13290
13300
13310
13320
13330
13340
13350
13360
13370
13380
13390
13400
13410
13420
13430
13440
13450
13460
13470
13480
13490
13500
13510
13520
13530
13540
13550
13560
13570
13580
13590
13600
13610
13620
13630
13640
13650
13660
13670
13680
13690
13700
13710
13720
13730
13740
13750
13760
13770
13780
13790
13800
13810
13820
13830
13840
13850
13860
13870
13880
13890
13900
13910
13920
13930
13940
13950
13960
13970
13980
13990
14000
14010
14020
14030
14040
14050
14060
14070
14080
14090
14100
14110
14120
14130
14140
14150
14160
14170
14180
14190
14200
14210
14220
14230
14240
14250
14260
14270
14280
14290
14300
14310
14320
14330
14340
14350
14360
14370
14380
14390
14400
14410
14420
14430
14440
14450
14460
14470
14480
14490
14500
14510
14520
14530
14540
14550
14560
14570
14580
14590
14600
14610
14620
14630
14640
14650
14660
14670
14680
14690
14700
14710
14720
14730
14740
14750
14760
14770
14780
14790
14800
14810
14820
14830
14840
14850
14860
14870
14880
14890
14900
14910
14920
14930
14940
14950
14960
14970
14980
14990
15000
15010
15020
15030
15040
15050
15060
15070
15080
15090
15100
15110
15120
15130
15140
15150
15160
15170
15180
15190
15200
15210
15220
15230
15240
15250
15260
15270
15280
15290
15300
15310
15320
15330
15340
15350
15360
15370
15380
15390
15400
15410
15420
15430
15440
15450
15460
15470
15480
15490
15500
15510
15520
15530
15540
15550
15560
15570
15580
15590
15600
15610
15620
15630
15640
15650
15660
15670
15680
15690
15700
15710
15720
15730
15740
15750
15760
15770
15780
15790
15800
15810
15820
15830
15840
15850
15860
15870
15880
15890
15900
15910
15920
15930
15940
15950
15960
15970
15980
15990
16000
16010
16020
16030
16040
16050
16060
16070
16080
16090
16100
16110
16120
16130
16140
16150
16160
16170
16180
16190
16200
16210
16220
16230
16240
16250
16260
16270
16280
16290
16300
16310
16320
16330
16340
16350
16360
16370
16380
16390
16400
16410
16420
16430
16440
16450
16460
16470
16480
16490
16500
16510
16520
16530
16540
16550
16560
16570
16580
16590
16600
16610
16620
16630
16640
16650
16660
16670
16680
16690
16700
16710
16720
16730
16740
16750
16760
16770
16780
16790
16800
16810
16820
16830
16840
16850
16860
16870
16880
16890
16900
16910
16920
16930
16940
16950
16960
16970
16980
16990
17000
17010
17020
17030
17040
17050
17060
17070
17080
17090
17100
17110
17120
17130
17140
17150
17160
17170
17180
17190
17200
17210
17220
17230
17240
17250
17260
17270
17280
17290
17300
17310
17320
17330
17340
17350
17360
17370
17380
17390
17400
17410
17420
17430
17440
17450
17460
17470
17480
17490
17500
17510
17520
17530
17540
17550
17560
17570
17580
17590
17600
17610
17620
17630
17640
17650
17660
17670
17680
17690
17700
17710
17720
17730
17740
17750
17760
17770
17780
17790
17800
17810
17820
17830
17840
17850
17860
17870
17880
17890
17900
17910
17920
17930
17940
17950
17960
17970
17980
17990
18000
18010
18020
18030
18040
18050
18060
18070
18080
18090
18100
18110
18120
18130
18140
18150
18160
18170
18180
18190
18200
18210
18220
18230
18240
18250
18260
18270
18280
18290
18300
18310
18320
18330
18340
18350
18360
18370
18380
18390
18400
18410
18420
18430
18440
18450
18460
18470
18480
18490
18500
18510
18520
18530
18540
18550
18560
18570
18580
18590
18600
18610
18620
18630
18640
18650
18660
18670
18680
18690
18700
18710
18720
18730
18740
18750
18760
18770
18780
18790
18800
18810
18820
18830
18840
18850
18860
18870
18880
18890
18900
18910
18920
18930
18940
18950
18960
18970
18980
18990
19000
19010
19020
19030
19040
19050
19060
19070
19080
19090
19100
19110
19120
19130
19140
19150
19160
19170
19180
19190
19200
19210
19220
19230
19240
19250
19260
19270
19280
19290
19300
19310
19320
19330
19340
19350
19360
19370
19380
19390
19400
19410
19420
19430
19440
19450
19460
19470
19480
19490
19500
19510
19520
19530
19540
19550
19560
19570
19580
19590
19600
19610
19620
19630
19640
19650
19660
19670
19680
19690
19700
19710
19720
19730
19740
19750
19760
19770
19780
19790
19800
19810
19820
19830
19840
19850
19860
19870
19880
19890
19900
19910
19920
19930
19940
19950
19960
19970
19980
19990
20000
20010
20020
20030
20040
20050
20060
20070
20080
20090
20100
20110
20120
20130
20140
20150
20160
20170
20180
20190
20200
20210
20220
20230
20240
20250
20260
20270
20280
20290
20300
20310
20320
20330
20340
20350
20360
20370
20380
20390
20400
20410
20420
20430
20440
20450
20460
20470
20480
20490
20500
20510
20520
20530
20540
20550
20560
20570
20580
20590
20600
20610
20620
20630
20640
20650
20660
20670
20680
20690
20700
20710
20720
20730
20740
20750
20760
20770
20780
20790
20800
20810
20820
20830
20840
20850
20860
20870
20880
20890
20900
20910
20920
20930
20940
20950
20960
20970
20980
20990
21000
21010
21020
21030
21040
21050
21060
21070
21080
21090
21100
21110
21120
21130
21140
21150
21160
21170
21180
21190
21200
21210
21220
21230
21240
21250
21260
21270
21280
21290
21300
21310
21320
21330
21340
21350
21360
21370
21380
21390
21400
21410
21420
21430
21440
21450
21460
21470
21480
21490
21500
21510
21520
21530
21540
21550
21560
21570
21580
21590
21600
21610
21620
21630
21640
21650
21660
21670
21680
21690
21700
21710
21720
21730
21740
21750
21760
21770
21780
21790
21800
21810
21820
21830
21840
21850
21860
21870
21880
21890
21900
21910
21920
21930
21940
21950
21960
21970
21980
21990
22000
22010
22020
22030
22040
22050
22060
22070
22080
22090
22100
22110
22120
22130
22140
22150
22160
22170
22180
22190
22200
22210
22220
22230
22240
22250
22260
22270
22280
22290
22300
22310
22320
22330
22340
22350
22360
22370
22380
22390
22400
22410
22420
22430
22440
22450
22460
22470
22480
22490
22500
22510
22520
22530
22540
22550
22560
22570
22580
22590
22600
22610
22620
22630
22640
22650
22660
22670
22680
22690
22700
22710
22720
22730
22740
22750
22760
22770
22780
22790
22800
22810
22820
22830
22840
22850
22860
22870
22880
22890
22900
22910
22920
22930
22940
22950
22960
22970
22980
22990
23000
23010
23020
23030
23040
23050
23060
23070
23080
23090
23100
23110
23120
23130
23140
23150
23160
23170
23180
23190
23200
23210
23220
23230
23240
23250
23260
23270
23280
23290
23300
23310
23320
23330
23340
23350
23360
23370
23380
23390
23400
23410
23420
23430
23440
23450
23460
23470
23480
23490
23500
23510
23520
23530
23540
23550
23560
23570
23580
23590
23600
23610
23620
23630
23640
23650
23660
23670
23680
23690
23700
23710
23720
23730
23740
23750
23760
23770
23780
23790
23800
23810
23820
23830
23840
23850
23860
23870
23880
23890
23900
23910
23920
23930
23940
23950
23960
23970
23980
23990
24000
24010
24020
24030
24040
24050
24060
24070
24080
24090
24100
24110
24120
24130
24140
24150
24160
24170
24180
24190
24200
24210
24220
24230
24240
24250
24260
24270
24280
24290
24300
24310
24320
24330
24340
24350
24360
24370
24380
24390
24400
24410
24420
24430
24440
24450
24460
24470
24480
24490
24500
24510
24520
24530
24540
24550
24560
24570
24580
24590
24600
24610
24620
24630
24640
24650
24660
24670
24680
24690
24700
24710
24720
24730
24740
24750
24760
24770
24780
24790
24800
24810
24820
24830
24840
24850
24860
24870
24880
24890
24900
24910
24920
24930
24940
24950
24960
24970
24980
24990
25000
25010
25020
25030
25040
25050
25060
25070
25080
25090
25100
25110
25120
25130
25140
25150
25160
25170
25180
25190
25200
25210
25220
25230
25240
25250
25260
25270
25280
25290
25300
25310
25320
25330
25340
25350
25360
25370
25380
25390
25400
25410
25420
25430
25440
25450
25460
25470
25480
25490
25500
25510
25520
25530
25540
25550
25560
25570
25580
25590
25600
25610
25620
25630
25640
25650
25660
25670
25680
25690
25700
25710
25720
25730
25740
25750
25760
25770
25780
25790
25800
25810
25820
25830
25840
25850
25860
25870
25880
25890
25900
25910
25920
25930
25940
25950
25960
25970
25980
25990
26000
26010
26020
26030
26040
26050
26060
26070
26080
26090
26100
26110
26120
26130
26140
26150
26160
26170
26180
26190
26200
26210
26220
26230
26240
26250
26260
26270
26280
26290
26300
26310
26320
26330
26340
26350
26360
26370
26380
26390
26400
26410
26420
26430
26440
26450
26460
26470
26480
26490
26500
26510
26520
26530
26540
26550
26560
26570
26580
26590
26600
26610
26620
26630
26640
26650
26660
26670
26680
26690
26700
26710
26720
26730
26740
26750
26760
26770
26780
26790
26800
26810
26820
26830
26840
26850
26860
26870
26880
26890
26900
26910
26920
26930
26940
26950
26960
26970
26980
26990
27000
27010
27020
27030
27040
27050
27060
27070
27080
27090
27100
27110
27120
27130
27140
27150
27160
27170
27180
27190
27200
27210
27220
27230
27240
27250
27260
27270
27280
27290
27300
27310
27320
27330
27340
27350
27360
27370
27380
27390
27400
27410
27420
27430
27440
27450
27460
27470
27480
27490
27500
27510
27520
27530
27540
27550
27560
27570
27580
27590
27600
27610
27620
27630
27640
27650
27660
27670
27680
27690
27700
27710
27720
27730
27740
27750
27760
27770
27780
27790
27800
27810
27820
27830
27840
27850
27860
27870
27880
27890
27900
27910
27920
27930
27940
27950
27960
27970
27980
27990
28000
28010
28020
28030
28040
28050
28060
28070
28080
28090
28100
28110
28120
28130
28140
28150
28160
28170
28180
28190
28200
28210
28220
28230
28240
28250
28260
28270
28280
28290
28300
28310
28320
28330
28340
28350
28360
28370
28380
28390
28400
28410
28420
28430
28440
28450
28460
28470
28480
28490
28500
28510
28520
28530
28540
28550
28560
28570
28580
28590
28600
28610
28620
28630
28640
28650
28660
28670
28680
28690
28700
28710
28720
28730
28740
28750
28760
28770
28780
28790
28800
28810
28820
28830
28840
28850
28860
28870
28880
28890
28900
28910
28920
28930
28940
28950
28960
28970
28980
28990
29000
29010
29020
29030
29040
29050
29060
29070
29080
29090
29100
29110
29120
29130
29140
29150
29160
29170
29180
29190
29200
29210
29220
29230
29240
29250
29260
29270
29280
29290
29300
29310
29320
29330
29340
29350
29360
29370
29380
29390
29400
29410
29420
29430
29440
29450
29460
29470
29480
29490
29500
29510
29520
29530
29540
29550
29560
29570
29580
29590
29600
29610
29620
29630
29640
29650
29660
29670
29680
29690
29700
29710
29720
29730
29740
29750
29760
29770
29780
29790
29800
29810
29820
29830
29840
29850
29860
29870
29880
29890
29900
29910
29920
29930
29940
29950
29960
29970
29980
29990
30000
30010
30020
30030
30040
30050
30060
30070
30080
30090
30100
30110
30120
30130
30140
30150
30160
30170
30180
30190
30200
30210
30220
30230
30240
30250
30260
30270
30280
30290
30300
30310
30320
30330
30340
30350
30360
30370
30380
30390
30400
30410
30420
30430
30440
30450
30460
30470
30480
30490
30500
30510
30520
30530
30540
30550
30560
30570
30580
30590
30600
30610
30620
30630
30640
30650
30660
30670
30680
30690
30700
30710
30720
30730
30740
30750
30760
30770
30780
30790
30800
30810
30820
30830
30840
30850
30860
30870
30880
30890
30900
30910
30920
30930
30940
30950
30960
30970
30980
30990
31000
31010
31020
31030
31040
31050
31060
31070
31080
31090
31100
31110
31120
31130
31140
31150
31160
31170
31180
31190
31200
31210
31220
31230
31240
31250
31260
31270
31280
31290
31300
31310
31320
31330
31340
31350
31360
31370
31380
31390
31400
31410
31420
31430
31440
31450
31460
31470
31480
31490
31500
31510
31520
31530
31540
31550
31560
31570
31580
31590
31600
31610
31620
31630
31640
31650
31660
31670
31680
31690
31700
31710
31720
31730
31740
31750
31760
31770
31780
31790
31800
31810
31820
31830
31840
31850
31860
31870
31880
31890
31900
31910
31920
31930
31940
31950
31960
31970
31980
31990
32000
32010
32020
32030
32040
32050
32060
32070
32080
32090
32100
32110
32120
32130
32140
32150
32160
32170
32180
32190
32200
32210
32220
32230
32240
32250
32260
32270
32280
32290
32300
32310
32320
32330
32340
32350
32360
32370
32380
32390
32400
32410
32420
32430
32440
32450
32460
32470
32480
32490
32500
32510
32520
32530
32540
32550
32560
32570
32580
32590
32600
32610
32620
32630
32640
32650
32660
32670
32680
32690
32700
32710
32720
32730
32740
32750
32760
32770
32780
32790
32800
32810
32820
32830
32840
32850
32860
32870
32880
32890
32900
32910
32920
32930
32940
32950
32960
32970
32980
32990
33000
33010
33020
33030
33040
33050
33060
33070
33080
33090
33100
33110
33120
33130
33140
33150
33160
33170
33180
33190
33200
33210
33220
33230
33240
33250
33260
33270
33280
33290
33300
33310
33320
33330
33340
33350
33360
33370
33380
33390
33400
33410
33420
33430
33440
33450
33460
33470
33480
33490
33500
33510
33520
33530
33540
33550
33560
33570
33580
33590
33600
33610
33620
33630
33640
33650
33660
33670
33680
33690
33700
33710
33720
33730
33740
33750
33760
33770
33780
33790
33800
33810
33820
33830
33840
33850
33860
33870
33880
33890
33900
33910
33920
33930
33940
33950
33960
33970
33980
33990
34000
34010
34020
34030
34040
34050
34060
34070
34080
34090
34100
34110
34120
34130
34140
34150
34160
34170
34180
34190
34200
34210
34220
34230
34240
34250
34260
34270
34280
34290
34300
34310
34320
34330
34340
34350
34360
34370
34380
34390
34400
34410
34420
34430
34440
34450
34460
34470
34480
34490
34500
34510
34520
34530
34540
34550
34560
34570
34580
34590
34600
34610
34620
34630
34640
34650
34660
34670
34680
34690
34700
34710
34720
34730
34740
34750
34760
34770
34780
34790
34800
34810
34820
34830
34840
34850
34860
34870
34880
34890
34900
34910
34920
34930
34940
34950
34960
34970
34980
34990
35000
35010
35020
35030
35040
35050
35060
35070
35080
35090
35100
35110
35120
35130
35140
35150
35160
35170
35180
35190
35200
35210
35220
35230
35240
35250
35260
35270
35280
35290
35300
35310
35320
35330
35340
35350
35360
35370
35380
35390
35400
35410
35420
35430
35440
35450
35460
35470
35480
35490
35500
35510
35520
35530
35540
35550
35560
35570
35580
35590
35600
35610
35620
35630
35640
35650
35660
35670
35680
35690
35700
35710
35720
35730
35740
35750
35760
35770
35780
35790
35800
35810
35820
35830
35840
35850
35860
35870
35880
35890
35900
35910
35920
35930
35940
35950
35960
35970
35980
35990
36000
36010
36020
36030
36040
36050
36060
36070
36080
36090
36100
36110
36120
36130
36140
36150
36160
36170
36180
36190
36200
36210
36220
36230
36240
36250
36260
36270
36280
36290
36300
36310
36320
36330
36340
36350
36360
36370
36380
36390
36400
36410
36420
36430
36440
36450
36460
36470
36480
36490
36500
36510
36520
36530
36540
36550
36560
36570
36580
36590
36600
36610
36620
36630
36640
36650
36660
36670
36680
36690
36700
36710
36720
36730
36740
36750
36760
36770
36780
36790
36800
36810
36820
36830
36840
36850
36860
36870
36880
36890
36900
36910
36920
36930
36940
36950
36960
36970
36980
36990
37000
37010
37020
37030
37040
37050
37060
37070
37080
37090
37100
37110
37120
37130
37140
37150
37160
37170
37180
37190
37200
37210
37220
37230
37240
37250
37260
37270
37280
37290
37300
37310
37320
37330
37340
37350
37360
37370
37380
37390
37400
37410
37420
37430
37440
37450
37460
37470
37480
37490
37500
37510
37520
37530
37540
37550
37560
37570
37580
37590
37600
37610
37620
37630
37640
37650
37660
37670
37680
37690
37700
37710
37720
37730
37740
37750
37760
37770
37780
37790
37800
37810
37820
37830
37840
37850
37860
37870
37880
37890
37900
37910
37920
37930
37940
37950
37960
37970
37980
37990
38000
38010
38020
38030
38040
38050
38060
38070
38080
38090
38100
38110
38120
38130
38140
38150
38160
38170
38180
38190
38200
38210
38220
38230
38240
38250
38260
38270
38280
38290
38300
38310
38320
38330
38340
38350
38360
38370
38380
38390
38400
38410
38420
38430
38440
38450
38460
38470
38480
38490
38500
38510
38520
38530
38540
38550
38560
38570
38580
38590
38600
38610
38620
38630
38640
38650
38660
38670
38680
38690
38700
38710
38720
38730
38740
38750
38760
38770
38780
38790
38800
38810
38820
38830
38840
38850
38860
38870
38880
38890
38900
38910
38920
38930
38940
38950
38960
38970
38980
38990
39000
39010
39020
39030
39040
39050
39060
39070
39080
39090
39100
39110
39120
39130
39140
39150
39160
39170
39180
39190
39200
39210
39220
39230
39240
39250
39260
39270
39280
39290
39300
39310
39320
39330
39340
39350
39360
39370
39380
39390
39400
39410
39420
39430
39440
39450
39460
39470
39480
39490
39500
39510
39520
39530
39540
39550
39560
39570
39580
39590
39600
39610
39620
39630
39640
39650
39660
39670
39680
39690
39700
39710
39720
39730
39740
39750
// Written in the D programming language. /** * This module defines an Abstract Syntax Tree for the D language * * Examples: * --- * // TODO * --- * * Copyright: Brian Schott 2013 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt Boost, License 1.0) * Authors: Brian Schott */ module dparse.ast; import dparse.lexer; import std.traits; import std.algorithm; import std.array; import std.string; private immutable uint[TypeInfo] typeMap; shared static this() { typeMap[typeid(AddExpression)] = 1; typeMap[typeid(AndAndExpression)] = 2; typeMap[typeid(AndExpression)] = 3; typeMap[typeid(AsmAddExp)] = 4; typeMap[typeid(AsmAndExp)] = 5; typeMap[typeid(AsmBrExp)] = 6; typeMap[typeid(AsmExp)] = 7; typeMap[typeid(AsmEqualExp)] = 8; typeMap[typeid(AsmLogAndExp)] = 9; typeMap[typeid(AsmLogOrExp)] = 10; typeMap[typeid(AsmMulExp)] = 11; typeMap[typeid(AsmOrExp)] = 12; typeMap[typeid(AsmRelExp)] = 13; typeMap[typeid(AsmUnaExp)] = 14; typeMap[typeid(AsmShiftExp)] = 15; typeMap[typeid(AsmXorExp)] = 16; typeMap[typeid(AssertExpression)] = 17; typeMap[typeid(AssignExpression)] = 18; typeMap[typeid(CmpExpression)] = 19; typeMap[typeid(DeleteExpression)] = 20; typeMap[typeid(EqualExpression)] = 21; typeMap[typeid(Expression)] = 22; typeMap[typeid(FunctionCallExpression)] = 23; typeMap[typeid(FunctionLiteralExpression)] = 24; typeMap[typeid(IdentityExpression)] = 25; typeMap[typeid(ImportExpression)] = 26; typeMap[typeid(IndexExpression)] = 27; typeMap[typeid(InExpression)] = 28; typeMap[typeid(IsExpression)] = 29; typeMap[typeid(MixinExpression)] = 30; typeMap[typeid(MulExpression)] = 31; typeMap[typeid(NewAnonClassExpression)] = 32; typeMap[typeid(NewExpression)] = 33; typeMap[typeid(OrExpression)] = 34; typeMap[typeid(OrOrExpression)] = 35; typeMap[typeid(PowExpression)] = 36; typeMap[typeid(PragmaExpression)] = 37; typeMap[typeid(PrimaryExpression)] = 38; typeMap[typeid(RelExpression)] = 39; typeMap[typeid(ShiftExpression)] = 40; typeMap[typeid(Index)] = 41; typeMap[typeid(TemplateMixinExpression)] = 42; typeMap[typeid(TernaryExpression)] = 43; typeMap[typeid(TraitsExpression)] = 44; typeMap[typeid(TypeidExpression)] = 45; typeMap[typeid(TypeofExpression)] = 46; typeMap[typeid(UnaryExpression)] = 47; typeMap[typeid(XorExpression)] = 48; } /// Describes which syntax was used in a list of declarations in the containing AST node enum DeclarationListStyle : ubyte { /// A declaration directly after the containing AST node making it the only child single, /// A colon (`:`) was used in the containing AST node meaning all following declarations are part here. colon, /// The declarations have been specified in a block denoted by starting `{` and ending `}` tokens. block } /** * Implements the $(LINK2 http://en.wikipedia.org/wiki/Visitor_pattern, Visitor Pattern) * for the various AST classes */ abstract class ASTVisitor { /** */ void visit(const ExpressionNode n) { switch (typeMap[typeid(n)]) { case 1: visit(cast(AddExpression) n); break; case 2: visit(cast(AndAndExpression) n); break; case 3: visit(cast(AndExpression) n); break; case 4: visit(cast(AsmAddExp) n); break; case 5: visit(cast(AsmAndExp) n); break; case 6: visit(cast(AsmBrExp) n); break; case 7: visit(cast(AsmExp) n); break; case 8: visit(cast(AsmEqualExp) n); break; case 9: visit(cast(AsmLogAndExp) n); break; case 10: visit(cast(AsmLogOrExp) n); break; case 11: visit(cast(AsmMulExp) n); break; case 12: visit(cast(AsmOrExp) n); break; case 13: visit(cast(AsmRelExp) n); break; case 14: visit(cast(AsmUnaExp) n); break; case 15: visit(cast(AsmShiftExp) n); break; case 16: visit(cast(AsmXorExp) n); break; case 17: visit(cast(AssertExpression) n); break; case 18: visit(cast(AssignExpression) n); break; case 19: visit(cast(CmpExpression) n); break; case 20: visit(cast(DeleteExpression) n); break; case 21: visit(cast(EqualExpression) n); break; case 22: visit(cast(Expression) n); break; case 23: visit(cast(FunctionCallExpression) n); break; case 24: visit(cast(FunctionLiteralExpression) n); break; case 25: visit(cast(IdentityExpression) n); break; case 26: visit(cast(ImportExpression) n); break; case 27: visit(cast(IndexExpression) n); break; case 28: visit(cast(InExpression) n); break; case 29: visit(cast(IsExpression) n); break; case 30: visit(cast(MixinExpression) n); break; case 31: visit(cast(MulExpression) n); break; case 32: visit(cast(NewAnonClassExpression) n); break; case 33: visit(cast(NewExpression) n); break; case 34: visit(cast(OrExpression) n); break; case 35: visit(cast(OrOrExpression) n); break; case 36: visit(cast(PowExpression) n); break; case 37: visit(cast(PragmaExpression) n); break; case 38: visit(cast(PrimaryExpression) n); break; case 39: visit(cast(RelExpression) n); break; case 40: visit(cast(ShiftExpression) n); break; case 41: visit(cast(Index) n); break; case 42: visit(cast(TemplateMixinExpression) n); break; case 43: visit(cast(TernaryExpression) n); break; case 44: visit(cast(TraitsExpression) n); break; case 45: visit(cast(TypeidExpression) n); break; case 46: visit(cast(TypeofExpression) n); break; case 47: visit(cast(UnaryExpression) n); break; case 48: visit(cast(XorExpression) n); break; default: assert(false, __MODULE__ ~ " has a bug"); } } /** */ void visit(const AddExpression addExpression) { addExpression.accept(this); } /** */ void visit(const AliasDeclaration aliasDeclaration) { aliasDeclaration.accept(this); } /** */ void visit(const AliasAssign aliasAssign) { aliasAssign.accept(this); } /** */ void visit(const AliasInitializer aliasInitializer) { aliasInitializer.accept(this); } /** */ void visit(const AliasThisDeclaration aliasThisDeclaration) { aliasThisDeclaration.accept(this); } /** */ void visit(const AlignAttribute alignAttribute) { alignAttribute.accept(this); } /** */ void visit(const AndAndExpression andAndExpression) { andAndExpression.accept(this); } /** */ void visit(const AndExpression andExpression) { andExpression.accept(this); } /** */ void visit(const AnonymousEnumDeclaration anonymousEnumDeclaration) { anonymousEnumDeclaration.accept(this); } /** */ void visit(const AnonymousEnumMember anonymousEnumMember) { anonymousEnumMember.accept(this); } /** */ void visit(const ArgumentList argumentList) { argumentList.accept(this); } /** */ void visit(const Arguments arguments) { arguments.accept(this); } /** */ void visit(const ArrayInitializer arrayInitializer) { arrayInitializer.accept(this); } /** */ void visit(const ArrayLiteral arrayLiteral) { arrayLiteral.accept(this); } /** */ void visit(const ArrayMemberInitialization arrayMemberInitialization) { arrayMemberInitialization.accept(this); } /** */ void visit(const AsmAddExp asmAddExp) { asmAddExp.accept(this); } /** */ void visit(const AsmAndExp asmAndExp) { asmAndExp.accept(this); } /** */ void visit(const AsmBrExp asmBrExp) { asmBrExp.accept(this); } /** */ void visit(const AsmEqualExp asmEqualExp) { asmEqualExp.accept(this); } /** */ void visit(const AsmExp asmExp) { asmExp.accept(this); } /** */ void visit(const AsmInstruction asmInstruction) { asmInstruction.accept(this); } /** */ void visit(const AsmLogAndExp asmLogAndExp) { asmLogAndExp.accept(this); } /** */ void visit(const AsmLogOrExp asmLogOrExp) { asmLogOrExp.accept(this); } /** */ void visit(const AsmMulExp asmMulExp) { asmMulExp.accept(this); } /** */ void visit(const AsmOrExp asmOrExp) { asmOrExp.accept(this); } /** */ void visit(const AsmPrimaryExp asmPrimaryExp) { asmPrimaryExp.accept(this); } /** */ void visit(const AsmRelExp asmRelExp) { asmRelExp.accept(this); } /** */ void visit(const AsmShiftExp asmShiftExp) { asmShiftExp.accept(this); } /** */ void visit(const AsmStatement asmStatement) { asmStatement.accept(this); } /** */ void visit(const AsmTypePrefix asmTypePrefix) { asmTypePrefix.accept(this); } /** */ void visit(const AsmUnaExp asmUnaExp) { asmUnaExp.accept(this); } /** */ void visit(const AsmXorExp asmXorExp) { asmXorExp.accept(this); } /** */ void visit(const AssertArguments assertArguments) { assertArguments.accept(this); } /** */ void visit(const AssertExpression assertExpression) { assertExpression.accept(this); } /** */ void visit(const AssignExpression assignExpression) { assignExpression.accept(this); } /** */ void visit(const AssocArrayLiteral assocArrayLiteral) { assocArrayLiteral.accept(this); } /** */ void visit(const AtAttribute atAttribute) { atAttribute.accept(this); } /** */ void visit(const Attribute attribute) { attribute.accept(this); } /** */ void visit(const AttributeDeclaration attributeDeclaration) { attributeDeclaration.accept(this); } /** */ void visit(const AutoDeclaration autoDeclaration) { autoDeclaration.accept(this); } /** */ void visit(const AutoDeclarationPart autoDeclarationPart) { autoDeclarationPart.accept(this); } /** */ void visit(const BlockStatement blockStatement) { blockStatement.accept(this); } /** */ void visit(const BreakStatement breakStatement) { breakStatement.accept(this); } /** */ void visit(const BaseClass baseClass) { baseClass.accept(this); } /** */ void visit(const BaseClassList baseClassList) { baseClassList.accept(this); } /** */ void visit(const CaseRangeStatement caseRangeStatement) { caseRangeStatement.accept(this); } /** */ void visit(const CaseStatement caseStatement) { caseStatement.accept(this); } /** */ void visit(const CastExpression castExpression) { castExpression.accept(this); } /** */ void visit(const CastQualifier castQualifier) { castQualifier.accept(this); } /** */ void visit(const Catch catch_) { catch_.accept(this); } /** */ void visit(const Catches catches) { catches.accept(this); } /** */ void visit(const ClassDeclaration classDeclaration) { classDeclaration.accept(this); } /** */ void visit(const CmpExpression cmpExpression) { cmpExpression.accept(this); } /** */ void visit(const CompileCondition compileCondition) { compileCondition.accept(this); } /** */ void visit(const ConditionalDeclaration conditionalDeclaration) { conditionalDeclaration.accept(this); } /** */ void visit(const ConditionalStatement conditionalStatement) { conditionalStatement.accept(this); } /** */ void visit(const Constraint constraint) { constraint.accept(this); } /** */ void visit(const Constructor constructor) { constructor.accept(this); } /** */ void visit(const ContinueStatement continueStatement) { continueStatement.accept(this); } /** */ void visit(const DebugCondition debugCondition) { debugCondition.accept(this); } /** */ void visit(const DebugSpecification debugSpecification) { debugSpecification.accept(this); } /** */ void visit(const Declaration declaration) { declaration.accept(this); } /** */ void visit(const DeclarationOrStatement declarationsOrStatement) { declarationsOrStatement.accept(this); } /** */ void visit(const DeclarationsAndStatements declarationsAndStatements) { declarationsAndStatements.accept(this); } /** */ void visit(const Declarator declarator) { declarator.accept(this); } /** */ void visit(const DefaultStatement defaultStatement) { defaultStatement.accept(this); } /** */ void visit(const DeleteExpression deleteExpression) { deleteExpression.accept(this); } /** */ void visit(const DeleteStatement deleteStatement) { deleteStatement.accept(this); } /** */ void visit(const Deprecated deprecated_) { deprecated_.accept(this); } /** */ void visit(const Destructor destructor) { destructor.accept(this); } /** */ void visit(const DoStatement doStatement) { doStatement.accept(this); } /** */ void visit(const EnumBody enumBody) { enumBody.accept(this); } /** */ void visit(const EnumDeclaration enumDeclaration) { enumDeclaration.accept(this); } /** */ void visit(const EnumMember enumMember) { enumMember.accept(this); } /** */ void visit(const EnumMemberAttribute enumMemberAttribute) { enumMemberAttribute.accept(this); } /** */ void visit(const EponymousTemplateDeclaration eponymousTemplateDeclaration) { eponymousTemplateDeclaration.accept(this); } /** */ void visit(const EqualExpression equalExpression) { equalExpression.accept(this); } /** */ void visit(const Expression expression) { expression.accept(this); } /** */ void visit(const ExpressionStatement expressionStatement) { expressionStatement.accept(this); } /** */ void visit(const FinalSwitchStatement finalSwitchStatement) { finalSwitchStatement.accept(this); } /** */ void visit(const Finally finally_) { finally_.accept(this); } /** */ void visit(const ForStatement forStatement) { forStatement.accept(this); } /** */ void visit(const ForeachStatement foreachStatement) { foreachStatement.accept(this); } /** */ void visit(const StaticForeachDeclaration staticForeachDeclaration) { staticForeachDeclaration.accept(this); } /** */ void visit(const StaticForeachStatement staticForeachStatement) { staticForeachStatement.accept(this); } /** */ void visit(const ForeachType foreachType) { foreachType.accept(this); } /** */ void visit(const ForeachTypeList foreachTypeList) { foreachTypeList.accept(this); } /** */ void visit(const FunctionAttribute functionAttribute) { functionAttribute.accept(this); } /** */ void visit(const FunctionBody functionBody) { functionBody.accept(this); } /** */ void visit(const FunctionCallExpression functionCallExpression) { functionCallExpression.accept(this); } /** */ void visit(const FunctionContract functionContract) { functionContract.accept(this); } /** */ void visit(const FunctionDeclaration functionDeclaration) { functionDeclaration.accept(this); } /** */ void visit(const FunctionLiteralExpression functionLiteralExpression) { functionLiteralExpression.accept(this); } /** */ void visit(const GccAsmInstruction gccAsmInstruction) { gccAsmInstruction.accept(this); } /** */ void visit(const GccAsmOperandList gccAsmOperands) { gccAsmOperands.accept(this); } /** */ void visit(const GccAsmOperand gccAsmOperand) { gccAsmOperand.accept(this); } /** */ void visit(const GotoStatement gotoStatement) { gotoStatement.accept(this); } /** */ void visit(const IdentifierChain identifierChain) { identifierChain.accept(this); } /** */ void visit(const DeclaratorIdentifierList identifierList) { identifierList.accept(this); } /** */ void visit(const IdentifierOrTemplateChain identifierOrTemplateChain) { identifierOrTemplateChain.accept(this); } /** */ void visit(const IdentifierOrTemplateInstance identifierOrTemplateInstance) { identifierOrTemplateInstance.accept(this); } /** */ void visit(const IdentityExpression identityExpression) { identityExpression.accept(this); } /** */ void visit(const IfStatement ifStatement) { ifStatement.accept(this); } /** */ void visit(const ImportBind importBind) { importBind.accept(this); } /** */ void visit(const ImportBindings importBindings) { importBindings.accept(this); } /** */ void visit(const ImportDeclaration importDeclaration) { importDeclaration.accept(this); } /** */ void visit(const ImportExpression importExpression) { importExpression.accept(this); } /** */ void visit(const IndexExpression indexExpression) { indexExpression.accept(this); } /** */ void visit(const InContractExpression inContractExpression) { inContractExpression.accept(this); } /** */ void visit(const InExpression inExpression) { inExpression.accept(this); } /** */ void visit(const InOutContractExpression inOutContractExpression) { inOutContractExpression.accept(this); } /** */ void visit(const InOutStatement inOutStatement) { inOutStatement.accept(this); } /** */ void visit(const InStatement inStatement) { inStatement.accept(this); } /** */ void visit(const Initialize initialize) { initialize.accept(this); } /** */ void visit(const Initializer initializer) { initializer.accept(this); } /** */ void visit(const InterfaceDeclaration interfaceDeclaration) { interfaceDeclaration.accept(this); } /** */ void visit(const Invariant invariant_) { invariant_.accept(this); } /** */ void visit(const IsExpression isExpression) { isExpression.accept(this); } /** */ void visit(const KeyValuePair keyValuePair) { keyValuePair.accept(this); } /** */ void visit(const KeyValuePairs keyValuePairs) { keyValuePairs.accept(this); } /** */ void visit(const LabeledStatement labeledStatement) { labeledStatement.accept(this); } /** */ void visit(const LastCatch lastCatch) { lastCatch.accept(this); } /** */ void visit(const LinkageAttribute linkageAttribute) { linkageAttribute.accept(this); } /** */ void visit(const MemberFunctionAttribute memberFunctionAttribute) { memberFunctionAttribute.accept(this); } /** */ void visit(const MissingFunctionBody missingFunctionBody) { missingFunctionBody.accept(this); } /** */ void visit(const MixinDeclaration mixinDeclaration) { mixinDeclaration.accept(this); } /** */ void visit(const MixinExpression mixinExpression) { mixinExpression.accept(this); } /** */ void visit(const MixinTemplateDeclaration mixinTemplateDeclaration) { mixinTemplateDeclaration.accept(this); } /** */ void visit(const MixinTemplateName mixinTemplateName) { mixinTemplateName.accept(this); } /** */ void visit(const Module module_) { module_.accept(this); } /** */ void visit(const ModuleDeclaration moduleDeclaration) { moduleDeclaration.accept(this); } /** */ void visit(const MulExpression mulExpression) { mulExpression.accept(this); } /** */ void visit(const NamespaceList namespaceList) { namespaceList.accept(this); } /** */ void visit(const NewAnonClassExpression newAnonClassExpression) { newAnonClassExpression.accept(this); } /** */ void visit(const NewExpression newExpression) { newExpression.accept(this); } /** */ void visit(const NonVoidInitializer nonVoidInitializer) { nonVoidInitializer.accept(this); } /** */ void visit(const Operands operands) { operands.accept(this); } /** */ void visit(const OrExpression orExpression) { orExpression.accept(this); } /** */ void visit(const OrOrExpression orOrExpression) { orOrExpression.accept(this); } /** */ void visit(const OutContractExpression outContractExpression) { outContractExpression.accept(this); } /** */ void visit(const OutStatement outStatement) { outStatement.accept(this); } /** */ void visit(const ParameterAttribute parameterAttribute) { parameterAttribute.accept(this); } /** */ void visit(const Parameter parameter) { parameter.accept(this); } /** */ void visit(const Parameters parameters) { parameters.accept(this); } /** */ void visit(const Postblit postblit) { postblit.accept(this); } /** */ void visit(const PowExpression powExpression) { powExpression.accept(this); } /** */ void visit(const PragmaDeclaration pragmaDeclaration) { pragmaDeclaration.accept(this); } /** */ void visit(const PragmaStatement pragmaStatement) { pragmaStatement.accept(this); } /** */ void visit(const PragmaExpression pragmaExpression) { pragmaExpression.accept(this); } /** */ void visit(const PrimaryExpression primaryExpression) { primaryExpression.accept(this); } /** */ void visit(const Register register) { register.accept(this); } /** */ void visit(const RelExpression relExpression) { relExpression.accept(this); } /** */ void visit(const ReturnStatement returnStatement) { returnStatement.accept(this); } /** */ void visit(const ScopeGuardStatement scopeGuardStatement) { scopeGuardStatement.accept(this); } /** */ void visit(const SharedStaticConstructor sharedStaticConstructor) { sharedStaticConstructor.accept(this); } /** */ void visit(const SharedStaticDestructor sharedStaticDestructor) { sharedStaticDestructor.accept(this); } /** */ void visit(const ShiftExpression shiftExpression) { shiftExpression.accept(this); } /** */ void visit(const ShortenedFunctionBody shortenedFunctionBody) { shortenedFunctionBody.accept(this); } /** */ void visit(const SingleImport singleImport) { singleImport.accept(this); } /** */ void visit(const Index index) { index.accept(this); } /** */ void visit(const SpecifiedFunctionBody specifiedFunctionBody) { specifiedFunctionBody.accept(this); } /** */ void visit(const Statement statement) { statement.accept(this); } /** */ void visit(const StatementNoCaseNoDefault statementNoCaseNoDefault) { statementNoCaseNoDefault.accept(this); } /** */ void visit(const StaticAssertDeclaration staticAssertDeclaration) { staticAssertDeclaration.accept(this); } /** */ void visit(const StaticAssertStatement staticAssertStatement) { staticAssertStatement.accept(this); } /** */ void visit(const StaticConstructor staticConstructor) { staticConstructor.accept(this); } /** */ void visit(const StaticDestructor staticDestructor) { staticDestructor.accept(this); } /** */ void visit(const StaticIfCondition staticIfCondition) { staticIfCondition.accept(this); } /** */ void visit(const StorageClass storageClass) { storageClass.accept(this); } /** */ void visit(const StringLiteralList stringLiteralList) { stringLiteralList.accept(this); } /** */ void visit(const StructBody structBody) { structBody.accept(this); } /** */ void visit(const StructDeclaration structDeclaration) { structDeclaration.accept(this); } /** */ void visit(const StructInitializer structInitializer) { structInitializer.accept(this); } /** */ void visit(const StructMemberInitializer structMemberInitializer) { structMemberInitializer.accept(this); } /** */ void visit(const StructMemberInitializers structMemberInitializers) { structMemberInitializers.accept(this); } /** */ void visit(const SwitchStatement switchStatement) { switchStatement.accept(this); } /** */ void visit(const Symbol symbol) { symbol.accept(this); } /** */ void visit(const SynchronizedStatement synchronizedStatement) { synchronizedStatement.accept(this); } /** */ void visit(const TemplateAliasParameter templateAliasParameter) { templateAliasParameter.accept(this); } /** */ void visit(const TemplateArgument templateArgument) { templateArgument.accept(this); } /** */ void visit(const TemplateArgumentList templateArgumentList) { templateArgumentList.accept(this); } /** */ void visit(const TemplateArguments templateArguments) { templateArguments.accept(this); } /** */ void visit(const TemplateDeclaration templateDeclaration) { templateDeclaration.accept(this); } /** */ void visit(const TemplateInstance templateInstance) { templateInstance.accept(this); } /** */ void visit(const TemplateMixinExpression templateMixinExpression) { templateMixinExpression.accept(this); } /** */ void visit(const TemplateParameter templateParameter) { templateParameter.accept(this); } /** */ void visit(const TemplateParameterList templateParameterList) { templateParameterList.accept(this); } /** */ void visit(const TemplateParameters templateParameters) { templateParameters.accept(this); } /** */ void visit(const TemplateSingleArgument templateSingleArgument) { templateSingleArgument.accept(this); } /** */ void visit(const TemplateThisParameter templateThisParameter) { templateThisParameter.accept(this); } /** */ void visit(const TemplateTupleParameter templateTupleParameter) { templateTupleParameter.accept(this); } /** */ void visit(const TemplateTypeParameter templateTypeParameter) { templateTypeParameter.accept(this); } /** */ void visit(const TemplateValueParameter templateValueParameter) { templateValueParameter.accept(this); } /** */ void visit(const TemplateValueParameterDefault templateValueParameterDefault) { templateValueParameterDefault.accept(this); } /** */ void visit(const TernaryExpression ternaryExpression) { ternaryExpression.accept(this); } /** */ void visit(const ThrowExpression throwExpression) { throwExpression.accept(this); } /** */ void visit(const Token) { } /** */ void visit(const TraitsExpression traitsExpression) { traitsExpression.accept(this); } /** */ void visit(const TryStatement tryStatement) { tryStatement.accept(this); } /** */ void visit(const Type type) { type.accept(this); } /** */ void visit(const TypeIdentifierPart typeIdentChain) { typeIdentChain.accept(this); } /** */ void visit(const Type2 type2) { type2.accept(this); } /** */ void visit(const TypeSpecialization typeSpecialization) { typeSpecialization.accept(this); } /** */ void visit(const TypeSuffix typeSuffix) { typeSuffix.accept(this); } /** */ void visit(const TypeidExpression typeidExpression) { typeidExpression.accept(this); } /** */ void visit(const TypeofExpression typeofExpression) { typeofExpression.accept(this); } /** */ void visit(const UnaryExpression unaryExpression) { unaryExpression.accept(this); } /** */ void visit(const UnionDeclaration unionDeclaration) { unionDeclaration.accept(this); } /** */ void visit(const Unittest unittest_) { unittest_.accept(this); } /** */ void visit(const VariableDeclaration variableDeclaration) { variableDeclaration.accept(this); } /** */ void visit(const Vector vector) { vector.accept(this); } /** */ void visit(const VersionCondition versionCondition) { versionCondition.accept(this); } /** */ void visit(const VersionSpecification versionSpecification) { versionSpecification.accept(this); } /** */ void visit(const WhileStatement whileStatement) { whileStatement.accept(this); } /** */ void visit(const WithStatement withStatement) { withStatement.accept(this); } /** */ void visit(const XorExpression xorExpression) { xorExpression.accept(this); } } interface ASTNode { /** */ void accept(ASTVisitor visitor) const; } template visitIfNotNull(fields ...) { static if (fields.length > 1) immutable visitIfNotNull = visitIfNotNull!(fields[0]) ~ visitIfNotNull!(fields[1..$]); else { static if (typeof(fields[0]).stringof[$ - 2 .. $] == "[]") { static if (__traits(hasMember, typeof(fields[0][0]), "classinfo")) immutable visitIfNotNull = "foreach (i; " ~ fields[0].stringof ~ ") if (i !is null) visitor.visit(i);\n"; else immutable visitIfNotNull = "foreach (i; " ~ fields[0].stringof ~ ") visitor.visit(i);\n"; } else static if (__traits(hasMember, typeof(fields[0]), "classinfo")) immutable visitIfNotNull = "if (" ~ fields[0].stringof ~ " !is null) visitor.visit(" ~ fields[0].stringof ~ ");\n"; else static if (is(Unqual!(typeof(fields[0])) == Token)) immutable visitIfNotNull = "if (" ~ fields[0].stringof ~ ` != tok!""` ~ ") visitor.visit(" ~ fields[0].stringof ~ ");\n"; else immutable visitIfNotNull = "visitor.visit(" ~ fields[0].stringof ~ ");\n"; } } mixin template OpEquals(bool print = false) { override bool opEquals(Object other) const { static if (print) pragma(msg, generateOpEquals!(typeof(this))); mixin (generateOpEquals!(typeof(this))); } } template generateOpEquals(T) { template opEqualsPart(p ...) { import std.traits : isSomeFunction, isDynamicArray; import std.algorithm : among; static if (p.length > 1) { enum opEqualsPart = opEqualsPart!(p[0 .. $/2]) ~ opEqualsPart!(p[$/2 .. $]); } else static if (p.length && !isSomeFunction!(typeof(__traits(getMember, T, p[0]))) && !p[0].among("comment", "line", "column", "endLocation", "startLocation", "index", "dotLocation")) { static if (isDynamicArray!(typeof(__traits(getMember, T, p[0])))) { enum opEqualsPart = "\tif (obj." ~ p[0] ~ ".length != " ~ p[0] ~ ".length) return false;\n" ~ "\tforeach (i; 0 .. " ~ p[0] ~ ".length)\n" ~ "\t\tif (" ~ p[0] ~ "[i] != obj." ~ p[0] ~ "[i]) return false;\n"; } else enum opEqualsPart = "\tif (obj." ~ p[0] ~ " != " ~ p[0] ~ ") return false;\n"; } else enum opEqualsPart = ""; } enum generateOpEquals = "if (auto obj = cast(" ~ T.stringof ~ ") other){\n" ~ opEqualsPart!(__traits(derivedMembers, T)) ~ "\treturn true;\n}\nreturn false;"; } abstract class BaseNode : ASTNode { /** List of tokens consumed by this AST node */ const(Token)[] tokens; abstract void accept(ASTVisitor visitor) const; } abstract class ExpressionNode : BaseNode { override void accept(ASTVisitor visitor) const { assert (false); } } mixin template BinaryExpressionBody() { ExpressionNode left; ExpressionNode right; size_t line; size_t column; } /// final class AddExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin OpEquals; /** */ IdType operator; mixin BinaryExpressionBody; } /// final class AliasDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(storageClasses, type, declaratorIdentifierList, initializers, parameters, memberFunctionAttributes)); } mixin OpEquals; /** */ StorageClass[] storageClasses; /** */ Type type; /** */ DeclaratorIdentifierList declaratorIdentifierList; /** */ AliasInitializer[] initializers; /** */ string comment; /** */ Parameters parameters; /** */ MemberFunctionAttribute[] memberFunctionAttributes; } /// final class AliasAssign : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, type)); } mixin OpEquals; /** */ Token identifier; /** */ Type type; /** */ string comment; } /// final class AliasInitializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(name, templateParameters, storageClasses, type, functionLiteralExpression)); } mixin OpEquals; /** */ Token name; /** */ StorageClass[] storageClasses; /** */ TemplateParameters templateParameters; /** */ Type type; /** */ FunctionLiteralExpression functionLiteralExpression; /** */ Parameters parameters; /** */ MemberFunctionAttribute[] memberFunctionAttributes; } /// final class AliasThisDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier)); } mixin OpEquals; /** */ Token identifier; /** */ string comment; } /// final class AlignAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression)); } mixin OpEquals; /** */ ExpressionNode assignExpression; } /// final class AndAndExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin OpEquals; mixin BinaryExpressionBody; } /// final class AndExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin OpEquals; mixin BinaryExpressionBody; } /// final class AnonymousEnumDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(baseType, members)); } mixin OpEquals; /** */ Type baseType; /** */ AnonymousEnumMember[] members; } /// final class AnonymousEnumMember : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, name, assignExpression)); } /** */ Type type; /** */ Token name; /** */ ExpressionNode assignExpression; /** */ string comment; } /// final class ArgumentList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } mixin OpEquals; /** */ ExpressionNode[] items; /** */ size_t startLocation; /** */ size_t endLocation; } /// final class Arguments : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(argumentList)); } mixin OpEquals; /** */ ArgumentList argumentList; } /// final class ArrayInitializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(arrayMemberInitializations)); } mixin OpEquals; /** */ size_t startLocation; /** */ size_t endLocation; /** */ ArrayMemberInitialization[] arrayMemberInitializations; } /// final class ArrayLiteral : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(argumentList)); } mixin OpEquals; /** */ ArgumentList argumentList; } /// final class ArrayMemberInitialization : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression, nonVoidInitializer)); } mixin OpEquals; /** */ ExpressionNode assignExpression; /** */ NonVoidInitializer nonVoidInitializer; } /// final class AsmAddExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin OpEquals; /** */ IdType operator; mixin BinaryExpressionBody; } /// final class AsmAndExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin OpEquals; mixin BinaryExpressionBody; } /// final class AsmBrExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(asmBrExp, asmExp, asmUnaExp)); } mixin OpEquals; size_t line; size_t column; /** */ AsmBrExp asmBrExp; /** */ ExpressionNode asmExp; /** */ AsmUnaExp asmUnaExp; } /// final class AsmEqualExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; /** */ IdType operator; } /// final class AsmExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, middle, right)); } mixin OpEquals; /** */ ExpressionNode left; /** */ ExpressionNode middle; /** */ ExpressionNode right; } /// final class AsmInstruction : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifierOrIntegerOrOpcode, asmInstruction, operands)); } mixin OpEquals; /** */ Token identifierOrIntegerOrOpcode; /** */ bool hasAlign; /** */ bool isLabel; /** */ AsmInstruction asmInstruction; /** */ Operands operands; } /// final class AsmLogAndExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class AsmLogOrExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class AsmMulExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ IdType operator; mixin BinaryExpressionBody; mixin OpEquals; } /// final class AsmOrExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class AsmPrimaryExp : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token, register, asmExp, identifierChain, segmentOverrideSuffix)); } /** */ ExpressionNode asmExp; /** */ IdentifierChain identifierChain; /** */ Register register; /** */ ExpressionNode segmentOverrideSuffix; /** */ Token token; mixin OpEquals; } /// final class AsmRelExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; /** */ IdType operator; mixin OpEquals; } /// final class AsmShiftExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; /** */ IdType operator; mixin OpEquals; } /// final class AsmStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(functionAttributes, asmInstructions, gccAsmInstructions)); } /** */ AsmInstruction[] asmInstructions; /** */ GccAsmInstruction[] gccAsmInstructions; /** */ FunctionAttribute[] functionAttributes; mixin OpEquals; } /// final class AsmTypePrefix : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ Token left; /** */ Token right; mixin OpEquals; } /// final class AsmUnaExp : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(prefix, asmTypePrefix, asmExp, asmPrimaryExp, asmUnaExp)); } /** */ AsmTypePrefix asmTypePrefix; /** */ ExpressionNode asmExp; /** */ Token prefix; /** */ AsmPrimaryExp asmPrimaryExp; /** */ AsmUnaExp asmUnaExp; mixin OpEquals; } /// final class AsmXorExp : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class AssertArguments : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assertion, message)); } /** */ ExpressionNode assertion; /** */ ExpressionNode message; mixin OpEquals; } /// final class AssertExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assertArguments)); } /** */ size_t line; /** */ size_t column; /** */ AssertArguments assertArguments; mixin OpEquals; } /// final class AssignExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(ternaryExpression, expression)); } /** */ ExpressionNode ternaryExpression; /** */ ExpressionNode expression; /** */ IdType operator; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class AssocArrayLiteral : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(keyValuePairs)); } /** */ KeyValuePairs keyValuePairs; mixin OpEquals; } /// final class AtAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateInstance, argumentList)); } /** */ ArgumentList argumentList; /** */ TemplateInstance templateInstance; /** */ Token identifier; /** */ bool useParen; /** */ size_t startLocation; /** */ size_t endLocation; mixin OpEquals; } /// final class Attribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(pragmaExpression, deprecated_, atAttribute, alignAttribute, identifierChain, linkageAttribute)); } /** */ PragmaExpression pragmaExpression; /** */ Deprecated deprecated_; /** */ AtAttribute atAttribute; /** */ AlignAttribute alignAttribute; /** */ LinkageAttribute linkageAttribute; /** */ Token attribute; /** */ IdentifierChain identifierChain; mixin OpEquals; } /// final class AttributeDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(attribute)); } /** */ Attribute attribute; /** */ size_t line; mixin OpEquals; } /// final class AutoDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { foreach (sc; storageClasses) visitor.visit(sc); foreach (part; parts) visitor.visit(part); } /** */ AutoDeclarationPart[] parts; /** */ StorageClass[] storageClasses; /** */ string comment; mixin OpEquals; } final class AutoDeclarationPart : BaseNode { override void accept(ASTVisitor visitor) const { if (templateParameters !is null) visitor.visit(templateParameters); visitor.visit(initializer); } /** */ Token identifier; /** */ Initializer initializer; /** */ TemplateParameters templateParameters; } /// final class BlockStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarationsAndStatements)); } /** * Byte position of the opening brace */ size_t startLocation; /** * Byte position of the closing brace */ size_t endLocation; /** */ DeclarationsAndStatements declarationsAndStatements; mixin OpEquals; } /// final class BreakStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(label)); } /** */ Token label; mixin OpEquals; } /// final class BaseClass : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type2)); } /** */ Type2 type2; mixin OpEquals; } /// final class BaseClassList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ BaseClass[] items; mixin OpEquals; } /// final class CaseRangeStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(low, high, declarationsAndStatements)); } /** */ ExpressionNode low; /** */ ExpressionNode high; /** */ DeclarationsAndStatements declarationsAndStatements; /** */ size_t colonLocation; mixin OpEquals; } /// final class CaseStatement: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(argumentList, declarationsAndStatements)); } /** */ ArgumentList argumentList; /** */ DeclarationsAndStatements declarationsAndStatements; /** */ size_t colonLocation; mixin OpEquals; } /// final class CastExpression: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, castQualifier, unaryExpression)); } /** */ Type type; /** */ CastQualifier castQualifier; /** */ UnaryExpression unaryExpression; mixin OpEquals; } /// final class CastQualifier: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(first, second)); } /** */ Token first; /** */ Token second; mixin OpEquals; } /// final class Catches: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(catches, lastCatch)); } /** */ Catch[] catches; /** */ LastCatch lastCatch; mixin OpEquals; } /// final class Catch: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, identifier, declarationOrStatement)); } /** */ Type type; /** */ Token identifier; /** */ DeclarationOrStatement declarationOrStatement; mixin OpEquals; } /// final class ClassDeclaration: BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateParameters, constraint, baseClassList, structBody)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Constraint constraint; /** */ BaseClassList baseClassList; /** */ StructBody structBody; /** */ string comment; mixin OpEquals; } /// final class CmpExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(shiftExpression, equalExpression, identityExpression, relExpression, inExpression)); } /** */ ExpressionNode shiftExpression; /** */ ExpressionNode equalExpression; /** */ ExpressionNode identityExpression; /** */ ExpressionNode relExpression; /** */ ExpressionNode inExpression; mixin OpEquals; } /// final class CompileCondition : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(versionCondition, debugCondition, staticIfCondition)); } /** */ VersionCondition versionCondition; /** */ DebugCondition debugCondition; /** */ StaticIfCondition staticIfCondition; mixin OpEquals; } /// final class ConditionalDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(compileCondition, trueDeclarations, falseDeclarations)); } /** */ CompileCondition compileCondition; /** */ Declaration[] trueDeclarations; /** */ Declaration[] falseDeclarations; /** */ bool hasElse; /** */ DeclarationListStyle trueStyle; /** */ DeclarationListStyle falseStyle; mixin OpEquals; } /// final class ConditionalStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(compileCondition, trueStatement, falseStatement)); } /** */ CompileCondition compileCondition; /** */ DeclarationOrStatement trueStatement; /** */ DeclarationOrStatement falseStatement; mixin OpEquals; } /// final class Constraint : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression)); } /** */ Expression expression; /** */ size_t location; mixin OpEquals; } /// final class Constructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(parameters, templateParameters, constraint, memberFunctionAttributes, functionBody)); } /** */ Parameters parameters; /** */ FunctionBody functionBody; /** */ Constraint constraint; /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ TemplateParameters templateParameters; /** */ size_t location; /** */ size_t line; /** */ size_t column; /** */ string comment; mixin OpEquals; } /// final class ContinueStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(label)); } /** */ Token label; mixin OpEquals; } /// final class DebugCondition : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifierOrInteger)); } /** */ size_t debugIndex; /** */ Token identifierOrInteger; mixin OpEquals; } /// final class DebugSpecification : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifierOrInteger)); } /** */ Token identifierOrInteger; mixin OpEquals; } /// final class Declaration : BaseNode { override void accept(ASTVisitor visitor) const { foreach (attr; attributes) visitor.visit(attr); foreach (dec; declarations) visitor.visit(dec); foreach (Type; DeclarationTypes) { const(Type)* value = storage.peek!Type; if (value !is null) { static if (isArray!Type) foreach (item; *(cast(Type*) value)) visitor.visit(item); else if (*value !is null) visitor.visit(*(cast(Type*) value)); } } } private import std.variant:Algebraic; private import std.typetuple:TypeTuple; alias DeclarationTypes = TypeTuple!(AliasDeclaration, AliasAssign, AliasThisDeclaration, AnonymousEnumDeclaration, AttributeDeclaration, ClassDeclaration, ConditionalDeclaration, Constructor, DebugSpecification, Destructor, EnumDeclaration, EponymousTemplateDeclaration, FunctionDeclaration, ImportDeclaration, InterfaceDeclaration, Invariant, MixinDeclaration, MixinTemplateDeclaration, Postblit, PragmaDeclaration, SharedStaticConstructor, SharedStaticDestructor, StaticAssertDeclaration, StaticConstructor, StaticDestructor, StructDeclaration, TemplateDeclaration, UnionDeclaration, Unittest, VariableDeclaration, VersionSpecification, StaticForeachDeclaration); private Algebraic!(DeclarationTypes) storage; private static string generateProperty(string type, string name) { return "const(" ~ type ~ ") " ~ name ~ "() const @property { auto p = storage.peek!" ~ type ~ "; return p is null? null : *p;}\n" ~ "const(" ~ type ~ ") " ~ name ~ "(" ~ type ~ " node) @property { storage = node; return node; }"; } /** */ Attribute[] attributes; /** */ Declaration[] declarations; mixin(generateProperty("AliasDeclaration", "aliasDeclaration")); mixin(generateProperty("AliasAssign", "aliasAssign")); mixin(generateProperty("AliasThisDeclaration", "aliasThisDeclaration")); mixin(generateProperty("AnonymousEnumDeclaration", "anonymousEnumDeclaration")); mixin(generateProperty("AttributeDeclaration", "attributeDeclaration")); mixin(generateProperty("ClassDeclaration", "classDeclaration")); mixin(generateProperty("ConditionalDeclaration", "conditionalDeclaration")); mixin(generateProperty("Constructor", "constructor")); mixin(generateProperty("DebugSpecification", "debugSpecification")); mixin(generateProperty("Destructor", "destructor")); mixin(generateProperty("EnumDeclaration", "enumDeclaration")); mixin(generateProperty("EponymousTemplateDeclaration", "eponymousTemplateDeclaration")); mixin(generateProperty("FunctionDeclaration", "functionDeclaration")); mixin(generateProperty("ImportDeclaration", "importDeclaration")); mixin(generateProperty("InterfaceDeclaration", "interfaceDeclaration")); mixin(generateProperty("Invariant", "invariant_")); mixin(generateProperty("MixinDeclaration", "mixinDeclaration")); mixin(generateProperty("MixinTemplateDeclaration", "mixinTemplateDeclaration")); mixin(generateProperty("Postblit", "postblit")); mixin(generateProperty("PragmaDeclaration", "pragmaDeclaration")); mixin(generateProperty("SharedStaticConstructor", "sharedStaticConstructor")); mixin(generateProperty("SharedStaticDestructor", "sharedStaticDestructor")); mixin(generateProperty("StaticAssertDeclaration", "staticAssertDeclaration")); mixin(generateProperty("StaticConstructor", "staticConstructor")); mixin(generateProperty("StaticDestructor", "staticDestructor")); mixin(generateProperty("StructDeclaration", "structDeclaration")); mixin(generateProperty("TemplateDeclaration", "templateDeclaration")); mixin(generateProperty("UnionDeclaration", "unionDeclaration")); mixin(generateProperty("Unittest", "unittest_")); mixin(generateProperty("VariableDeclaration", "variableDeclaration")); mixin(generateProperty("VersionSpecification", "versionSpecification")); mixin(generateProperty("StaticForeachDeclaration", "staticForeachDeclaration")); override bool opEquals(Object other) const { auto otherDeclaration = cast(Declaration) other; if (otherDeclaration is null) return false; return attributes == otherDeclaration.attributes && declarations == otherDeclaration.declarations && storage == otherDeclaration.storage; } } /// final class DeclarationsAndStatements : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarationsAndStatements)); } /** */ DeclarationOrStatement[] declarationsAndStatements; mixin OpEquals; } /// final class DeclarationOrStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declaration, statement)); } /** */ Declaration declaration; /** */ Statement statement; /** */ size_t startLocation; /** */ size_t endLocation; mixin OpEquals; } /// final class Declarator : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateParameters, initializer)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Initializer initializer; /** */ TypeSuffix[] cstyle; /** */ string comment; mixin OpEquals; } /// final class DeclaratorIdentifierList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifiers)); } /** */ Token[] identifiers; mixin OpEquals; } /// final class DefaultStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarationsAndStatements)); } /** */ DeclarationsAndStatements declarationsAndStatements; /** */ size_t colonLocation; mixin OpEquals; } /// final class DeleteExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(unaryExpression)); } /** */ UnaryExpression unaryExpression; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class DeleteStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(deleteExpression)); } /** */ DeleteExpression deleteExpression; mixin OpEquals; } /// final class Deprecated : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression)); } /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class Destructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(memberFunctionAttributes, functionBody)); } /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ FunctionBody functionBody; /** */ size_t line; /** */ size_t column; /** */ size_t index; /** */ string comment; mixin OpEquals; } /// final class DoStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, statementNoCaseNoDefault)); } /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; /** */ Expression expression; mixin OpEquals; } /// final class EnumBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(enumMembers)); } /** */ EnumMember[] enumMembers; /** * Byte position of the opening brace */ size_t startLocation; /** * Byte position of the closing brace */ size_t endLocation; mixin OpEquals; } /// final class EnumDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, enumBody)); } /** */ Token name; /** */ Type type; /** */ EnumBody enumBody; /** */ string comment; mixin OpEquals; } final class EnumMemberAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(deprecated_, atAttribute)); } /** */ Deprecated deprecated_; /** */ AtAttribute atAttribute; mixin OpEquals; } /// final class EnumMember : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(enumMemberAttributes, name, type, assignExpression)); } /** */ EnumMemberAttribute[] enumMemberAttributes; /** */ Token name; /** */ Type type; /** */ ExpressionNode assignExpression; /** */ string comment; mixin OpEquals; } /// final class EponymousTemplateDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(name, templateParameters, assignExpression)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ ExpressionNode assignExpression; /** */ Type type; /** */ string comment; mixin OpEquals; } /// final class EqualExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ IdType operator; mixin BinaryExpressionBody; mixin OpEquals; } /// final class Expression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ ExpressionNode[] items; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class ExpressionStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression)); } /** */ Expression expression; mixin OpEquals; } /// final class FinalSwitchStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(switchStatement)); } /** */ SwitchStatement switchStatement; mixin OpEquals; } /// final class Finally : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarationOrStatement)); } /** */ DeclarationOrStatement declarationOrStatement; mixin OpEquals; } /// final class ForStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(initialization, test, increment, declarationOrStatement)); } /** */ DeclarationOrStatement initialization; /** */ Expression test; /** */ Expression increment; /** */ DeclarationOrStatement declarationOrStatement; /** */ size_t startIndex; mixin OpEquals; } /// final class Foreach(bool declOnly) : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(foreachType, foreachTypeList, low, high)); static if (declOnly) mixin (visitIfNotNull!(declarations)); else mixin (visitIfNotNull!(declarationOrStatement)); } /** */ IdType type; /** */ ForeachTypeList foreachTypeList; /** */ ForeachType foreachType; /** */ Expression low; /** */ Expression high; /** */ size_t startIndex; static if (declOnly) { /** */ Declaration[] declarations; /** */ DeclarationListStyle style; } else { /** */ DeclarationOrStatement declarationOrStatement; } mixin OpEquals; } /// alias StaticForeachDeclaration = Foreach!true; /// alias ForeachStatement = Foreach!false; /// final class StaticForeachStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(foreachStatement)); } /** */ ForeachStatement foreachStatement; mixin OpEquals; } /// final class ForeachType : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, identifier)); } /** */ bool isAlias; /** */ bool isEnum; /** */ bool isRef; /** */ IdType[] typeConstructors; /** */ Type type; /** */ Token identifier; mixin OpEquals; } /// final class ForeachTypeList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ ForeachType[] items; mixin OpEquals; } /// final class FunctionAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token, atAttribute)); } /** */ Token token; /** */ AtAttribute atAttribute; mixin OpEquals; } /// final class FunctionBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(specifiedFunctionBody, missingFunctionBody, shortenedFunctionBody)); } /** */ size_t endLocation; /** */ SpecifiedFunctionBody specifiedFunctionBody; /** */ MissingFunctionBody missingFunctionBody; /** */ ShortenedFunctionBody shortenedFunctionBody; mixin OpEquals; } /// final class FunctionCallExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, unaryExpression, templateArguments, arguments)); } /** */ Type type; /** */ UnaryExpression unaryExpression; /** */ TemplateArguments templateArguments; /** */ Arguments arguments; mixin OpEquals; } /// final class FunctionContract : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(inOutContractExpression, inOutStatement)); } /** */ InOutContractExpression inOutContractExpression; /** */ InOutStatement inOutStatement; mixin OpEquals; } /// final class FunctionDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(attributes, storageClasses, returnType, parameters, templateParameters, constraint, memberFunctionAttributes, functionBody)); } /** */ bool hasAuto; /** */ bool hasRef; /** */ Type returnType; /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Parameters parameters; /** */ Constraint constraint; /** */ FunctionBody functionBody; /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ string comment; /** */ Attribute[] attributes; /** */ StorageClass[] storageClasses; mixin OpEquals; } /// final class FunctionLiteralExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(returnType, parameters, functionAttributes, memberFunctionAttributes, specifiedFunctionBody, assignExpression)); } /** */ ExpressionNode assignExpression; /** */ FunctionAttribute[] functionAttributes; /** */ SpecifiedFunctionBody specifiedFunctionBody; /** */ IdType functionOrDelegate; /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ Parameters parameters; /** */ Token identifier; /** */ Type returnType; /** */ bool isReturnRef; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class GccAsmInstruction : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assemblerTemplate, inputOperands, outputOperands, registers, gotos)); } /** */ Expression assemblerTemplate; /** */ GccAsmOperandList inputOperands; /** */ GccAsmOperandList outputOperands; /** */ StringLiteralList registers; /** */ DeclaratorIdentifierList gotos; mixin OpEquals; } /// final class GccAsmOperand : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, constraint, symbolicName)); } /** */ Token symbolicName; /** */ Token constraint; /** */ ExpressionNode expression; mixin OpEquals; } /// final class GccAsmOperandList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ GccAsmOperand[] items; mixin OpEquals; } /// final class GotoStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(label, expression)); } /** */ Expression expression; /** */ Token label; mixin OpEquals; } /// final class IdentifierChain : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifiers)); } /** */ Token[] identifiers; mixin OpEquals; } /// final class TypeIdentifierPart : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifierOrTemplateInstance, typeIdentifierPart, indexer)); } /** */ bool dot; /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance; /** */ TypeIdentifierPart typeIdentifierPart ; /** */ ExpressionNode indexer; mixin OpEquals; } /// final class IdentifierOrTemplateChain : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifiersOrTemplateInstances)); } /** */ IdentifierOrTemplateInstance[] identifiersOrTemplateInstances; mixin OpEquals; } /// final class IdentifierOrTemplateInstance : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, templateInstance)); } /** */ Token identifier; /** */ TemplateInstance templateInstance; mixin OpEquals; } /// final class IdentityExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ bool negated; mixin BinaryExpressionBody; mixin OpEquals; } /// final class IfStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, type, expression, thenStatement, elseStatement)); } /** */ IdType[] typeCtors; /** */ Type type; /** */ Token identifier; /** */ Expression expression; /** */ DeclarationOrStatement thenStatement; /** */ DeclarationOrStatement elseStatement; /** */ size_t startIndex; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class ImportBind : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ Token left; /** */ Token right; mixin OpEquals; } /// final class ImportBindings : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(singleImport, importBinds)); } /** */ SingleImport singleImport; /** */ ImportBind[] importBinds; mixin OpEquals; } /// final class ImportDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(singleImports, importBindings)); } /** */ SingleImport[] singleImports; /** */ ImportBindings importBindings; /** */ size_t startIndex; /** */ size_t endIndex; mixin OpEquals; } /// final class ImportExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression)); } /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class Index : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(low, high)); } /** */ ExpressionNode low; /** */ ExpressionNode high; mixin OpEquals; } /// final class IndexExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(unaryExpression, indexes)); } /** */ UnaryExpression unaryExpression; /** */ Index[] indexes; mixin OpEquals; } /// final class InContractExpression : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assertArguments)); } /** */ size_t inTokenLocation; /** */ AssertArguments assertArguments; mixin OpEquals; } /// final class InExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; bool negated; mixin OpEquals; } /// final class InOutContractExpression : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(inContractExpression, outContractExpression)); } /** */ InContractExpression inContractExpression; /** */ OutContractExpression outContractExpression; mixin OpEquals; } /// final class InOutStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(inStatement, outStatement)); } /** */ InStatement inStatement; /** */ OutStatement outStatement; mixin OpEquals; } /// final class InStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(blockStatement)); } /** */ size_t inTokenLocation; /** */ BlockStatement blockStatement; mixin OpEquals; } /// final class Initialize : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(statementNoCaseNoDefault)); } /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; mixin OpEquals; } /// final class Initializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(nonVoidInitializer)); } /** */ NonVoidInitializer nonVoidInitializer; mixin OpEquals; } /// final class InterfaceDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateParameters, constraint, baseClassList, structBody)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Constraint constraint; /** */ BaseClassList baseClassList; /** */ StructBody structBody; /** */ string comment; mixin OpEquals; } /// final class Invariant : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(blockStatement, assertArguments)); } /** */ BlockStatement blockStatement; /** */ AssertArguments assertArguments; /** */ bool useParen; /** */ string comment; size_t line; size_t index; mixin OpEquals; } /// final class IsExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, identifier, typeSpecialization, templateParameterList)); } /** */ Type type; /** */ Token identifier; /** */ TypeSpecialization typeSpecialization; /** */ TemplateParameterList templateParameterList; /** */ IdType equalsOrColon; mixin OpEquals; } /// final class KeyValuePair : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(key, value)); } /** */ ExpressionNode key; /** */ ExpressionNode value; mixin OpEquals; } /// final class KeyValuePairs : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(keyValuePairs)); } /** */ KeyValuePair[] keyValuePairs; mixin OpEquals; } /// final class LabeledStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, declarationOrStatement)); } /** */ Token identifier; /** */ DeclarationOrStatement declarationOrStatement; mixin OpEquals; } /// final class LastCatch : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(statementNoCaseNoDefault)); } /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; size_t line; size_t column; mixin OpEquals; } /// final class LinkageAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, typeIdentifierPart, cppNamespaces)); } /** */ Token identifier; /** */ bool hasPlusPlus; /** */ TypeIdentifierPart typeIdentifierPart; /** */ IdType classOrStruct; /** */ NamespaceList cppNamespaces; mixin OpEquals; } /// final class MemberFunctionAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(atAttribute)); } /** */ IdType tokenType; /** */ AtAttribute atAttribute; mixin OpEquals; } /// final class MissingFunctionBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(functionContracts)); } /** */ FunctionContract[] functionContracts; mixin OpEquals; } /// final class MixinDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(mixinExpression, templateMixinExpression)); } /** */ MixinExpression mixinExpression; /** */ TemplateMixinExpression templateMixinExpression; mixin OpEquals; } /// final class MixinExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(argumentList)); } /** */ ArgumentList argumentList; mixin OpEquals; } /// final class MixinTemplateDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateDeclaration)); } /** */ TemplateDeclaration templateDeclaration; mixin OpEquals; } /// final class MixinTemplateName : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(symbol, typeofExpression, identifierOrTemplateChain)); } /** */ Symbol symbol; /** */ IdentifierOrTemplateChain identifierOrTemplateChain; /** */ TypeofExpression typeofExpression; mixin OpEquals; } /// final class Module : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(scriptLine, moduleDeclaration, declarations)); } /** */ Token scriptLine; /** */ ModuleDeclaration moduleDeclaration; /** */ Declaration[] declarations; mixin OpEquals; } /// final class ModuleDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(atAttributes, deprecated_, moduleName)); } /** */ AtAttribute[] atAttributes; /** */ Deprecated deprecated_; /** */ IdentifierChain moduleName; /** */ size_t startLocation; /** */ size_t endLocation; /** */ string comment; mixin OpEquals; } /// final class MulExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ IdType operator; mixin BinaryExpressionBody; mixin OpEquals; } /// final class NamespaceList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } mixin OpEquals; /** */ TernaryExpression[] items; } /// final class NewAnonClassExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(allocatorArguments, constructorArguments, baseClassList, structBody)); } /** */ Arguments allocatorArguments; /** */ Arguments constructorArguments; /** */ BaseClassList baseClassList; /** */ StructBody structBody; mixin OpEquals; } /// final class NewExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(newAnonClassExpression, type, arguments, assignExpression)); } /** */ Type type; /** */ NewAnonClassExpression newAnonClassExpression; /** */ Arguments arguments; /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class StatementNoCaseNoDefault : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(labeledStatement, blockStatement, ifStatement, whileStatement, doStatement, forStatement, foreachStatement, switchStatement, finalSwitchStatement, continueStatement, breakStatement, returnStatement, gotoStatement, withStatement, synchronizedStatement, tryStatement, scopeGuardStatement, asmStatement, pragmaStatement, conditionalStatement, staticAssertStatement, versionSpecification, debugSpecification, expressionStatement, staticForeachStatement)); } /** */ LabeledStatement labeledStatement; /** */ BlockStatement blockStatement; /** */ IfStatement ifStatement; /** */ WhileStatement whileStatement; /** */ DoStatement doStatement; /** */ ForStatement forStatement; /** */ ForeachStatement foreachStatement; /** */ StaticForeachStatement staticForeachStatement; /** */ SwitchStatement switchStatement; /** */ FinalSwitchStatement finalSwitchStatement; /** */ ContinueStatement continueStatement; /** */ BreakStatement breakStatement; /** */ ReturnStatement returnStatement; /** */ GotoStatement gotoStatement; /** */ WithStatement withStatement; /** */ SynchronizedStatement synchronizedStatement; /** */ TryStatement tryStatement; /** */ ScopeGuardStatement scopeGuardStatement; /** */ AsmStatement asmStatement; /** */ PragmaStatement pragmaStatement; /** */ ConditionalStatement conditionalStatement; /** */ StaticAssertStatement staticAssertStatement; /** */ VersionSpecification versionSpecification; /** */ DebugSpecification debugSpecification; /** */ ExpressionStatement expressionStatement; /** */ size_t startLocation; /** */ size_t endLocation; mixin OpEquals; } /// final class NonVoidInitializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression, arrayInitializer, structInitializer)); } /** */ ExpressionNode assignExpression; /** */ ArrayInitializer arrayInitializer; /** */ StructInitializer structInitializer; mixin OpEquals; } /// final class Operands : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(operands)); } /** */ ExpressionNode[] operands; mixin OpEquals; } /// final class OrExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class OrOrExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class OutContractExpression : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(parameter, assertArguments)); } /** */ size_t outTokenLocation; /** */ Token parameter; /** */ AssertArguments assertArguments; mixin OpEquals; } /// final class OutStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(parameter, blockStatement)); } /** */ size_t outTokenLocation; /** */ Token parameter; /** */ BlockStatement blockStatement; mixin OpEquals; } final class ParameterAttribute : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(atAttribute)); } /** */ IdType idType; /** */ AtAttribute atAttribute; } /// final class Parameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, name, default_)); } /** */ ParameterAttribute[] parameterAttributes; /** */ Type type; /** */ Token name; /** */ bool vararg; /** */ ExpressionNode default_; /** */ TypeSuffix[] cstyle; mixin OpEquals; } /// final class Parameters : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(parameters)); } /** */ Parameter[] parameters; /** */ bool hasVarargs; /** */ ParameterAttribute[] varargsAttributes; mixin OpEquals; } /// final class Postblit : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(functionBody)); } /** */ FunctionBody functionBody; /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ size_t location; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class PowExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } /// final class PragmaDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(pragmaExpression)); } /** */ PragmaExpression pragmaExpression; mixin OpEquals; } /// final class PragmaExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, argumentList)); } /** */ Token identifier; /** */ ArgumentList argumentList; mixin OpEquals; } /// final class PragmaStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(pragmaExpression, statement, blockStatement)); } /** */ PragmaExpression pragmaExpression; /** */ Statement statement; /** */ BlockStatement blockStatement; mixin OpEquals; } /// final class PrimaryExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin(visitIfNotNull!(basicType, typeConstructor, type, primary, typeofExpression, typeidExpression, arrayLiteral, assocArrayLiteral, expression, dot, identifierOrTemplateInstance, isExpression, functionLiteralExpression,traitsExpression, mixinExpression, importExpression, vector, arguments)); } /** */ Token dot; /** */ Token primary; /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance; /** */ Token basicType; /** */ TypeofExpression typeofExpression; /** */ TypeidExpression typeidExpression; /** */ ArrayLiteral arrayLiteral; /** */ AssocArrayLiteral assocArrayLiteral; /** */ Expression expression; /** */ IsExpression isExpression; /** */ FunctionLiteralExpression functionLiteralExpression; /** */ TraitsExpression traitsExpression; /** */ MixinExpression mixinExpression; /** */ ImportExpression importExpression; /** */ Vector vector; /** */ Type type; /** */ Token typeConstructor; /** */ Arguments arguments; mixin OpEquals; } /// final class Register : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, intLiteral)); } /** */ Token identifier; /** */ Token intLiteral; /** */ bool hasIntegerLiteral; mixin OpEquals; } /// final class RelExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ IdType operator; mixin BinaryExpressionBody; mixin OpEquals; } /// final class ReturnStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression)); } /** */ Expression expression; /** */ size_t startLocation; /** */ size_t endLocation; mixin OpEquals; } /// final class ScopeGuardStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, statementNoCaseNoDefault)); } /** */ Token identifier; /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; mixin OpEquals; } /// final class SharedStaticConstructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(memberFunctionAttributes, functionBody)); } /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ FunctionBody functionBody; /** */ size_t location; /** */ size_t line; /** */ size_t column; /** */ string comment; mixin OpEquals; } /// final class SharedStaticDestructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(memberFunctionAttributes, functionBody)); } /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ FunctionBody functionBody; /** */ size_t location; /** */ size_t line; /** */ size_t column; /** */ string comment; mixin OpEquals; } /// final class ShiftExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } /** */ IdType operator; mixin BinaryExpressionBody; mixin OpEquals; } /// final class SingleImport : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(rename, identifierChain)); } /** */ Token rename; /** */ IdentifierChain identifierChain; mixin OpEquals; } /// final class SpecifiedFunctionBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(functionContracts, blockStatement)); } /** */ FunctionContract[] functionContracts; /** */ BlockStatement blockStatement; /** */ bool hasDo; mixin OpEquals; } /// final class ShortenedFunctionBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin(visitIfNotNull!(functionContracts, expression)); } /** */ FunctionContract[] functionContracts; /** */ Expression expression; mixin OpEquals; } /// final class Statement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(statementNoCaseNoDefault, caseStatement, caseRangeStatement, defaultStatement)); } /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; /** */ CaseStatement caseStatement; /** */ CaseRangeStatement caseRangeStatement; /** */ DefaultStatement defaultStatement; mixin OpEquals; } /// final class StaticAssertDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(staticAssertStatement)); } /** */ StaticAssertStatement staticAssertStatement; mixin OpEquals; } /// final class StaticAssertStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assertExpression)); } /** */ AssertExpression assertExpression; mixin OpEquals; } /// final class StaticConstructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(memberFunctionAttributes, functionBody)); } /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ FunctionBody functionBody; /** */ size_t location; /** */ size_t line; /** */ size_t column; /** */ string comment; mixin OpEquals; } /// final class StaticDestructor : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(memberFunctionAttributes, functionBody)); } /** */ MemberFunctionAttribute[] memberFunctionAttributes; /** */ FunctionBody functionBody; /** */ size_t location; /** */ size_t line; /** */ size_t column; /** */ string comment; mixin OpEquals; } /// final class StaticIfCondition : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(assignExpression)); } /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class StorageClass : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token, alignAttribute, linkageAttribute, atAttribute, deprecated_)); } /** */ AlignAttribute alignAttribute; /** */ LinkageAttribute linkageAttribute; /** */ AtAttribute atAttribute; /** */ Deprecated deprecated_; /** */ Token token; mixin OpEquals; } /// final class StringLiteralList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ Token[] items; mixin OpEquals; } /// final class StructBody : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarations)); } /** * Byte position of the opening brace */ size_t startLocation; /** * Byte position of the closing brace */ size_t endLocation; /** */ Declaration[] declarations; mixin OpEquals; } /// final class StructDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateParameters, constraint, structBody)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Constraint constraint; /** */ StructBody structBody; /** */ string comment; mixin OpEquals; } /// final class StructInitializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(structMemberInitializers)); } /** */ StructMemberInitializers structMemberInitializers; /** */ size_t startLocation; /** */ size_t endLocation; mixin OpEquals; } /// final class StructMemberInitializer : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, nonVoidInitializer)); } /** */ Token identifier; /** */ NonVoidInitializer nonVoidInitializer; mixin OpEquals; } /// final class StructMemberInitializers : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(structMemberInitializers)); } /** */ StructMemberInitializer[] structMemberInitializers; mixin OpEquals; } /// final class SwitchStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, statement)); } /** */ Expression expression; /** */ Statement statement; mixin OpEquals; } /// final class Symbol : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifierOrTemplateChain)); } /** */ IdentifierOrTemplateChain identifierOrTemplateChain; /** */ bool dot; mixin OpEquals; } /// final class SynchronizedStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, statementNoCaseNoDefault)); } /** */ Expression expression; /** */ StatementNoCaseNoDefault statementNoCaseNoDefault; mixin OpEquals; } /// final class TemplateAliasParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, identifier, colonType, colonExpression, assignType, assignExpression)); } /** */ Type type; /** */ Token identifier; /** */ Type colonType; /** */ ExpressionNode colonExpression; /** */ Type assignType; /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class TemplateArgument : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, assignExpression)); } /** */ Type type; /** */ ExpressionNode assignExpression; mixin OpEquals; } /// final class TemplateArgumentList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ TemplateArgument[] items; mixin OpEquals; } /// final class TemplateArguments : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateArgumentList, templateSingleArgument)); } /** */ TemplateArgumentList templateArgumentList; /** */ TemplateSingleArgument templateSingleArgument; mixin OpEquals; } /// final class TemplateDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(name, templateParameters, constraint, declarations)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Constraint constraint; /** */ Declaration[] declarations; /** */ string comment; /** * Byte position of the opening brace */ size_t startLocation; /** * Byte position of the closing brace */ size_t endLocation; mixin OpEquals; } /// final class TemplateInstance : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, templateArguments)); } /** */ Token identifier; /** */ TemplateArguments templateArguments; mixin OpEquals; } /// final class TemplateMixinExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, templateArguments, mixinTemplateName)); } /** */ Token identifier; /** */ TemplateArguments templateArguments; /** */ MixinTemplateName mixinTemplateName; mixin OpEquals; } /// final class TemplateParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateTypeParameter, templateValueParameter, templateAliasParameter, templateTupleParameter, templateThisParameter)); } /** */ TemplateTypeParameter templateTypeParameter; /** */ TemplateValueParameter templateValueParameter; /** */ TemplateAliasParameter templateAliasParameter; /** */ TemplateTupleParameter templateTupleParameter; /** */ TemplateThisParameter templateThisParameter; mixin OpEquals; } /// final class TemplateParameterList : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(items)); } /** */ TemplateParameter[] items; mixin OpEquals; } /// final class TemplateParameters : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateParameterList)); } /** */ TemplateParameterList templateParameterList; mixin OpEquals; } /// final class TemplateSingleArgument : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token)); } /** */ Token token; mixin OpEquals; } /// final class TemplateThisParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(templateTypeParameter)); } /** */ TemplateTypeParameter templateTypeParameter; mixin OpEquals; } /// final class TemplateTupleParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier)); } /** */ Token identifier; mixin OpEquals; } /// final class TemplateTypeParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, colonType, assignType)); } /** */ Token identifier; /** */ Type colonType; /** */ Type assignType; mixin OpEquals; } /// final class TemplateValueParameter : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, identifier, assignExpression, templateValueParameterDefault)); } /** */ Type type; /** */ Token identifier; /** */ ExpressionNode assignExpression; /** */ TemplateValueParameterDefault templateValueParameterDefault; mixin OpEquals; } /// final class TemplateValueParameterDefault : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token, assignExpression)); } /** */ ExpressionNode assignExpression; /** */ Token token; mixin OpEquals; } /// final class TernaryExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(orOrExpression, expression, ternaryExpression)); } /** */ ExpressionNode orOrExpression; /** */ ExpressionNode expression; /** */ ExpressionNode ternaryExpression; /// Store this so that we know where the ':' is Token colon; mixin OpEquals; } deprecated("Replaced by ExpressionStatement + ThrowExpression") alias ThrowStatement = ThrowExpression; /// final class ThrowExpression: ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression)); } /** */ ExpressionNode expression; mixin OpEquals; } /// final class TraitsExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(identifier, templateArgumentList)); } /** */ Token identifier; /** */ TemplateArgumentList templateArgumentList; mixin OpEquals; } /// final class TryStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(declarationOrStatement, catches, finally_)); } /** */ DeclarationOrStatement declarationOrStatement; /** */ Catches catches; /** */ Finally finally_; mixin OpEquals; } /// final class Type : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type2, typeSuffixes)); } /** */ IdType[] typeConstructors; /** */ TypeSuffix[] typeSuffixes; /** */ Type2 type2; mixin OpEquals; } /// final class Type2 : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(typeofExpression, typeIdentifierPart, type, traitsExpression, vector, mixinExpression)); } /** */ IdType builtinType; /** */ alias superOrThis = builtinType; /** */ TypeofExpression typeofExpression; /** */ TypeIdentifierPart typeIdentifierPart; /** */ IdType typeConstructor; /** */ Type type; /** */ TraitsExpression traitsExpression; /** */ Vector vector; /** */ MixinExpression mixinExpression; mixin OpEquals; } /// final class TypeSpecialization : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token, type)); } /** */ Token token; /** */ Type type; mixin OpEquals; } /// final class TypeSuffix : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, low, high, delegateOrFunction, parameters, memberFunctionAttributes)); } /** */ Token delegateOrFunction; /** */ Token star; /** */ bool array; /** */ Type type; /** */ ExpressionNode low; /** */ ExpressionNode high; /** */ Parameters parameters; /** */ MemberFunctionAttribute[] memberFunctionAttributes; mixin OpEquals; } /// final class TypeidExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type, expression)); } /** */ Type type; /** */ Expression expression; mixin OpEquals; } /// final class TypeofExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, return_)); } /** */ Expression expression; /** */ Token return_; mixin OpEquals; } /// final class UnaryExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { // TODO prefix, postfix, unary mixin (visitIfNotNull!(primaryExpression, newExpression, deleteExpression, castExpression, functionCallExpression, argumentList, unaryExpression, type, identifierOrTemplateInstance, assertExpression, throwExpression, indexExpression)); } /** */ Type type; /** */ PrimaryExpression primaryExpression; /** */ Token prefix; /** */ Token suffix; /** */ UnaryExpression unaryExpression; /** */ NewExpression newExpression; /** */ DeleteExpression deleteExpression; /** */ CastExpression castExpression; /** */ FunctionCallExpression functionCallExpression; /** */ ArgumentList argumentList; /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance; /** */ AssertExpression assertExpression; /** */ ThrowExpression throwExpression; /** */ IndexExpression indexExpression; /** */ size_t dotLocation; mixin OpEquals; } /// final class UnionDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(name, templateParameters, constraint, structBody)); } /** */ Token name; /** */ TemplateParameters templateParameters; /** */ Constraint constraint; /** */ StructBody structBody; /** */ string comment; mixin OpEquals; } /// final class Unittest : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(blockStatement)); } /** */ BlockStatement blockStatement; /** */ string comment; /** */ size_t location; /** */ size_t line; /** */ size_t column; mixin OpEquals; } /// final class VariableDeclaration : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(storageClasses, type, declarators, autoDeclaration)); } /** */ Type type; /** */ Declarator[] declarators; /** */ StorageClass[] storageClasses; /** */ AutoDeclaration autoDeclaration; /** */ string comment; mixin OpEquals; } /// final class Vector : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(type)); } /** */ Type type; mixin OpEquals; } /// final class VersionCondition : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token)); } /** */ size_t versionIndex; /** */ Token token; mixin OpEquals; } /// final class VersionSpecification : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(token)); } /** */ Token token; mixin OpEquals; } /// final class WhileStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, declarationOrStatement)); } /** */ Expression expression; /** */ DeclarationOrStatement declarationOrStatement; /** */ size_t startIndex; mixin OpEquals; } /// final class WithStatement : BaseNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(expression, declarationOrStatement)); } /** */ Expression expression; /** */ DeclarationOrStatement declarationOrStatement; mixin OpEquals; } /// final class XorExpression : ExpressionNode { override void accept(ASTVisitor visitor) const { mixin (visitIfNotNull!(left, right)); } mixin BinaryExpressionBody; mixin OpEquals; } unittest // issue #133 { import dparse.lexer, dparse.parser, dparse.rollback_allocator; string src = q{module test133; void main(){}}; final class TkTest : ASTVisitor { alias visit = ASTVisitor.visit; override void visit(const Token t){assert(t.text.length);} } RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = ParserConfig(getTokensForParser(src, cf, &ca), "", &ra).parseModule(); TkTest t = new TkTest; t.visit(m); } unittest // issue #165 { import dparse.lexer, dparse.parser, dparse.rollback_allocator; string src = q{module test165; enum foo(T) = bar!T;}; final class EpoTest : ASTVisitor { bool visited; alias visit = ASTVisitor.visit; override void visit(const EponymousTemplateDeclaration){visited = true;} } RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = ParserConfig(getTokensForParser(src, cf, &ca), "", &ra).parseModule(); EpoTest et = new EpoTest; et.visit(m); assert(et.visited); } unittest // issue #156 { import dparse.lexer, dparse.parser, dparse.rollback_allocator; final class Test : ASTVisitor { bool arrIndex, arrValue, arrValueOnly, aaLiteral; alias visit = ASTVisitor.visit; override void visit(const ArrayInitializer ai) { if (ai.arrayMemberInitializations.length == 1) { arrIndex = ai.arrayMemberInitializations[0].assignExpression !is null; arrValue = ai.arrayMemberInitializations[0].nonVoidInitializer !is null; arrValueOnly = arrValue && !arrIndex; } } override void visit(const AssocArrayLiteral aal) { aaLiteral = true; } } RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); { // no colon so array. string src1 = q{void main(){const arr = [[0]];}}; Module m = parseModule(ParserConfig(getTokensForParser(src1, cf, &ca), "", &ra)); Test t = new Test; t.visit(m); assert(t.arrValueOnly); } { // simple primary before colon, assume array. string src2 = q{void main(){const arr = [0:0];}}; Module m = ParserConfig(getTokensForParser(src2, cf, &ca), "", &ra).parseModule(); Test t = new Test; t.visit(m); assert(t.arrIndex); assert(t.arrValue); assert(!t.aaLiteral); } { // more complex exp before colon, assume AA. string src3 = q{void main(){const arr = [[0]:0];}}; Module m = ParserConfig(getTokensForParser(src3, cf, &ca), "", &ra).parseModule(); Test t = new Test; t.visit(m); assert(!t.arrIndex); assert(!t.arrValue); assert(t.aaLiteral); } } unittest // issue #170, issue #316 { import dparse.lexer, dparse.parser, dparse.rollback_allocator; abstract class TestCase : ASTVisitor { string src; bool visited; this() { RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = ParserConfig(getTokensForParser(src, cf, &ca), "", &ra).parseModule(); visit(m); assert(visited); } } class FunctionLiteralExpressionTestCase : TestCase { alias visit = ASTVisitor.visit; override void visit(const FunctionLiteralExpression){visited = true;} } class StructInitializerTestCase : TestCase { alias visit = ASTVisitor.visit; override void visit(const StructInitializer){visited = true;} } new class FunctionLiteralExpressionTestCase {this(){ TestCase.src = q{ void function() a = {call();};}; super(); }}; new class FunctionLiteralExpressionTestCase {this(){ TestCase.src = q{ const a = {int i;};}; super(); }}; new class FunctionLiteralExpressionTestCase {this(){ TestCase.src = q{ const a = {};}; super(); }}; new class StructInitializerTestCase {this(){ TestCase.src = q{A a = {member : call()};}; super(); }}; new class StructInitializerTestCase {this(){ TestCase.src = q{A a = {0};}; super(); }}; } unittest // issue #193 { import dparse.lexer, dparse.parser, dparse.rollback_allocator; final class Test193 : ASTVisitor { static string src = q{const(Type1[immutable(Type2)]) qualAarray;}; size_t tc; alias visit = ASTVisitor.visit; override void visit(const TypeIdentifierPart tip) { tip.accept(this); assert(tip.indexer is null); } override void visit(const Type type) { tc++; if (tc == 1) //const( { assert(type.type2.typeConstructor == tok!"const"); assert(type.type2.typeIdentifierPart is null); } else if (tc == 2) //const(Type1 { assert(type.typeConstructors.length == 0); assert(type.type2.typeIdentifierPart.identifierOrTemplateInstance .identifier.text == "Type1"); assert(type.typeSuffixes.length == 1); } else if (tc == 3) // immutable( { assert(type.type2.typeConstructor == tok!"immutable"); assert(type.type2.typeIdentifierPart is null); } else if (tc == 4) // immutable(Type2 { assert(type.typeConstructors.length == 0); assert(type.type2.typeIdentifierPart.identifierOrTemplateInstance .identifier.text == "Type2"); assert(type.typeSuffixes.length == 0); } type.accept(this); } } RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = ParserConfig(getTokensForParser(Test193.src, cf, &ca), "", &ra).parseModule(); Test193 t193 = new Test193; t193.visit(m); } unittest // there used to be a small regression when adding the ParserConfig { import dparse.lexer, dparse.parser, dparse.rollback_allocator; auto src = q{module m;}; RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m1 = parseModule(getTokensForParser(src, cf, &ca), "", &ra , null); Module m2 = parseModule(getTokensForParser(src, cf, &ca), "", &ra); } unittest //#318 : used to segfault { import dparse.lexer, dparse.parser, dparse.rollback_allocator; auto src = q{ auto a = new TestClass( }; RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); static void shut(string, size_t, size_t, string ,bool){} Module m1 = parseModule(getTokensForParser(src, cf, &ca), "", &ra , &shut); } unittest //#365 : used to segfault { import dparse.lexer, dparse.parser, dparse.rollback_allocator; auto src = " o[{scope(x "; RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); static void shut(string, size_t, size_t, string ,bool){} Module m1 = parseModule(getTokensForParser(src, cf, &ca), "", &ra , &shut); } unittest // issue #398: Support extern(C++, <string expressions...>) { import dparse.lexer : LexerConfig; import dparse.parser : ParserConfig, parseModule; import dparse.rollback_allocator : RollbackAllocator; RollbackAllocator ra; StringCache ca = StringCache(16); const(PrimaryExpression)[] getNamespaces(const string sourceCode) { final class Test398 : ASTVisitor { alias visit = ASTVisitor.visit; const(PrimaryExpression)[] namespaces; override void visit(const LinkageAttribute link) { assert(link.identifier.text == "C"); assert(link.hasPlusPlus); assert(!link.typeIdentifierPart); assert(!link.classOrStruct); assert(link.cppNamespaces); super.visit(link); } override void visit(const NamespaceList list) { assert(list.items.length); assert(!namespaces); foreach (const entry; list.items) { const prim = cast(PrimaryExpression) entry.expression; assert(prim); namespaces ~= prim; } } } LexerConfig cf = LexerConfig("", StringBehavior.source); Module m = ParserConfig(getTokensForParser(sourceCode, cf, &ca), "", &ra).parseModule(); scope visitor = new Test398(); visitor.visit(m); return visitor.namespaces; } void checkText(const PrimaryExpression pe, const string exp) { assert(pe); const act = pe.primary.text; assert(act == exp, '<' ~ act ~ '>'); } auto ns = getNamespaces(`extern(C++, "foo") int i;`); assert(ns.length == 1); checkText(ns[0], `"foo"`); ns = getNamespaces(`extern(C++, "foo", "bar", "baz",) int i;`); assert(ns.length == 3); checkText(ns[0], `"foo"`); checkText(ns[1], `"bar"`); checkText(ns[2], `"baz"`); } unittest // Differentiate between no and empty DDOC comments, e.g. for DDOC unittests { import dparse.lexer, dparse.parser, dparse.rollback_allocator; auto src = q{ /// unittest {} /// @safe pure unittest {} /****/ unittest {} /++++/ unittest {} /// This is a comment! unittest {} unittest {} }; RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = parseModule(getTokensForParser(src, cf, &ca), "", &ra); final class UnittestVisitor : ASTVisitor { alias visit = ASTVisitor.visit; bool[size_t] found; override void visit(const Unittest test) { assert(test.line !in found); found[test.line] = true; switch (test.line) { case 3, 6, 8, 10: assert(test.comment !is null); assert(test.comment == ""); break; case 13: assert(test.comment == "This is a comment!"); break; case 15: assert(test.comment is null); break; default: assert(false, format("Unknown line: %d", test.line)); } } } scope visitor = new UnittestVisitor(); visitor.visit(m); assert(visitor.found.length == 6); } unittest // Support GCC-sytle asm statements { static void verify(T)(const string code, void function(scope const T) handler) { import dparse.lexer, dparse.parser, dparse.rollback_allocator; RollbackAllocator ra; LexerConfig cf = LexerConfig("", StringBehavior.source); StringCache ca = StringCache(16); Module m = parseModule(getTokensForParser("void main() { " ~ code ~ '}', cf, &ca), "", &ra); final class AsmVisitor : ASTVisitor { alias visit = ASTVisitor.visit; bool found; override void visit(const T node) { assert(!found); found = true; handler(node); } } scope visitor = new AsmVisitor(); visitor.visit(m); assert(visitor.found); } static void first(scope const AsmStatement stmt) { assert(stmt.asmInstructions.length == 0); assert(stmt.gccAsmInstructions.length == 1); with (stmt.gccAsmInstructions[0]) { assert(assemblerTemplate); assert(assemblerTemplate.tokens.length == 1); assert(assemblerTemplate.tokens[0].type == tok!"stringLiteral"); assert(assemblerTemplate.tokens[0].text == `"mov %0, EAX"`); assert(outputOperands); assert(outputOperands.items.length == 1); with (outputOperands.items[0]) { assert(constraint.type == tok!"stringLiteral"); assert(constraint.text == `"=r"`); auto una = cast(UnaryExpression) expression; assert(una); assert(una.primaryExpression.identifierOrTemplateInstance.identifier.text == "var1"); } } } verify(q{ asm { "mov %0, EAX" : "=r" (var1) ; } }, &first); static void second(scope const AsmStatement stmt) { first(stmt); with (stmt.gccAsmInstructions[0]) { assert(inputOperands); assert(inputOperands.items.length == 2); with (inputOperands.items[0]) { assert(symbolicName.type == tok!"identifier"); assert(symbolicName.text == "xy"); assert(constraint.type == tok!"stringLiteral"); assert(constraint.text == `"=w"`); auto una = cast(UnaryExpression) expression; assert(una); assert(una.primaryExpression.identifierOrTemplateInstance.identifier.text == "var2"); } with (inputOperands.items[1]) { assert(constraint.type == tok!"stringLiteral"); assert(constraint.text == `"g"`); auto una = cast(UnaryExpression) expression; assert(una); assert(una.primaryExpression.identifierOrTemplateInstance.identifier.text == "var3"); } } } verify(q{ asm { "mov %0, EAX" : "=r" (var1) : [xy] "=w" (var2), "g" (var3); } }, &second); verify(q{ asm { "mov %0, EAX" : "=r" (var1) : [xy] "=w" (var2), "g" (var3) : "r0" ; } }, (scope const AsmStatement stmt) { second(stmt); with (stmt.gccAsmInstructions[0]) { assert(registers); assert(registers.items.length == 1); assert(registers.items[0].type == tok!"stringLiteral"); assert(registers.items[0].text == `"r0"`); } }); verify(q{ asm { "mov EBX, EAX" : : : "r0", "r1" ; } }, (scope const GccAsmInstruction instr) { with (instr) { assert(registers); assert(registers.items.length == 2); assert(registers.items[0].type == tok!"stringLiteral"); assert(registers.items[0].text == `"r0"`); assert(registers.items[1].type == tok!"stringLiteral"); assert(registers.items[1].text == `"r1"`); } }); verify(q{ asm { "jmp LEnd" : : : : LEnd ; } }, (scope const GccAsmInstruction instr) { with (instr) { assert(gotos); assert(gotos.identifiers.length == 1); assert(gotos.identifiers[0].type == tok!"identifier"); assert(gotos.identifiers[0].text == `LEnd`); } }); }