Commit 0e0a2cc
committed
Parser: simplify type parsing
* simplify `Parser.parseTypeSpecifier`: always accept qualifier and arrays
* simplify `Parser.parseSingleTypeSpecifier()`: always accept qualifier
* simplify `Parser.parseOptionalArray()`: always accept arrays, remove base and recursion
* simplify `Parser.parseAsType()`, `Parser.parseAsCastType()`,
`Parser.isTemplateFunctionCall()`: remove `has_brackets` handling
* add `isArray()` and `isPointer()` type functions for `TypeRef` and `TypeRefHolder`
for clarity and flexibility
* this fixes some problems:
* `sizeof(const char*)` was rejected.
* `a < i32.max` was interpreted as a template function call
* `a < b * c > (d + 1)` was interpreted as a template function call (wrong error)
* `sizeof(Handle[3])` now works for array types1 parent ae78fb1 commit 0e0a2cc
File tree
11 files changed
+154
-131
lines changed- analyser
- ast
- generator/c
- parser
- test
- builtins
- expr/sizeof
- parser
11 files changed
+154
-131
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
137 | 149 | | |
138 | 150 | | |
139 | 151 | | |
| |||
337 | 349 | | |
338 | 350 | | |
339 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
340 | 356 | | |
341 | 357 | | |
342 | 358 | | |
| |||
369 | 385 | | |
370 | 386 | | |
371 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
372 | 392 | | |
373 | 393 | | |
374 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | | - | |
| 425 | + | |
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
| 547 | + | |
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
586 | 583 | | |
587 | 584 | | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
593 | 589 | | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | 590 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
621 | 604 | | |
622 | 605 | | |
623 | | - | |
624 | | - | |
625 | 606 | | |
626 | 607 | | |
627 | 608 | | |
| |||
642 | 623 | | |
643 | 624 | | |
644 | 625 | | |
645 | | - | |
| 626 | + | |
646 | 627 | | |
647 | 628 | | |
648 | 629 | | |
| |||
674 | 655 | | |
675 | 656 | | |
676 | 657 | | |
677 | | - | |
| 658 | + | |
678 | 659 | | |
679 | 660 | | |
680 | 661 | | |
| |||
742 | 723 | | |
743 | 724 | | |
744 | 725 | | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
751 | 729 | | |
752 | 730 | | |
753 | 731 | | |
| |||
0 commit comments