@zigc/lib 0.16.0-dev.3070 → 0.16.0-dev.3121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/c/math.zig +125 -22
  2. package/c/stropts.zig +17 -0
  3. package/c.zig +1 -0
  4. package/compiler_rt/cos.zig +141 -52
  5. package/compiler_rt/limb64.zig +266 -0
  6. package/compiler_rt/long_double.zig +37 -0
  7. package/compiler_rt/rem_pio2l.zig +173 -0
  8. package/compiler_rt/sin.zig +140 -55
  9. package/compiler_rt/sincos.zig +279 -72
  10. package/compiler_rt/tan.zig +118 -47
  11. package/compiler_rt/trig.zig +256 -6
  12. package/compiler_rt.zig +2 -0
  13. package/package.json +1 -1
  14. package/std/Build/Module.zig +1 -1
  15. package/std/Build/abi.zig +8 -4
  16. package/std/Io/Dispatch.zig +2 -0
  17. package/std/Io/File.zig +1 -0
  18. package/std/Io/Threaded.zig +2 -0
  19. package/std/Io/Uring.zig +1 -0
  20. package/std/array_list.zig +22 -31
  21. package/std/debug/Info.zig +4 -0
  22. package/std/debug/SelfInfo/Windows.zig +1 -0
  23. package/std/heap/ArenaAllocator.zig +145 -154
  24. package/std/mem/Allocator.zig +4 -5
  25. package/std/mem.zig +48 -0
  26. package/std/testing/Smith.zig +37 -2
  27. package/std/zig/Ast/Render.zig +186 -458
  28. package/std/zig/Ast.zig +0 -4
  29. package/std/zig/AstSmith.zig +2602 -0
  30. package/std/zig/Parse.zig +83 -74
  31. package/std/zig/system.zig +2 -0
  32. package/std/zig/tokenizer.zig +2 -1
  33. package/std/zig.zig +2 -0
  34. package/libc/mingw/math/arm/sincos.S +0 -30
  35. package/libc/mingw/math/arm-common/sincosl.c +0 -13
  36. package/libc/mingw/math/arm64/rint.c +0 -12
  37. package/libc/mingw/math/arm64/rintf.c +0 -12
  38. package/libc/mingw/math/arm64/sincos.S +0 -32
  39. package/libc/mingw/math/frexpf.c +0 -13
  40. package/libc/mingw/math/frexpl.c +0 -71
  41. package/libc/mingw/math/x86/cos.def.h +0 -65
  42. package/libc/mingw/math/x86/cosl.c +0 -46
  43. package/libc/mingw/math/x86/cosl_internal.S +0 -55
  44. package/libc/mingw/math/x86/sin.def.h +0 -65
  45. package/libc/mingw/math/x86/sinl.c +0 -46
  46. package/libc/mingw/math/x86/sinl_internal.S +0 -58
  47. package/libc/mingw/math/x86/tanl.S +0 -62
  48. package/libc/musl/src/legacy/isastream.c +0 -7
  49. package/libc/musl/src/math/__cosl.c +0 -96
  50. package/libc/musl/src/math/__sinl.c +0 -78
  51. package/libc/musl/src/math/__tanl.c +0 -143
  52. package/libc/musl/src/math/aarch64/lrint.c +0 -10
  53. package/libc/musl/src/math/aarch64/lrintf.c +0 -10
  54. package/libc/musl/src/math/aarch64/rintf.c +0 -7
  55. package/libc/musl/src/math/cosl.c +0 -39
  56. package/libc/musl/src/math/fdim.c +0 -10
  57. package/libc/musl/src/math/finite.c +0 -7
  58. package/libc/musl/src/math/finitef.c +0 -7
  59. package/libc/musl/src/math/frexp.c +0 -23
  60. package/libc/musl/src/math/frexpf.c +0 -23
  61. package/libc/musl/src/math/frexpl.c +0 -29
  62. package/libc/musl/src/math/i386/lrint.c +0 -8
  63. package/libc/musl/src/math/i386/lrintf.c +0 -8
  64. package/libc/musl/src/math/i386/rintf.c +0 -7
  65. package/libc/musl/src/math/lrint.c +0 -72
  66. package/libc/musl/src/math/lrintf.c +0 -8
  67. package/libc/musl/src/math/powerpc64/lrint.c +0 -16
  68. package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
  69. package/libc/musl/src/math/rintf.c +0 -30
  70. package/libc/musl/src/math/s390x/rintf.c +0 -15
  71. package/libc/musl/src/math/sincosl.c +0 -60
  72. package/libc/musl/src/math/sinl.c +0 -41
  73. package/libc/musl/src/math/tanl.c +0 -29
  74. package/libc/musl/src/math/x32/lrint.s +0 -5
  75. package/libc/musl/src/math/x32/lrintf.s +0 -5
  76. package/libc/musl/src/math/x86_64/lrint.c +0 -8
  77. package/libc/musl/src/math/x86_64/lrintf.c +0 -8
