Commit c7485d7
committed
compiler: introduce ZonGen and make
Currently, `zig ast-check` fails on ZON files, because it tries to
interpret the file as Zig source code. This commit introduces a new
verification pass, `std.zig.ZonGen`, which applies to an AST in ZON
mode.
Like `AstGen`, this pass also converts the AST into a more helpful
format. Rather than a sequence of instructions like `Zir`, the output
format of `ZonGen` is a new datastructure called `Zoir`. This type is
essentially a simpler form of AST, containing only the information
required for consumers of ZON. It is also far more compact than
`std.zig.Ast`, with the size generally being comparable to the size of
the well-formatted source file.
The emitted `Zoir` is currently not used aside from the `-t` option to
`ast-check` which causes it to be dumped to stdout. However, in future,
it can be used for comptime `@import` of ZON files, as well as for
simpler handling of files like `build.zig.zon`, and even by other parts
of the Zig Standard Library.
Resolves: #22078ast-check run it for ZON inputs1 parent d12c0bf commit c7485d7
File tree
9 files changed
+1531
-191
lines changed- lib/std
- zig
- src
9 files changed
+1531
-191
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
11413 | 11415 | | |
11414 | 11416 | | |
11415 | 11417 | | |
11416 | | - | |
11417 | | - | |
11418 | | - | |
11419 | | - | |
11420 | | - | |
11421 | | - | |
11422 | | - | |
11423 | | - | |
11424 | | - | |
11425 | | - | |
11426 | | - | |
11427 | | - | |
11428 | | - | |
11429 | | - | |
11430 | | - | |
11431 | | - | |
11432 | | - | |
11433 | | - | |
11434 | | - | |
11435 | | - | |
11436 | | - | |
11437 | | - | |
11438 | | - | |
11439 | | - | |
11440 | | - | |
11441 | | - | |
11442 | | - | |
11443 | | - | |
11444 | | - | |
11445 | | - | |
11446 | | - | |
11447 | | - | |
11448 | | - | |
11449 | | - | |
11450 | | - | |
11451 | | - | |
11452 | | - | |
11453 | | - | |
11454 | | - | |
11455 | | - | |
11456 | | - | |
11457 | | - | |
11458 | | - | |
11459 | | - | |
11460 | | - | |
11461 | | - | |
11462 | | - | |
11463 | | - | |
11464 | | - | |
11465 | | - | |
11466 | | - | |
11467 | | - | |
11468 | | - | |
11469 | | - | |
11470 | | - | |
11471 | | - | |
11472 | | - | |
11473 | | - | |
11474 | | - | |
11475 | | - | |
11476 | | - | |
11477 | | - | |
11478 | | - | |
11479 | | - | |
11480 | | - | |
11481 | | - | |
11482 | | - | |
11483 | | - | |
11484 | | - | |
11485 | | - | |
11486 | | - | |
11487 | | - | |
11488 | | - | |
11489 | | - | |
11490 | | - | |
11491 | | - | |
11492 | | - | |
| 11418 | + | |
11493 | 11419 | | |
11494 | 11420 | | |
11495 | 11421 | | |
| |||
14019 | 13945 | | |
14020 | 13946 | | |
14021 | 13947 | | |
| 13948 | + | |
14022 | 13949 | | |
14023 | 13950 | | |
14024 | 13951 | | |
14025 | | - | |
14026 | | - | |
14027 | | - | |
14028 | 13952 | | |
14029 | 13953 | | |
14030 | 13954 | | |
14031 | 13955 | | |
14032 | 13956 | | |
14033 | 13957 | | |
14034 | | - | |
14035 | | - | |
14036 | | - | |
| 13958 | + | |
| 13959 | + | |
| 13960 | + | |
| 13961 | + | |
| 13962 | + | |
| 13963 | + | |
| 13964 | + | |
| 13965 | + | |
| 13966 | + | |
| 13967 | + | |
| 13968 | + | |
| 13969 | + | |
| 13970 | + | |
| 13971 | + | |
| 13972 | + | |
| 13973 | + | |
| 13974 | + | |
14037 | 13975 | | |
14038 | | - | |
14039 | | - | |
14040 | 13976 | | |
14041 | 13977 | | |
14042 | | - | |
14043 | | - | |
14044 | | - | |
14045 | | - | |
| 13978 | + | |
| 13979 | + | |
| 13980 | + | |
| 13981 | + | |
14046 | 13982 | | |
14047 | 13983 | | |
14048 | 13984 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | | - | |
| 510 | + | |
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
550 | 621 | | |
551 | 622 | | |
552 | 623 | | |
| |||
0 commit comments