@@ -873,7 +873,7 @@ fn parseGlobalVarDecl(p: *Parse) !Node.Index {
873
873
874
874
p .nodes .items (.data )[var_decl ].rhs = init_node ;
875
875
876
- try p .expectSemicolon (.expected_semi_after_decl , false );
876
+ try p .expectSemicolon (.expected_semi_after_decl , true );
877
877
return var_decl ;
878
878
}
879
879
@@ -2432,6 +2432,11 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
2432
2432
if (lhs == 0 ) return null_node ;
2433
2433
const lbrace = p .eatToken (.l_brace ) orelse return lhs ;
2434
2434
2435
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .period ) { // zls
2436
+ try p .warn (.expected_initializer );
2437
+ p .tok_i += 1 ;
2438
+ }
2439
+
2435
2440
// If there are 0 or 1 items, we can use ArrayInitOne/StructInitOne;
2436
2441
// otherwise we use the full ArrayInit/StructInit.
2437
2442
@@ -2451,6 +2456,12 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
2451
2456
// Likely just a missing comma; give error but continue parsing.
2452
2457
else = > try p .warn (.expected_comma_after_initializer ),
2453
2458
}
2459
+ if (p .token_tags [p .tok_i ] == .period ) { // zls
2460
+ if (p .token_tags [p .tok_i + 1 ] == .period or p .token_tags [p .tok_i + 1 ] == .r_brace ) {
2461
+ try p .warn (.expected_initializer );
2462
+ p .tok_i += 1 ;
2463
+ }
2464
+ }
2454
2465
if (p .eatToken (.r_brace )) | _ | break ;
2455
2466
const next = try p .expectFieldInit ();
2456
2467
try p .scratch .append (p .gpa , next );
@@ -2479,6 +2490,10 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
2479
2490
}
2480
2491
2481
2492
while (true ) {
2493
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .r_brace ) { // zls
2494
+ try p .warn (.expected_expr );
2495
+ p .tok_i += 1 ;
2496
+ }
2482
2497
if (p .eatToken (.r_brace )) | _ | break ;
2483
2498
const elem_init = try p .expectExpr ();
2484
2499
try p .scratch .append (p .gpa , elem_init );
@@ -2851,6 +2866,11 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
2851
2866
const lbrace = p .tok_i + 1 ;
2852
2867
p .tok_i = lbrace + 1 ;
2853
2868
2869
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .period ) { // zls
2870
+ try p .warn (.expected_initializer );
2871
+ p .tok_i += 1 ;
2872
+ }
2873
+
2854
2874
// If there are 0, 1, or 2 items, we can use ArrayInitDotTwo/StructInitDotTwo;
2855
2875
// otherwise we use the full ArrayInitDot/StructInitDot.
2856
2876
@@ -2870,6 +2890,12 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
2870
2890
// Likely just a missing comma; give error but continue parsing.
2871
2891
else = > try p .warn (.expected_comma_after_initializer ),
2872
2892
}
2893
+ if (p .token_tags [p .tok_i ] == .period ) { // zls
2894
+ if (p .token_tags [p .tok_i + 1 ] == .period or p .token_tags [p .tok_i + 1 ] == .r_brace ) {
2895
+ try p .warn (.expected_initializer );
2896
+ p .tok_i += 1 ;
2897
+ }
2898
+ }
2873
2899
if (p .eatToken (.r_brace )) | _ | break ;
2874
2900
const next = try p .expectFieldInit ();
2875
2901
try p .scratch .append (p .gpa , next );
@@ -2909,6 +2935,10 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
2909
2935
}
2910
2936
2911
2937
while (true ) {
2938
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .r_brace ) { // zls
2939
+ try p .warn (.expected_expr );
2940
+ p .tok_i += 1 ;
2941
+ }
2912
2942
if (p .eatToken (.r_brace )) | _ | break ;
2913
2943
const elem_init = try p .expectExpr ();
2914
2944
try p .scratch .append (p .gpa , elem_init );
@@ -3130,6 +3160,10 @@ fn expectSwitchExpr(p: *Parse) !Node.Index {
3130
3160
_ = try p .expectToken (.l_brace );
3131
3161
const cases = try p .parseSwitchProngList ();
3132
3162
const trailing_comma = p .token_tags [p .tok_i - 1 ] == .comma ;
3163
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .r_brace ) { // zls
3164
+ try p .warn (.expected_expr );
3165
+ p .tok_i += 1 ;
3166
+ }
3133
3167
_ = try p .expectToken (.r_brace );
3134
3168
3135
3169
return p .addNode (.{
@@ -3439,6 +3473,10 @@ fn parseSwitchProng(p: *Parse) !Node.Index {
3439
3473
3440
3474
if (p .eatToken (.keyword_else ) == null ) {
3441
3475
while (true ) {
3476
+ if (p .token_tags [p .tok_i ] == .period and p .token_tags [p .tok_i + 1 ] == .period ) { // zls
3477
+ try p .warn (.expected_expr );
3478
+ p .tok_i += 1 ;
3479
+ }
3442
3480
const item = try p .parseSwitchItem ();
3443
3481
if (item == 0 ) break ;
3444
3482
try p .scratch .append (p .gpa , item );
0 commit comments