package/std/zig/Parse.zig CHANGED
@@ -257,7 +257,7 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
257
257
  while (true) {
258
258
  const doc_comment = try p.eatDocComments();
259
259
 
260
- switch (p.tokenTag(p.tok_i)) {
260
+ sw: switch (p.tokenTag(p.tok_i)) {
261
261
  .keyword_test => {
262
262
  if (doc_comment) |some| {
263
263
  try p.warnMsg(.{ .tag = .test_doc_comment, .token = some });
@@ -348,17 +348,7 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
348
348
  p.findNextContainerMember();
349
349
  },
350
350
  },
351
- .keyword_pub => {
352
- p.tok_i += 1;
353
- const opt_top_level_decl = try p.expectTopLevelDeclRecoverable();
354
- if (opt_top_level_decl) |top_level_decl| {
355
- if (field_state == .seen) {
356
- field_state = .{ .end = top_level_decl };
357
- }
358
- try p.scratch.append(p.gpa, top_level_decl);
359
- }
360
- trailing = p.tokenTag(p.tok_i - 1) == .semicolon;
361
- },
351
+ .keyword_pub,
362
352
  .keyword_const,
363
353
  .keyword_var,
364
354
  .keyword_threadlocal,
@@ -367,7 +357,27 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
367
357
  .keyword_inline,
368
358
  .keyword_noinline,
369
359
  .keyword_fn,
370
- => {
360
+ => |t| {
361
+ if (t == .keyword_extern) {
362
+ switch (p.tokenTag(p.tok_i + 1)) {
363
+ .keyword_struct,
364
+ .keyword_union,
365
+ .keyword_enum,
366
+ .keyword_opaque,
367
+ => |ct| continue :sw ct,
368
+ else => {},
369
+ }
370
+ }
371
+ if (t == .keyword_inline) {
372
+ switch (p.tokenTag(p.tok_i + 1)) {
373
+ .keyword_for,
374
+ .keyword_while,
375
+ => |ct| continue :sw ct,
376
+ else => {},
377
+ }
378
+ }
379
+
380
+ p.tok_i += @intFromBool(t == .keyword_pub);
371
381
  const opt_top_level_decl = try p.expectTopLevelDeclRecoverable();
372
382
  if (opt_top_level_decl) |top_level_decl| {
373
383
  if (field_state == .seen) {
@@ -588,7 +598,8 @@ fn expectTestDeclRecoverable(p: *Parse) error{OutOfMemory}!?Node.Index {
588
598
  }
589
599
 
590
600
  /// Decl
591
- /// <- (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE? / KEYWORD_inline / KEYWORD_noinline)? FnProto (SEMICOLON / Block)
601
+ /// <- (KEYWORD_export / KEYWORD_inline / KEYWORD_noinline)? FnProto (SEMICOLON / Block)
602
+ /// / KEYWORD_extern STRINGLITERALSINGLE? FnProto SEMICOLON
592
603
  /// / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl
593
604
  fn expectTopLevelDecl(p: *Parse) !?Node.Index {
594
605
  const extern_export_inline_token = p.nextToken();
@@ -665,7 +676,7 @@ fn expectTopLevelDeclRecoverable(p: *Parse) error{OutOfMemory}!?Node.Index {
665
676
  };
666
677
  }
667
678
 
668
- /// FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? AddrSpace? LinkSection? CallConv? EXCLAMATIONMARK? TypeExpr
679
+ /// FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? AddrSpace? LinkSection? CallConv? EXCLAMATIONMARK? TypeExpr !ExprSuffix
669
680
  fn parseFnProto(p: *Parse) !?Node.Index {
670
681
  const fn_token = p.eatToken(.keyword_fn) orelse return null;
671
682
 
@@ -853,7 +864,7 @@ fn parseGlobalVarDecl(p: *Parse) !?Node.Index {
853
864
  return var_decl;
854
865
  }
855
866
 
856
- /// ContainerField <- doc_comment? KEYWORD_comptime? !KEYWORD_fn (IDENTIFIER COLON)? TypeExpr ByteAlign? (EQUAL Expr)?
867
+ /// ContainerField <- doc_comment? (KEYWORD_comptime / !KEYWORD_comptime) !KEYWORD_fn (IDENTIFIER COLON / !(IDENTIFIER COLON))? TypeExpr ByteAlign? (EQUAL Expr)?
857
868
  fn expectContainerField(p: *Parse) !Node.Index {
858
869
  _ = p.eatToken(.keyword_comptime);
859
870
  const main_token = p.tok_i;
@@ -895,16 +906,23 @@ fn expectContainerField(p: *Parse) !Node.Index {
895
906
  }
896
907
  }
897
908
 
898
- /// Statement
899
- /// <- KEYWORD_comptime ComptimeStatement
900
- /// / KEYWORD_nosuspend BlockExprStatement
901
- /// / KEYWORD_suspend BlockExprStatement
909
+ /// BlockStatement
910
+ /// <- Statement
902
911
  /// / KEYWORD_defer BlockExprStatement
903
912
  /// / KEYWORD_errdefer Payload? BlockExprStatement
904
- /// / IfStatement
913
+ /// / !ExprStatement (KEYWORD_comptime !BlockExpr)? VarAssignStatement
914
+ ///
915
+ /// Statement
916
+ /// <- ExprStatement
917
+ /// / KEYWORD_suspend BlockExprStatement
918
+ /// / !ExprStatement (KEYWORD_comptime !BlockExpr)? AssignExpr SEMICOLON
919
+ ///
920
+ /// ExprStatement
921
+ /// <- IfStatement
905
922
  /// / LabeledStatement
906
- /// / VarDeclExprStatement
907
- fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
923
+ /// / KEYWORD_nosuspend BlockExprStatement
924
+ /// / KEYWORD_comptime BlockExpr
925
+ fn expectStatement(p: *Parse, is_block_level: bool) Error!Node.Index {
908
926
  if (p.eatToken(.keyword_comptime)) |comptime_token| {
909
927
  const opt_block_expr = try p.parseBlockExpr();
910
928
  if (opt_block_expr) |block_expr| {
@@ -915,7 +933,7 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
915
933
  });
916
934
  }
917
935
 
918
- if (allow_defer_var) {
936
+ if (is_block_level) {
919
937
  return p.expectVarDeclExprStatement(comptime_token);
920
938
  } else {
921
939
  const assign = try p.expectAssignExpr();
@@ -949,12 +967,12 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
949
967
  .data = .{ .node = block_expr },
950
968
  });
951
969
  },
952
- .keyword_defer => if (allow_defer_var) return p.addNode(.{
970
+ .keyword_defer => if (is_block_level) return p.addNode(.{
953
971
  .tag = .@"defer",
954
972
  .main_token = p.nextToken(),
955
973
  .data = .{ .node = try p.expectBlockExprStatement() },
956
974
  }),
957
- .keyword_errdefer => if (allow_defer_var) return p.addNode(.{
975
+ .keyword_errdefer => if (is_block_level) return p.addNode(.{
958
976
  .tag = .@"errdefer",
959
977
  .main_token = p.nextToken(),
960
978
  .data = .{ .opt_token_and_node = .{
@@ -979,7 +997,7 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
979
997
 
980
998
  if (try p.parseLabeledStatement()) |labeled_statement| return labeled_statement;
981
999
 
982
- if (allow_defer_var) {
1000
+ if (is_block_level) {
983
1001
  return p.expectVarDeclExprStatement(null);
984
1002
  } else {
985
1003
  const assign = try p.expectAssignExpr();
@@ -1007,8 +1025,10 @@ fn expectComptimeStatement(p: *Parse, comptime_token: TokenIndex) !Node.Index {
1007
1025
  }
1008
1026
 
1009
1027
  /// VarDeclExprStatement
1010
- /// <- VarDeclProto (COMMA (VarDeclProto / Expr))* EQUAL Expr SEMICOLON
1011
- /// / Expr (AssignOp Expr / (COMMA (VarDeclProto / Expr))+ EQUAL Expr)? SEMICOLON
1028
+ /// <- Expr
1029
+ /// / VarAssignStatement
1030
+ ///
1031
+ /// VarAssignStatement <- (VarDeclProto / Expr) (COMMA (VarDeclProto / Expr))* EQUAL Expr SEMICOLON
1012
1032
  fn expectVarDeclExprStatement(p: *Parse, comptime_token: ?TokenIndex) !Node.Index {
1013
1033
  const scratch_top = p.scratch.items.len;
1014
1034
  defer p.scratch.shrinkRetainingCapacity(scratch_top);
@@ -1140,7 +1160,7 @@ fn expectStatementRecoverable(p: *Parse) Error!?Node.Index {
1140
1160
 
1141
1161
  /// IfStatement
1142
1162
  /// <- IfPrefix BlockExpr ( KEYWORD_else Payload? Statement )?
1143
- /// / IfPrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
1163
+ /// / IfPrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
1144
1164
  fn expectIfStatement(p: *Parse) !Node.Index {
1145
1165
  const if_token = p.assertToken(.keyword_if);
1146
1166
  _ = try p.expectToken(.l_paren);
@@ -1235,8 +1255,8 @@ fn parseLoopStatement(p: *Parse) !?Node.Index {
1235
1255
  }
1236
1256
 
1237
1257
  /// ForStatement
1238
- /// <- ForPrefix BlockExpr ( KEYWORD_else Statement )?
1239
- /// / ForPrefix AssignExpr ( SEMICOLON / KEYWORD_else Statement )
1258
+ /// <- ForPrefix BlockExpr ( KEYWORD_else Statement / !KEYWORD_else )
1259
+ /// / ForPrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Statement )
1240
1260
  fn parseForStatement(p: *Parse) !?Node.Index {
1241
1261
  const for_token = p.eatToken(.keyword_for) orelse return null;
1242
1262
 
@@ -1293,7 +1313,7 @@ fn parseForStatement(p: *Parse) !?Node.Index {
1293
1313
  ///
1294
1314
  /// WhileStatement
1295
1315
  /// <- WhilePrefix BlockExpr ( KEYWORD_else Payload? Statement )?
1296
- /// / WhilePrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
1316
+ /// / WhilePrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
1297
1317
  fn parseWhileStatement(p: *Parse) !?Node.Index {
1298
1318
  const while_token = p.eatToken(.keyword_while) orelse return null;
1299
1319
  _ = try p.expectToken(.l_paren);
@@ -1383,7 +1403,7 @@ fn parseWhileStatement(p: *Parse) !?Node.Index {
1383
1403
 
1384
1404
  /// BlockExprStatement
1385
1405
  /// <- BlockExpr
1386
- /// / AssignExpr SEMICOLON
1406
+ /// / !BlockExpr AssignExpr SEMICOLON
1387
1407
  fn parseBlockExprStatement(p: *Parse) !?Node.Index {
1388
1408
  const block_expr = try p.parseBlockExpr();
1389
1409
  if (block_expr) |expr| return expr;
@@ -1685,18 +1705,20 @@ fn expectPrefixExpr(p: *Parse) Error!Node.Index {
1685
1705
  /// PrefixTypeOp
1686
1706
  /// <- QUESTIONMARK
1687
1707
  /// / KEYWORD_anyframe MINUSRARROW
1688
- /// / SliceTypeStart (ByteAlign / AddrSpace / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)*
1708
+ /// / (ManyPtrTypeStart / SliceTypeStart) KEYWORD_allowzero? ByteAlign? AddrSpace? KEYWORD_const? KEYWORD_volatile?
1709
+ /// / SinglePtrTypeStart KEYWORD_allowzero? BitAlign? AddrSpace? KEYWORD_const? KEYWORD_volatile?
1689
1710
  /// / PtrTypeStart (AddrSpace / KEYWORD_align LPAREN Expr (COLON Expr COLON Expr)? RPAREN / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)*
1690
1711
  /// / ArrayTypeStart
1691
1712
  ///
1692
1713
  /// SliceTypeStart <- LBRACKET (COLON Expr)? RBRACKET
1693
1714
  ///
1694
- /// PtrTypeStart
1695
- /// <- ASTERISK
1696
- /// / ASTERISK2
1697
- /// / LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET
1715
+ /// SinglePtrTypeStart <- ASTERISK / ASTERISK2
1716
+ ///
1717
+ /// ManyPtrTypeStart <- LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET
1718
+ ///
1719
+ /// ArrayTypeStart <- LBRACKET Expr !(ASTERISK / ASTERISK2) (COLON Expr)? RBRACKET
1698
1720
  ///
1699
- /// ArrayTypeStart <- LBRACKET Expr (COLON Expr)? RBRACKET
1721
+ /// BitAlign <- KEYWORD_align LPAREN Expr (COLON Expr COLON Expr)? RPAREN
1700
1722
  fn parseTypeExpr(p: *Parse) Error!?Node.Index {
1701
1723
  switch (p.tokenTag(p.tok_i)) {
1702
1724
  .question_mark => return try p.addNode(.{
@@ -1962,12 +1984,12 @@ fn expectTypeExpr(p: *Parse) Error!Node.Index {
1962
1984
  /// PrimaryExpr
1963
1985
  /// <- AsmExpr
1964
1986
  /// / IfExpr
1965
- /// / KEYWORD_break BreakLabel? Expr?
1966
- /// / KEYWORD_comptime Expr
1967
- /// / KEYWORD_nosuspend Expr
1968
- /// / KEYWORD_continue BreakLabel? Expr?
1969
- /// / KEYWORD_resume Expr
1970
- /// / KEYWORD_return Expr?
1987
+ /// / KEYWORD_break (BreakLabel / !BreakLabel) (Expr !ExprSuffix / !SinglePtrTypeStart)
1988
+ /// / KEYWORD_comptime Expr !ExprSuffix
1989
+ /// / KEYWORD_nosuspend Expr !ExprSuffix
1990
+ /// / KEYWORD_continue (BreakLabel / !BreakLabel) (Expr !ExprSuffix / !SinglePtrTypeStart)
1991
+ /// / KEYWORD_resume Expr !ExprSuffix
1992
+ /// / KEYWORD_return (Expr !ExprSuffix / !SinglePtrTypeStart)
1971
1993
  /// / BlockLabel? LoopExpr
1972
1994
  /// / Block
1973
1995
  /// / CurlySuffixExpr
@@ -2042,10 +2064,6 @@ fn parsePrimaryExpr(p: *Parse) !?Node.Index {
2042
2064
  p.tok_i += 2;
2043
2065
  return try p.parseWhileExpr();
2044
2066
  },
2045
- .l_brace => {
2046
- p.tok_i += 2;
2047
- return try p.parseBlock();
2048
- },
2049
2067
  else => return try p.parseCurlySuffixExpr(),
2050
2068
  }
2051
2069
  } else {
@@ -2067,12 +2085,12 @@ fn parsePrimaryExpr(p: *Parse) !?Node.Index {
2067
2085
  }
2068
2086
  }
2069
2087
 
2070
- /// IfExpr <- IfPrefix Expr (KEYWORD_else Payload? Expr)?
2088
+ /// IfExpr <- IfPrefix Expr (KEYWORD_else Payload? Expr)? !ExprSuffix
2071
2089
  fn parseIfExpr(p: *Parse) !?Node.Index {
2072
2090
  return try p.parseIf(expectExpr);
2073
2091
  }
2074
2092
 
2075
- /// Block <- LBRACE Statement* RBRACE
2093
+ /// Block <- LBRACE BlockStatement* RBRACE
2076
2094
  fn parseBlock(p: *Parse) !?Node.Index {
2077
2095
  const lbrace = p.eatToken(.l_brace) orelse return null;
2078
2096
  const scratch_top = p.scratch.items.len;
@@ -2177,7 +2195,7 @@ fn forPrefix(p: *Parse) Error!usize {
2177
2195
 
2178
2196
  /// WhilePrefix <- KEYWORD_while LPAREN Expr RPAREN PtrPayload? WhileContinueExpr?
2179
2197
  ///
2180
- /// WhileExpr <- WhilePrefix Expr (KEYWORD_else Payload? Expr)?
2198
+ /// WhileExpr <- WhilePrefix Expr (KEYWORD_else Payload? Expr)? !ExprSuffi
2181
2199
  fn parseWhileExpr(p: *Parse) !?Node.Index {
2182
2200
  const while_token = p.eatToken(.keyword_while) orelse return null;
2183
2201
  _ = try p.expectToken(.l_paren);
@@ -2409,10 +2427,10 @@ fn parseSuffixExpr(p: *Parse) !?Node.Index {
2409
2427
  /// / FnProto
2410
2428
  /// / GroupedExpr
2411
2429
  /// / LabeledTypeExpr
2412
- /// / IDENTIFIER
2430
+ /// / IDENTIFIER !(COLON LabelableExpr)
2413
2431
  /// / IfTypeExpr
2414
2432
  /// / INTEGER
2415
- /// / KEYWORD_comptime TypeExpr
2433
+ /// / KEYWORD_comptime TypeExpr !ExprSuffix
2416
2434
  /// / KEYWORD_error DOT IDENTIFIER
2417
2435
  /// / KEYWORD_anyframe
2418
2436
  /// / KEYWORD_unreachable
@@ -2431,7 +2449,7 @@ fn parseSuffixExpr(p: *Parse) !?Node.Index {
2431
2449
  ///
2432
2450
  /// GroupedExpr <- LPAREN Expr RPAREN
2433
2451
  ///
2434
- /// IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)?
2452
+ /// IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? !ExprSuffix
2435
2453
  ///
2436
2454
  /// LabeledTypeExpr
2437
2455
  /// <- BlockLabel Block
@@ -2711,7 +2729,7 @@ fn expectPrimaryTypeExpr(p: *Parse) !Node.Index {
2711
2729
 
2712
2730
  /// WhilePrefix <- KEYWORD_while LPAREN Expr RPAREN PtrPayload? WhileContinueExpr?
2713
2731
  ///
2714
- /// WhileTypeExpr <- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)?
2732
+ /// WhileTypeExpr <- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? !ExprSuffix
2715
2733
  fn parseWhileTypeExpr(p: *Parse) !?Node.Index {
2716
2734
  const while_token = p.eatToken(.keyword_while) orelse return null;
2717
2735
  _ = try p.expectToken(.l_paren);
@@ -2876,7 +2894,7 @@ fn expectAsmExpr(p: *Parse) !Node.Index {
2876
2894
  });
2877
2895
  }
2878
2896
 
2879
- /// AsmOutputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERAL LPAREN (MINUSRARROW TypeExpr / IDENTIFIER) RPAREN
2897
+ /// AsmOutputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERALSINGLE LPAREN (MINUSRARROW TypeExpr / IDENTIFIER) RPAREN
2880
2898
  fn parseAsmOutputItem(p: *Parse) !?Node.Index {
2881
2899
  _ = p.eatToken(.l_bracket) orelse return null;
2882
2900
  const identifier = try p.expectToken(.identifier);
@@ -2902,7 +2920,7 @@ fn parseAsmOutputItem(p: *Parse) !?Node.Index {
2902
2920
  });
2903
2921
  }
2904
2922
 
2905
- /// AsmInputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERAL LPAREN Expr RPAREN
2923
+ /// AsmInputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERALSINGLE LPAREN Expr RPAREN
2906
2924
  fn parseAsmInputItem(p: *Parse) !?Node.Index {
2907
2925
  _ = p.eatToken(.l_bracket) orelse return null;
2908
2926
  const identifier = try p.expectToken(.identifier);
@@ -2923,9 +2941,7 @@ fn parseAsmInputItem(p: *Parse) !?Node.Index {
2923
2941
 
2924
2942
  /// BreakLabel <- COLON IDENTIFIER
2925
2943
  fn parseBreakLabel(p: *Parse) Error!OptionalTokenIndex {
2926
- _ = p.eatToken(.colon) orelse return .none;
2927
- const next_token = try p.expectToken(.identifier);
2928
- return .fromToken(next_token);
2944
+ return if (p.eatTokens(&.{ .colon, .identifier })) |i| .fromToken(i + 1) else .none;
2929
2945
  }
2930
2946
 
2931
2947
  /// BlockLabel <- IDENTIFIER COLON
@@ -2950,12 +2966,7 @@ fn expectFieldInit(p: *Parse) !Node.Index {
2950
2966
 
2951
2967
  /// WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN
2952
2968
  fn parseWhileContinueExpr(p: *Parse) !?Node.Index {
2953
- _ = p.eatToken(.colon) orelse {
2954
- if (p.tokenTag(p.tok_i) == .l_paren and
2955
- p.tokensOnSameLine(p.tok_i - 1, p.tok_i))
2956
- return p.fail(.expected_continue_expr);
2957
- return null;
2958
- };
2969
+ _ = p.eatToken(.colon) orelse return null;
2959
2970
  _ = try p.expectToken(.l_paren);
2960
2971
  const node = try p.parseAssignExpr() orelse return p.fail(.expected_expr_or_assignment);
2961
2972
  _ = try p.expectToken(.r_paren);
@@ -2993,9 +3004,7 @@ fn parseAddrSpace(p: *Parse) !?Node.Index {
2993
3004
  /// such as in the case of anytype and `...`. Caller must look for rparen to find
2994
3005
  /// out when there are no more param decls left.
2995
3006
  ///
2996
- /// ParamDecl
2997
- /// <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType
2998
- /// / DOT3
3007
+ /// ParamDecl <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime / !KEYWORD_comptime) (IDENTIFIER COLON / !(IDENTIFIER_COLON)) ParamType
2999
3008
  ///
3000
3009
  /// ParamType
3001
3010
  /// <- KEYWORD_anytype
@@ -3482,7 +3491,7 @@ fn parseSwitchProngList(p: *Parse) !Node.SubRange {
3482
3491
  return p.listToSpan(p.scratch.items[scratch_top..]);
3483
3492
  }
3484
3493
 
3485
- /// ParamDeclList <- (ParamDecl COMMA)* ParamDecl?
3494
+ /// ParamDeclList <- (ParamDecl COMMA)* (ParamDecl / DOT3 COMMA?)?
3486
3495
  fn parseParamDeclList(p: *Parse) !SmallSpan {
3487
3496
  _ = try p.expectToken(.l_paren);
3488
3497
  const scratch_top = p.scratch.items.len;
@@ -3604,9 +3613,9 @@ fn parseIf(p: *Parse, comptime bodyParseFn: fn (p: *Parse) Error!Node.Index) !?N
3604
3613
  });
3605
3614
  }
3606
3615
 
3607
- /// ForExpr <- ForPrefix Expr (KEYWORD_else Expr)?
3616
+ /// ForExpr <- ForPrefix Expr (KEYWORD_else Expr / !KEYWORD_else) !ExprSuffix
3608
3617
  ///
3609
- /// ForTypeExpr <- ForPrefix TypeExpr (KEYWORD_else TypeExpr)?
3618
+ /// ForTypeExpr <- ForPrefix TypeExpr (KEYWORD_else TypeExpr / !KEYWORD_else) !ExprSuffix
3610
3619
  fn parseFor(p: *Parse, comptime bodyParseFn: fn (p: *Parse) Error!Node.Index) !?Node.Index {
3611
3620
  const for_token = p.eatToken(.keyword_for) orelse return null;
3612
3621
 
@@ -423,6 +423,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target {
423
423
  error.ConnectionResetByPeer => return error.Unexpected,
424
424
  error.NotOpenForReading => return error.Unexpected,
425
425
  error.SocketUnconnected => return error.Unexpected,
426
+ error.ReadOnlyFileSystem => return error.Unexpected,
426
427
 
427
428
  error.AccessDenied,
428
429
  error.SymLinkLoop,
@@ -853,6 +854,7 @@ fn glibcVerFromRPath(io: Io, rpath: []const u8) !std.SemanticVersion {
853
854
  error.PathAlreadyExists => return error.Unexpected, // read-only
854
855
  error.DeviceBusy => return error.Unexpected, // read-only
855
856
  error.FileBusy => return error.Unexpected, // read-only
857
+ error.ReadOnlyFileSystem => return error.Unexpected, // read-only
856
858
  error.NoDevice => return error.Unexpected, // not asking for a special device
857
859
  error.FileTooBig => return error.Unexpected,
858
860
  error.WouldBlock => return error.Unexpected, // not opened in non-blocking
@@ -313,7 +313,8 @@ pub const Token = struct {
313
313
  return tag.lexeme() orelse switch (tag) {
314
314
  .invalid => "invalid token",
315
315
  .identifier => "an identifier",
316
- .string_literal, .multiline_string_literal_line => "a string literal",
316
+ .string_literal => "a string literal",
317
+ .multiline_string_literal_line => "a multiline string literal",
317
318
  .char_literal => "a character literal",
318
319
  .eof => "EOF",
319
320
  .builtin => "a builtin function",
package/std/zig.zig CHANGED
@@ -23,6 +23,7 @@ pub const primitives = @import("zig/primitives.zig");
23
23
  pub const isPrimitive = primitives.isPrimitive;
24
24
  pub const Ast = @import("zig/Ast.zig");
25
25
  pub const AstGen = @import("zig/AstGen.zig");
26
+ pub const AstSmith = @import("zig/AstSmith.zig");
26
27
  pub const Zir = @import("zig/Zir.zig");
27
28
  pub const Zoir = @import("zig/Zoir.zig");
28
29
  pub const ZonGen = @import("zig/ZonGen.zig");
@@ -1166,6 +1167,7 @@ pub const ClangCliParam = struct {
1166
1167
  test {
1167
1168
  _ = Ast;
1168
1169
  _ = AstRlAnnotate;
1170
+ _ = AstSmith;
1169
1171
  _ = BuiltinFn;
1170
1172
  _ = Client;
1171
1173
  _ = ErrorBundle;
@@ -1,30 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <_mingw_mac.h>
7
-
8
- .file "sincos.S"
9
- .text
10
- .align 2
11
- /* zig patch: remove sincos symbol because sincos in compiler_rt is used instead */
12
- .globl __MINGW_USYMBOL(sincosl)
13
- .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
14
- __MINGW_USYMBOL(sincosl):
15
- push {r4, r5, r11, lr}
16
- add r11, sp, #8
17
- vpush {d8}
18
-
19
- mov r4, r0
20
- mov r5, r1
21
- vmov.f64 d8, d0
22
- bl sin
23
- vstr d0, [r4]
24
-
25
- vmov.f64 d0, d8
26
- bl cos
27
- vstr d0, [r5]
28
-
29
- vpop {d8}
30
- pop {r4, r5, r11, pc}
@@ -1,13 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
-
7
- #include <math.h>
8
-
9
- void sincosl(long double x, long double *s, long double *c)
10
- {
11
- *s = sinl(x);
12
- *c = cosl(x);
13
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <math.h>
7
-
8
- double rint (double x) {
9
- double retval = 0.0;
10
- __asm__ __volatile__ ("frintx %d0, %d1\n\t" : "=w" (retval) : "w" (x));
11
- return retval;
12
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <math.h>
7
-
8
- float rintf (float x) {
9
- float retval = 0.0F;
10
- __asm__ __volatile__ ("frintx %s0, %s1\n\t" : "=w" (retval) : "w" (x));
11
- return retval;
12
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- #include <_mingw_mac.h>
7
-
8
- .file "sincos.S"
9
- .text
10
- .align 2
11
- /* zig patch: remove sincos symbol because sincos in compiler_rt is used instead */
12
- .globl __MINGW_USYMBOL(sincosl)
13
- .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
14
- __MINGW_USYMBOL(sincosl):
15
- str d8, [sp, #-32]!
16
- str x30, [sp, #8]
17
- stp x19, x20, [sp, #16]
18
-
19
- mov x19, x0
20
- mov x20, x1
21
- fmov d8, d0
22
- bl sin
23
- str d0, [x19]
24
-
25
- fmov d0, d8
26
- bl cos
27
- str d0, [x20]
28
-
29
- ldp x19, x20, [sp, #16]
30
- ldr x30, [sp, #8]
31
- ldr d8, [sp], #32
32
- ret
@@ -1,13 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- extern double __cdecl frexp(double _X,int *_Y);
7
-
8
- float frexpf (float, int *);
9
- float frexpf (float x, int *expn)
10
- {
11
- return (float)frexp(x, expn);
12
- }
13
-
@@ -1,71 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
- long double frexpl(long double value, int* exp);
7
-
8
- #if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
9
-
10
- double frexp(double value, int* exp);
11
-
12
- /* On ARM `long double` is 64 bits. */
13
- long double frexpl(long double value, int* exp)
14
- {
15
- return frexp(value, exp);
16
- }
17
-
18
- #elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
19
-
20
- #include <stdint.h>
21
-
22
- /* https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format */
23
- typedef union x87reg_ {
24
- struct __attribute__((__packed__)) {
25
- uint64_t f64;
26
- uint16_t exp : 15;
27
- uint16_t sgn : 1;
28
- };
29
- long double f;
30
- } x87reg;
31
-
32
- long double frexpl(long double value, int* exp)
33
- {
34
- int n;
35
- x87reg reg;
36
- reg.f = value;
37
- if(reg.exp == 0x7FFF) {
38
- /* The value is an infinity or NaN.
39
- * Store zero in `*exp`. Return the value as is. */
40
- *exp = 0;
41
- return reg.f;
42
- }
43
- if(reg.exp != 0) {
44
- /* The value is normalized.
45
- * Extract and zero out the exponent. */
46
- *exp = reg.exp - 0x3FFE;
47
- reg.exp = 0x3FFE;
48
- return reg.f;
49
- }
50
- if(reg.f64 == 0) {
51
- /* The value is zero.
52
- * Store zero in `*exp`. Return the value as is.
53
- * Note the signness. */
54
- *exp = 0;
55
- return reg.f;
56
- }
57
- /* The value is denormalized.
58
- * Extract the exponent, normalize the value, then zero out
59
- * the exponent. Note that x87 uses an explicit leading bit. */
60
- n = __builtin_clzll(reg.f64);
61
- reg.f64 <<= n;
62
- *exp = 1 - 0x3FFE - n;
63
- reg.exp = 0x3FFE;
64
- return reg.f;
65
- }
66
-
67
- #else
68
-
69
- #error Please add `frexpl()` implementation for this platform.
70
-
71
- #endif