| ... | ... | @@ -9748,7 +9748,7 @@ test "expect in release fast mode" { |
| 9748 | 9748 | to see a command-line usage help menu. This will include project-specific |
| 9749 | 9749 | options that were declared in the build.zig script. |
| 9750 | 9750 | </p> |
| 9751 | | |
| 9751 | |
| 9752 | 9752 | {#header_open|Building an Executable#} |
| 9753 | 9753 | <p>This <code>build.zig</code> file is automatically generated |
| 9754 | 9754 | by <code>zig init-exe</code>.</p> |
| ... | ... | @@ -11112,40 +11112,40 @@ fn readU32Be() u32 {} |
| 11112 | 11112 | {#header_close#} |
| 11113 | 11113 | |
| 11114 | 11114 | {#header_open|Grammar#} |
| 11115 | | <pre><code>Root &lt;- skip ContainerMembers eof |
| 11115 | <pre><code>Root &lt;- skip container_doc_comment? ContainerMembers eof |
| 11116 | 11116 | |
| 11117 | 11117 | # *** Top level *** |
| 11118 | | ContainerMembers |
| 11119 | | &lt;- TestDecl ContainerMembers |
| 11120 | | / TopLevelComptime ContainerMembers |
| 11121 | | / KEYWORD_pub? TopLevelDecl ContainerMembers |
| 11122 | | / ContainerField COMMA ContainerMembers |
| 11123 | | / ContainerField |
| 11118 | ContainerMembers &lt;- ContainerDeclarations (ContainerField COMMA)* (ContainerField / ContainerDeclarations) |
| 11119 | |
| 11120 | ContainerDeclarations |
| 11121 | &lt;- TestDecl ContainerDeclarations |
| 11122 | / TopLevelComptime ContainerDeclarations |
| 11123 | / doc_comment? KEYWORD_pub? TopLevelDecl ContainerDeclarations |
| 11124 | 11124 | / |
| 11125 | 11125 | |
| 11126 | | TestDecl &lt;- KEYWORD_test STRINGLITERALSINGLE Block |
| 11126 | TestDecl &lt;- doc_comment? KEYWORD_test STRINGLITERALSINGLE? Block |
| 11127 | 11127 | |
| 11128 | | TopLevelComptime &lt;- KEYWORD_comptime BlockExpr |
| 11128 | TopLevelComptime &lt;- doc_comment? KEYWORD_comptime BlockExpr |
| 11129 | 11129 | |
| 11130 | 11130 | TopLevelDecl |
| 11131 | 11131 | &lt;- (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE? / (KEYWORD_inline / KEYWORD_noinline))? FnProto (SEMICOLON / Block) |
| 11132 | 11132 | / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl |
| 11133 | 11133 | / KEYWORD_usingnamespace Expr SEMICOLON |
| 11134 | 11134 | |
| 11135 | | FnProto &lt;- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? CallConv? EXCLAMATIONMARK? (KEYWORD_anytype / TypeExpr) |
| 11135 | FnProto &lt;- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? CallConv? EXCLAMATIONMARK? TypeExpr |
| 11136 | 11136 | |
| 11137 | 11137 | VarDecl &lt;- (KEYWORD_const / KEYWORD_var) IDENTIFIER (COLON TypeExpr)? ByteAlign? LinkSection? (EQUAL Expr)? SEMICOLON |
| 11138 | 11138 | |
| 11139 | | ContainerField &lt;- KEYWORD_comptime? IDENTIFIER (COLON TypeExpr ByteAlign?)? (EQUAL Expr)? |
| 11139 | ContainerField &lt;- doc_comment? KEYWORD_comptime? IDENTIFIER (COLON (KEYWORD_anytype / TypeExpr) ByteAlign?)? (EQUAL Expr)? |
| 11140 | 11140 | |
| 11141 | 11141 | # *** Block Level *** |
| 11142 | 11142 | Statement |
| 11143 | 11143 | &lt;- KEYWORD_comptime? VarDecl |
| 11144 | 11144 | / KEYWORD_comptime BlockExprStatement |
| 11145 | 11145 | / KEYWORD_nosuspend BlockExprStatement |
| 11146 | | / KEYWORD_suspend (SEMICOLON / BlockExprStatement) |
| 11146 | / KEYWORD_suspend BlockExprStatement |
| 11147 | 11147 | / KEYWORD_defer BlockExprStatement |
| 11148 | | / KEYWORD_errdefer BlockExprStatement |
| 11148 | / KEYWORD_errdefer Payload? BlockExprStatement |
| 11149 | 11149 | / IfStatement |
| 11150 | 11150 | / LabeledStatement |
| 11151 | 11151 | / SwitchExpr |
| ... | ... | @@ -11278,7 +11278,7 @@ WhileTypeExpr &lt;- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? |
| 11278 | 11278 | SwitchExpr &lt;- KEYWORD_switch LPAREN Expr RPAREN LBRACE SwitchProngList RBRACE |
| 11279 | 11279 | |
| 11280 | 11280 | # *** Assembly *** |
| 11281 | | AsmExpr &lt;- KEYWORD_asm KEYWORD_volatile? LPAREN STRINGLITERAL AsmOutput? RPAREN |
| 11281 | AsmExpr &lt;- KEYWORD_asm KEYWORD_volatile? LPAREN Expr AsmOutput? RPAREN |
| 11282 | 11282 | |
| 11283 | 11283 | AsmOutput &lt;- COLON AsmOutputList AsmInput? |
| 11284 | 11284 | |
| ... | ... | @@ -11301,13 +11301,15 @@ WhileContinueExpr &lt;- COLON LPAREN AssignExpr RPAREN |
| 11301 | 11301 | |
| 11302 | 11302 | LinkSection &lt;- KEYWORD_linksection LPAREN Expr RPAREN |
| 11303 | 11303 | |
| 11304 | # Fn specific |
| 11304 | 11305 | CallConv &lt;- KEYWORD_callconv LPAREN Expr RPAREN |
| 11305 | 11306 | |
| 11306 | | ParamDecl &lt;- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType |
| 11307 | ParamDecl |
| 11308 | &lt;- doc_comment? (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType |
| 11309 | / DOT3 |
| 11307 | 11310 | |
| 11308 | 11311 | ParamType |
| 11309 | 11312 | &lt;- KEYWORD_anytype |
| 11310 | | / DOT3 |
| 11311 | 11313 | / TypeExpr |
| 11312 | 11314 | |
| 11313 | 11315 | # Control flow prefixes |
| ... | ... | @@ -11397,11 +11399,12 @@ PrefixOp |
| 11397 | 11399 | PrefixTypeOp |
| 11398 | 11400 | &lt;- QUESTIONMARK |
| 11399 | 11401 | / KEYWORD_anyframe MINUSRARROW |
| 11400 | | / ArrayTypeStart (ByteAlign / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* |
| 11402 | / SliceTypeStart (ByteAlign / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* |
| 11401 | 11403 | / PtrTypeStart (KEYWORD_align LPAREN Expr (COLON INTEGER COLON INTEGER)? RPAREN / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* |
| 11404 | / ArrayTypeStart |
| 11402 | 11405 | |
| 11403 | 11406 | SuffixOp |
| 11404 | | &lt;- LBRACKET Expr (DOT2 Expr?)? RBRACKET |
| 11407 | &lt;- LBRACKET Expr (DOT2 (Expr? (COLON Expr)?)?)? RBRACKET |
| 11405 | 11408 | / DOT IDENTIFIER |
| 11406 | 11409 | / DOTASTERISK |
| 11407 | 11410 | / DOTQUESTIONMARK |
| ... | ... | @@ -11409,15 +11412,17 @@ SuffixOp |
| 11409 | 11412 | FnCallArguments &lt;- LPAREN ExprList RPAREN |
| 11410 | 11413 | |
| 11411 | 11414 | # Ptr specific |
| 11412 | | ArrayTypeStart &lt;- LBRACKET Expr? (COLON Expr)? RBRACKET |
| 11415 | SliceTypeStart &lt;- LBRACKET (COLON Expr)? RBRACKET |
| 11413 | 11416 | |
| 11414 | 11417 | PtrTypeStart |
| 11415 | 11418 | &lt;- ASTERISK |
| 11416 | 11419 | / ASTERISK2 |
| 11417 | 11420 | / LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET |
| 11418 | 11421 | |
| 11422 | ArrayTypeStart &lt;- LBRACKET Expr (COLON Expr)? RBRACKET |
| 11423 | |
| 11419 | 11424 | # ContainerDecl specific |
| 11420 | | ContainerDeclAuto &lt;- ContainerDeclType LBRACE ContainerMembers RBRACE |
| 11425 | ContainerDeclAuto &lt;- ContainerDeclType LBRACE container_doc_comment? ContainerMembers RBRACE |
| 11421 | 11426 | |
| 11422 | 11427 | ContainerDeclType |
| 11423 | 11428 | &lt;- KEYWORD_struct |
| ... | ... | @@ -11429,7 +11434,7 @@ ContainerDeclType |
| 11429 | 11434 | ByteAlign &lt;- KEYWORD_align LPAREN Expr RPAREN |
| 11430 | 11435 | |
| 11431 | 11436 | # Lists |
| 11432 | | IdentifierList &lt;- (IDENTIFIER COMMA)* IDENTIFIER? |
| 11437 | IdentifierList &lt;- (doc_comment? IDENTIFIER COMMA)* (doc_comment? IDENTIFIER)? |
| 11433 | 11438 | |
| 11434 | 11439 | SwitchProngList &lt;- (SwitchProng COMMA)* SwitchProng? |
| 11435 | 11440 | |
| ... | ... | @@ -11445,49 +11450,96 @@ ExprList &lt;- (Expr COMMA)* Expr? |
| 11445 | 11450 | |
| 11446 | 11451 | # *** Tokens *** |
| 11447 | 11452 | eof &lt;- !. |
| 11448 | | eol &lt;- ('\r'? '\n') | eof |
| 11453 | bin &lt;- [01] |
| 11454 | bin_ &lt;- '_'? bin |
| 11455 | oct &lt;- [0-7] |
| 11456 | oct_ &lt;- '_'? oct |
| 11449 | 11457 | hex &lt;- [0-9a-fA-F] |
| 11450 | | hex_ &lt;- ('_'/hex) |
| 11458 | hex_ &lt;- '_'? hex |
| 11451 | 11459 | dec &lt;- [0-9] |
| 11452 | | dec_ &lt;- ('_'/dec) |
| 11453 | | |
| 11454 | | dec_int &lt;- dec (dec_* dec)? |
| 11455 | | hex_int &lt;- hex (hex_* dec)? |
| 11460 | dec_ &lt;- '_'? dec |
| 11461 | |
| 11462 | bin_int &lt;- bin bin_* |
| 11463 | oct_int &lt;- oct oct_* |
| 11464 | dec_int &lt;- dec dec_* |
| 11465 | hex_int &lt;- hex hex_* |
| 11466 | |
| 11467 | ox80_oxBF &lt;- [\200-\277] |
| 11468 | oxF4 &lt;- '\364' |
| 11469 | ox80_ox8F &lt;- [\200-\217] |
| 11470 | oxF1_oxF3 &lt;- [\361-\363] |
| 11471 | oxF0 &lt;- '\360' |
| 11472 | ox90_0xBF &lt;- [\220-\277] |
| 11473 | oxEE_oxEF &lt;- [\356-\357] |
| 11474 | oxED &lt;- '\355' |
| 11475 | ox80_ox9F &lt;- [\200-\237] |
| 11476 | oxE1_oxEC &lt;- [\341-\354] |
| 11477 | oxE0 &lt;- '\340' |
| 11478 | oxA0_oxBF &lt;- [\240-\277] |
| 11479 | oxC2_oxDF &lt;- [\302-\337] |
| 11480 | |
| 11481 | # From https://lemire.me/blog/2018/05/09/how-quickly-can-you-check-that-a-string-is-valid-unicode-utf-8/ |
| 11482 | # First Byte Second Byte Third Byte Fourth Byte |
| 11483 | # [0x00,0x7F] |
| 11484 | # [0xC2,0xDF] [0x80,0xBF] |
| 11485 | # 0xE0 [0xA0,0xBF] [0x80,0xBF] |
| 11486 | # [0xE1,0xEC] [0x80,0xBF] [0x80,0xBF] |
| 11487 | # 0xED [0x80,0x9F] [0x80,0xBF] |
| 11488 | # [0xEE,0xEF] [0x80,0xBF] [0x80,0xBF] |
| 11489 | # 0xF0 [0x90,0xBF] [0x80,0xBF] [0x80,0xBF] |
| 11490 | # [0xF1,0xF3] [0x80,0xBF] [0x80,0xBF] [0x80,0xBF] |
| 11491 | # 0xF4 [0x80,0x8F] [0x80,0xBF] [0x80,0xBF] |
| 11492 | |
| 11493 | mb_utf8_literal &lt;- |
| 11494 | oxF4 ox80_ox8F ox80_oxBF ox80_oxBF |
| 11495 | / oxF1_oxF3 ox80_oxBF ox80_oxBF ox80_oxBF |
| 11496 | / oxF0 ox90_0xBF ox80_oxBF ox80_oxBF |
| 11497 | / oxEE_oxEF ox80_oxBF ox80_oxBF |
| 11498 | / oxED ox80_ox9F ox80_oxBF |
| 11499 | / oxE1_oxEC ox80_oxBF ox80_oxBF |
| 11500 | / oxE0 oxA0_oxBF ox80_oxBF |
| 11501 | / oxC2_oxDF ox80_oxBF |
| 11502 | |
| 11503 | ascii_char_not_nl_slash_squote &lt;- [\000-\011\013-\046-\050-\133\135-\177] |
| 11456 | 11504 | |
| 11457 | 11505 | char_escape |
| 11458 | | &lt;- '\\x' hex hex |
| 11459 | | / '\\u{' hex+ '}' |
| 11460 | | / '\\' [nr\\t'&quot;] |
| 11506 | &lt;- &quot;\\x&quot; hex hex |
| 11507 | / &quot;\\u{&quot; hex+ &quot;}&quot; |
| 11508 | / &quot;\\&quot; [nr\\t'&quot;] |
| 11461 | 11509 | char_char |
| 11462 | | &lt;- char_escape |
| 11463 | | / [^\\'\r\n] |
| 11510 | &lt;- mb_utf8_literal |
| 11511 | / char_escape |
| 11512 | / ascii_char_not_nl_slash_squote |
| 11513 | |
| 11464 | 11514 | string_char |
| 11465 | 11515 | &lt;- char_escape |
| 11466 | | / [^\\&quot;\r\n] |
| 11516 | / [^\\&quot;\n] |
| 11467 | 11517 | |
| 11468 | | line_comment &lt;- '//'[^\r\n]* eol |
| 11469 | | line_string &lt;- ('\\\\' [^\r\n]* eol skip)+ |
| 11470 | | skip &lt;- ([ \t] / eol / line_comment)* |
| 11518 | container_doc_comment &lt;- ('//!' [^\n]* [ \n]*)+ |
| 11519 | doc_comment &lt;- ('///' [^\n]* [ \n]*)+ |
| 11520 | line_comment &lt;- '//' ![!/][^\n]* / '////' [^\n]* |
| 11521 | line_string &lt;- (&quot;\\\\&quot; [^\n]* [ \n]*)+ |
| 11522 | skip &lt;- ([ \n] / line_comment)* |
| 11471 | 11523 | |
| 11472 | 11524 | CHAR_LITERAL &lt;- &quot;'&quot; char_char &quot;'&quot; skip |
| 11473 | 11525 | FLOAT |
| 11474 | | &lt;- '0x' hex_* hex '.' hex_int ([pP] [-+]? hex_int)? skip |
| 11475 | | / dec_int '.' dec_int ([eE] [-+]? dec_int)? skip |
| 11476 | | / '0x' hex_* hex '.'? [pP] [-+]? hex_int skip |
| 11477 | | / dec_int '.'? [eE] [-+]? dec_int skip |
| 11526 | &lt;- &quot;0x&quot; hex_int &quot;.&quot; hex_int ([pP] [-+]? dec_int)? skip |
| 11527 | / dec_int &quot;.&quot; dec_int ([eE] [-+]? dec_int)? skip |
| 11528 | / &quot;0x&quot; hex_int &quot;.&quot;? [pP] [-+]? dec_int skip |
| 11529 | / dec_int &quot;.&quot;? [eE] [-+]? dec_int skip |
| 11478 | 11530 | INTEGER |
| 11479 | | &lt;- '0b' [_01]* [01] skip |
| 11480 | | / '0o' [_0-7]* [0-7] skip |
| 11481 | | / '0x' hex_* hex skip |
| 11531 | &lt;- &quot;0b&quot; bin_int skip |
| 11532 | / &quot;0o&quot; oct_int skip |
| 11533 | / &quot;0x&quot; hex_int skip |
| 11482 | 11534 | / dec_int skip |
| 11483 | | STRINGLITERALSINGLE &lt;- '&quot;' string_char* '&quot;' skip |
| 11535 | STRINGLITERALSINGLE &lt;- &quot;\&quot;&quot; string_char* &quot;\&quot;&quot; skip |
| 11484 | 11536 | STRINGLITERAL |
| 11485 | 11537 | &lt;- STRINGLITERALSINGLE |
| 11486 | | / line_string skip |
| 11538 | / (line_string skip)+ |
| 11487 | 11539 | IDENTIFIER |
| 11488 | 11540 | &lt;- !keyword [A-Za-z_] [A-Za-z0-9_]* skip |
| 11489 | | / '@&quot;' string_char* '&quot;' skip |
| 11490 | | BUILTINIDENTIFIER &lt;- '@'[A-Za-z_][A-Za-z0-9_]* skip |
| 11541 | / &quot;@\&quot;&quot; string_char* &quot;\&quot;&quot; skip |
| 11542 | BUILTINIDENTIFIER &lt;- &quot;@&quot;[A-Za-z_][A-Za-z0-9_]* skip |
| 11491 | 11543 | |
| 11492 | 11544 | |
| 11493 | 11545 | AMPERSAND &lt;- '&amp;' ![=] skip |