@@ -493,6 +493,16 @@ export namespace $ast {
493
493
readonly $ : "Parens" ;
494
494
readonly child : parens ;
495
495
} > ;
496
+ export type MapLiteral = $ . Located < {
497
+ readonly $ : "MapLiteral" ;
498
+ readonly typeArgs : typeArgs ;
499
+ readonly fields : commaList < mapField > | undefined ;
500
+ } > ;
501
+ export type SetLiteral = $ . Located < {
502
+ readonly $ : "SetLiteral" ;
503
+ readonly typeArgs : typeArgs ;
504
+ readonly fields : commaList < expression > | undefined ;
505
+ } > ;
496
506
export type StructInstance = $ . Located < {
497
507
readonly $ : "StructInstance" ;
498
508
readonly type : TypeId ;
@@ -528,6 +538,8 @@ export namespace $ast {
528
538
| Tensor
529
539
| Tuple
530
540
| Parens
541
+ | MapLiteral
542
+ | SetLiteral
531
543
| StructInstance
532
544
| IntegerLiteral
533
545
| BoolLiteral
@@ -542,6 +554,10 @@ export namespace $ast {
542
554
readonly name : Id ;
543
555
readonly init : expression | undefined ;
544
556
} > ;
557
+ export type mapField = {
558
+ readonly key : expression ;
559
+ readonly value : expression ;
560
+ } ;
545
561
export type ParameterList < T > = $ . Located < {
546
562
readonly $ : "ParameterList" ;
547
563
readonly values : commaList < T > | undefined ;
@@ -2290,6 +2306,48 @@ export const Parens: $.Parser<$ast.Parens> = $.loc(
2290
2306
) ,
2291
2307
) ,
2292
2308
) ;
2309
+ export const MapLiteral : $ . Parser < $ast . MapLiteral > = $ . loc (
2310
+ $ . field (
2311
+ $ . pure ( "MapLiteral" ) ,
2312
+ "$" ,
2313
+ $ . right (
2314
+ keyword ( $ . str ( "map" ) ) ,
2315
+ $ . field (
2316
+ typeArgs ,
2317
+ "typeArgs" ,
2318
+ $ . right (
2319
+ $ . str ( "{" ) ,
2320
+ $ . field (
2321
+ $ . opt ( commaList ( $ . lazy ( ( ) => mapField ) ) ) ,
2322
+ "fields" ,
2323
+ $ . right ( $ . str ( "}" ) , $ . eps ) ,
2324
+ ) ,
2325
+ ) ,
2326
+ ) ,
2327
+ ) ,
2328
+ ) ,
2329
+ ) ;
2330
+ export const SetLiteral : $ . Parser < $ast . SetLiteral > = $ . loc (
2331
+ $ . field (
2332
+ $ . pure ( "SetLiteral" ) ,
2333
+ "$" ,
2334
+ $ . right (
2335
+ $ . str ( "set" ) ,
2336
+ $ . field (
2337
+ typeArgs ,
2338
+ "typeArgs" ,
2339
+ $ . right (
2340
+ $ . str ( "{" ) ,
2341
+ $ . field (
2342
+ $ . opt ( commaList ( expression ) ) ,
2343
+ "fields" ,
2344
+ $ . right ( $ . str ( "}" ) , $ . eps ) ,
2345
+ ) ,
2346
+ ) ,
2347
+ ) ,
2348
+ ) ,
2349
+ ) ,
2350
+ ) ;
2293
2351
export const StructInstance : $ . Parser < $ast . StructInstance > = $ . loc (
2294
2352
$ . field (
2295
2353
$ . pure ( "StructInstance" ) ,
@@ -2380,16 +2438,25 @@ export const primary: $.Parser<$ast.primary> = $.alt(
2380
2438
$ . alt (
2381
2439
Parens ,
2382
2440
$ . alt (
2383
- StructInstance ,
2441
+ MapLiteral ,
2384
2442
$ . alt (
2385
- IntegerLiteral ,
2443
+ SetLiteral ,
2386
2444
$ . alt (
2387
- BoolLiteral ,
2445
+ StructInstance ,
2388
2446
$ . alt (
2389
- InitOf ,
2447
+ IntegerLiteral ,
2390
2448
$ . alt (
2391
- CodeOf ,
2392
- $ . alt ( Null , $ . alt ( StringLiteral , Id ) ) ,
2449
+ BoolLiteral ,
2450
+ $ . alt (
2451
+ InitOf ,
2452
+ $ . alt (
2453
+ CodeOf ,
2454
+ $ . alt (
2455
+ Null ,
2456
+ $ . alt ( StringLiteral , Id ) ,
2457
+ ) ,
2458
+ ) ,
2459
+ ) ,
2393
2460
) ,
2394
2461
) ,
2395
2462
) ,
@@ -2415,6 +2482,11 @@ export const StructFieldInitializer: $.Parser<$ast.StructFieldInitializer> =
2415
2482
) ,
2416
2483
) ,
2417
2484
) ;
2485
+ export const mapField : $ . Parser < $ast . mapField > = $ . field (
2486
+ expression ,
2487
+ "key" ,
2488
+ $ . right ( $ . str ( ":" ) , $ . field ( expression , "value" , $ . eps ) ) ,
2489
+ ) ;
2418
2490
export const ParameterList = < T > (
2419
2491
T : $ . Parser < T > ,
2420
2492
) : $ . Parser < $ast . ParameterList < T > > =>
0 commit comments