@@ -873,7 +873,7 @@ fn parseGlobalVarDecl(p: *Parse) !Node.Index {
873873
874874 p .nodes .items (.data )[var_decl ].rhs = init_node ;
875875
876- try p .expectSemicolon (.expected_semi_after_decl , false );
876+ try p .expectSemicolon (.expected_semi_after_decl , true );
877877 return var_decl ;
878878}
879879
@@ -2432,6 +2432,11 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
24322432 if (lhs == 0 ) return null_node ;
24332433 const lbrace = p .eatToken (.l_brace ) orelse return lhs ;
24342434
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+
24352440 // If there are 0 or 1 items, we can use ArrayInitOne/StructInitOne;
24362441 // otherwise we use the full ArrayInit/StructInit.
24372442
@@ -2451,6 +2456,12 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
24512456 // Likely just a missing comma; give error but continue parsing.
24522457 else = > try p .warn (.expected_comma_after_initializer ),
24532458 }
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+ }
24542465 if (p .eatToken (.r_brace )) | _ | break ;
24552466 const next = try p .expectFieldInit ();
24562467 try p .scratch .append (p .gpa , next );
@@ -2479,6 +2490,10 @@ fn parseCurlySuffixExpr(p: *Parse) !Node.Index {
24792490 }
24802491
24812492 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+ }
24822497 if (p .eatToken (.r_brace )) | _ | break ;
24832498 const elem_init = try p .expectExpr ();
24842499 try p .scratch .append (p .gpa , elem_init );
@@ -2851,6 +2866,11 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
28512866 const lbrace = p .tok_i + 1 ;
28522867 p .tok_i = lbrace + 1 ;
28532868
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+
28542874 // If there are 0, 1, or 2 items, we can use ArrayInitDotTwo/StructInitDotTwo;
28552875 // otherwise we use the full ArrayInitDot/StructInitDot.
28562876
@@ -2870,6 +2890,12 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
28702890 // Likely just a missing comma; give error but continue parsing.
28712891 else = > try p .warn (.expected_comma_after_initializer ),
28722892 }
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+ }
28732899 if (p .eatToken (.r_brace )) | _ | break ;
28742900 const next = try p .expectFieldInit ();
28752901 try p .scratch .append (p .gpa , next );
@@ -2909,6 +2935,10 @@ fn parsePrimaryTypeExpr(p: *Parse) !Node.Index {
29092935 }
29102936
29112937 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+ }
29122942 if (p .eatToken (.r_brace )) | _ | break ;
29132943 const elem_init = try p .expectExpr ();
29142944 try p .scratch .append (p .gpa , elem_init );
@@ -3130,6 +3160,10 @@ fn expectSwitchExpr(p: *Parse) !Node.Index {
31303160 _ = try p .expectToken (.l_brace );
31313161 const cases = try p .parseSwitchProngList ();
31323162 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+ }
31333167 _ = try p .expectToken (.r_brace );
31343168
31353169 return p .addNode (.{
@@ -3439,6 +3473,10 @@ fn parseSwitchProng(p: *Parse) !Node.Index {
34393473
34403474 if (p .eatToken (.keyword_else ) == null ) {
34413475 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+ }
34423480 const item = try p .parseSwitchItem ();
34433481 if (item == 0 ) break ;
34443482 try p .scratch .append (p .gpa , item );
0 commit comments