| ... | ... | @@ -25,22 +25,37 @@ const Parser = struct { |
| 25 | 25 | return blk_0: { |
| 26 | 26 | const pos_0 = p.i; |
| 27 | 27 | if ((p.parsecontainer_doc_comment() or true) and blk_1: { |
| 28 | | while (p.parseContainerDeclaration()) {} |
| 28 | while (p.parseContainerDecl()) {} |
| 29 | 29 | break :blk_1 true; |
| 30 | } and blk_1: { |
| 31 | const pos_1 = p.i; |
| 32 | const match_1 = p.parseContainerDeclPrefix(); |
| 33 | p.i = pos_1; |
| 34 | break :blk_1 !match_1; |
| 30 | 35 | } and blk_1: { |
| 31 | 36 | while (blk_3: { |
| 32 | 37 | const pos_3 = p.i; |
| 33 | | if (p.parseContainerField() and p.parseCOMMA()) break :blk_3 true; |
| 38 | if (blk_4: { |
| 39 | const pos_4 = p.i; |
| 40 | const match_4 = p.parseContainerDeclPrefix(); |
| 41 | p.i = pos_4; |
| 42 | break :blk_4 !match_4; |
| 43 | } and p.parseContainerField() and p.parseCOMMA()) break :blk_3 true; |
| 34 | 44 | p.i = pos_3; |
| 35 | 45 | break :blk_3 false; |
| 36 | 46 | }) {} |
| 37 | 47 | break :blk_1 true; |
| 38 | 48 | } and blk_2: { |
| 39 | 49 | const pos_2 = p.i; |
| 40 | | if (p.parseContainerField()) break :blk_2 true; |
| 50 | if (blk_3: { |
| 51 | const pos_3 = p.i; |
| 52 | const match_3 = p.parseContainerDeclPrefix(); |
| 53 | p.i = pos_3; |
| 54 | break :blk_3 !match_3; |
| 55 | } and p.parseContainerField()) break :blk_2 true; |
| 41 | 56 | p.i = pos_2; |
| 42 | 57 | if (blk_3: { |
| 43 | | while (p.parseContainerDeclaration()) {} |
| 58 | while (p.parseContainerDecl()) {} |
| 44 | 59 | break :blk_3 true; |
| 45 | 60 | }) break :blk_2 true; |
| 46 | 61 | p.i = pos_2; |
| ... | ... | @@ -50,7 +65,7 @@ const Parser = struct { |
| 50 | 65 | break :blk_0 false; |
| 51 | 66 | }; |
| 52 | 67 | } |
| 53 | | pub fn parseContainerDeclaration(p: *Parser) bool { |
| 68 | pub fn parseContainerDecl(p: *Parser) bool { |
| 54 | 69 | return blk_0: { |
| 55 | 70 | const pos_0 = p.i; |
| 56 | 71 | if (p.parseTestDecl()) break :blk_0 true; |
| ... | ... | @@ -62,6 +77,18 @@ const Parser = struct { |
| 62 | 77 | break :blk_0 false; |
| 63 | 78 | }; |
| 64 | 79 | } |
| 80 | pub fn parseContainerDeclPrefix(p: *Parser) bool { |
| 81 | return blk_0: { |
| 82 | const pos_0 = p.i; |
| 83 | if (p.parseKEYWORD_test()) break :blk_0 true; |
| 84 | p.i = pos_0; |
| 85 | if (p.parseKEYWORD_comptime() and p.parseLBRACE()) break :blk_0 true; |
| 86 | p.i = pos_0; |
| 87 | if ((p.parsedoc_comment() or true) and (p.parseKEYWORD_pub() or true) and p.parseDeclPrefix()) break :blk_0 true; |
| 88 | p.i = pos_0; |
| 89 | break :blk_0 false; |
| 90 | }; |
| 91 | } |
| 65 | 92 | pub fn parseTestDecl(p: *Parser) bool { |
| 66 | 93 | return blk_0: { |
| 67 | 94 | const pos_0 = p.i; |
| ... | ... | @@ -120,6 +147,41 @@ const Parser = struct { |
| 120 | 147 | break :blk_0 false; |
| 121 | 148 | }; |
| 122 | 149 | } |
| 150 | pub fn parseDeclPrefix(p: *Parser) bool { |
| 151 | return blk_0: { |
| 152 | const pos_0 = p.i; |
| 153 | if ((blk_3: { |
| 154 | const pos_3 = p.i; |
| 155 | if (p.parseKEYWORD_export()) break :blk_3 true; |
| 156 | p.i = pos_3; |
| 157 | if (p.parseKEYWORD_inline()) break :blk_3 true; |
| 158 | p.i = pos_3; |
| 159 | if (p.parseKEYWORD_noinline()) break :blk_3 true; |
| 160 | p.i = pos_3; |
| 161 | break :blk_3 false; |
| 162 | } or true) and p.parseKEYWORD_fn()) break :blk_0 true; |
| 163 | p.i = pos_0; |
| 164 | if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true) and p.parseKEYWORD_fn()) break :blk_0 true; |
| 165 | p.i = pos_0; |
| 166 | if ((blk_3: { |
| 167 | const pos_3 = p.i; |
| 168 | if (p.parseKEYWORD_export()) break :blk_3 true; |
| 169 | p.i = pos_3; |
| 170 | if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true)) break :blk_3 true; |
| 171 | p.i = pos_3; |
| 172 | break :blk_3 false; |
| 173 | } or true) and (p.parseKEYWORD_threadlocal() or true) and blk_2: { |
| 174 | const pos_2 = p.i; |
| 175 | if (p.parseKEYWORD_const()) break :blk_2 true; |
| 176 | p.i = pos_2; |
| 177 | if (p.parseKEYWORD_var()) break :blk_2 true; |
| 178 | p.i = pos_2; |
| 179 | break :blk_2 false; |
| 180 | }) break :blk_0 true; |
| 181 | p.i = pos_0; |
| 182 | break :blk_0 false; |
| 183 | }; |
| 184 | } |
| 123 | 185 | pub fn parseFnProto(p: *Parser) bool { |
| 124 | 186 | return blk_0: { |
| 125 | 187 | const pos_0 = p.i; |
| ... | ... | @@ -904,7 +966,7 @@ const Parser = struct { |
| 904 | 966 | p.i = pos_0; |
| 905 | 967 | if (p.parseCHAR_LITERAL()) break :blk_0 true; |
| 906 | 968 | p.i = pos_0; |
| 907 | | if (p.parseContainerDecl()) break :blk_0 true; |
| 969 | if (p.parseContainerType()) break :blk_0 true; |
| 908 | 970 | p.i = pos_0; |
| 909 | 971 | if (p.parseDOT() and p.parseIDENTIFIER()) break :blk_0 true; |
| 910 | 972 | p.i = pos_0; |
| ... | ... | @@ -937,7 +999,7 @@ const Parser = struct { |
| 937 | 999 | break :blk_0 false; |
| 938 | 1000 | }; |
| 939 | 1001 | } |
| 940 | | pub fn parseContainerDecl(p: *Parser) bool { |
| 1002 | pub fn parseContainerType(p: *Parser) bool { |
| 941 | 1003 | return blk_0: { |
| 942 | 1004 | const pos_0 = p.i; |
| 943 | 1005 | if ((blk_3: { |
| ... | ... | @@ -947,7 +1009,7 @@ const Parser = struct { |
| 947 | 1009 | if (p.parseKEYWORD_packed()) break :blk_3 true; |
| 948 | 1010 | p.i = pos_3; |
| 949 | 1011 | break :blk_3 false; |
| 950 | | } or true) and p.parseContainerDeclAuto()) break :blk_0 true; |
| 1012 | } or true) and p.parseContainerTypeAuto()) break :blk_0 true; |
| 951 | 1013 | p.i = pos_0; |
| 952 | 1014 | break :blk_0 false; |
| 953 | 1015 | }; |
| ... | ... | @@ -1828,15 +1890,15 @@ const Parser = struct { |
| 1828 | 1890 | break :blk_0 false; |
| 1829 | 1891 | }; |
| 1830 | 1892 | } |
| 1831 | | pub fn parseContainerDeclAuto(p: *Parser) bool { |
| 1893 | pub fn parseContainerTypeAuto(p: *Parser) bool { |
| 1832 | 1894 | return blk_0: { |
| 1833 | 1895 | const pos_0 = p.i; |
| 1834 | | if (p.parseContainerDeclType() and p.parseLBRACE() and p.parseContainerMembers() and p.parseRBRACE()) break :blk_0 true; |
| 1896 | if (p.parseContainerTypeKind() and p.parseLBRACE() and p.parseContainerMembers() and p.parseRBRACE()) break :blk_0 true; |
| 1835 | 1897 | p.i = pos_0; |
| 1836 | 1898 | break :blk_0 false; |
| 1837 | 1899 | }; |
| 1838 | 1900 | } |
| 1839 | | pub fn parseContainerDeclType(p: *Parser) bool { |
| 1901 | pub fn parseContainerTypeKind(p: *Parser) bool { |
| 1840 | 1902 | return blk_0: { |
| 1841 | 1903 | const pos_0 = p.i; |
| 1842 | 1904 | if (p.parseKEYWORD_struct() and (blk_3: { |