@@ -659,6 +659,7 @@ let is_type_macro_ident =
659659 "msgpack_unpack_struct";
660660 "STACK_OF";
661661 "LHASH_OF";
662+ "VOLATILE";
662663 ] in
663664 let names = Xset.create 0 in
664665 List.iter (Xset.add names) l;
@@ -2166,6 +2167,11 @@ let parse_warning env stp edp (fmt : ('a, out_channel, unit, 'b) format4) : 'a =
21662167 let head = Printf.sprintf "[%s]" path in
21672168 PB.parse_warning ~out:stderr ~head stp edp fmt
21682169
2170+ let is_start_of_stmt sc =
2171+ match sc with
2172+ | C.START_OF_STMT _ -> true
2173+ | _ -> false
2174+
21692175let conv_token (env : Aux.env) scanner (token : token) =
21702176 DEBUG_MSG "@";
21712177 let self = (scanner :> c_t) in
@@ -4800,6 +4806,7 @@ let conv_token (env : Aux.env) scanner (token : token) =
48004806 end -> DEBUG_MSG "(COMMA|LPAREN|QUEST) @ TY_LPAREN"; mk (T.IDENT_EM s)
48014807
48024808 | TY_LPAREN when env#at_arg_paren && begin
4809+ (prev_rawtoken == COMMA || prev_rawtoken == LPAREN) &&
48034810 match self#peek_nth_rawtoken 2 with
48044811 | IDENT x -> begin
48054812 match self#peek_nth_rawtoken 3 with
@@ -5792,7 +5799,18 @@ let conv_token (env : Aux.env) scanner (token : token) =
57925799 token
57935800 end
57945801
5795- | _ -> DEBUG_MSG "* @ * %s" env#name_prefix; mk (T.IDENT_V s)
5802+ | _ -> begin
5803+ DEBUG_MSG "* @ * (name_prefix=%s)" env#name_prefix;
5804+ if
5805+ not env#braced_init_flag &&
5806+ not env#stack#at_enum &&
5807+ self#peek_rawtoken() == RBRACE
5808+ then begin
5809+ DEBUG_MSG "complementing with a semicolon";
5810+ self#prepend_token (mk_ (T.SEMICOLON false))
5811+ end;
5812+ mk (T.IDENT_V s)
5813+ end
57965814 end
57975815 end
57985816 | MEM_INIT, END_OF_TY_SPEC when
@@ -14286,7 +14304,9 @@ let conv_token (env : Aux.env) scanner (token : token) =
1428614304 match ll with
1428714305 | [l] -> begin
1428814306 DEBUG_MSG "l=%s" (String.concat ";" (List.map Token.rawtoken_to_string l));
14289- is_ty (self#peek_nth_rawtoken (nth+2)) && self#peek_nth_rawtoken (nth+3) != TY_LPAREN ||
14307+ (prev_rawtoken != NEW || self#peek_nth_rawtoken (nth+1) != TY_LPAREN) &&
14308+ is_ty (self#peek_nth_rawtoken (nth+2)) &&
14309+ self#peek_nth_rawtoken (nth+3) != TY_LPAREN ||
1429014310 match (l : T.token list) with
1429114311 | x::_ when is_ty x -> true
1429214312 | [IDENT _;ELAB_ENUM] -> true
@@ -14477,6 +14497,13 @@ let conv_token (env : Aux.env) scanner (token : token) =
1447714497 context != EXPR
1447814498 end -> DEBUG_MSG "@ ... RPAREN TY_TEMPL_GT"; token
1447914499
14500+ | SEMICOLON _ when begin
14501+ context == NEW && sub_context == INI && prev_rawtoken == RPAREN &&
14502+ match self#peek_rawtoken() with
14503+ | IDENT _ -> true
14504+ | _ -> false
14505+ end -> DEBUG_MSG "@ ... RPAREN SEMICOLON"; token
14506+
1448014507 | rt -> DEBUG_MSG "@ ... RPAREN %s" (Token.rawtoken_to_string rt); mk T.LPAREN
1448114508 end
1448214509 with
@@ -29206,7 +29233,9 @@ module F (Stat : Aux.STATE_T) = struct
2920629233 env#close_in_body_brace()
2920729234 else if
2920829235 (env#end_of_class_spec_flag || env#in_body_brace_flag) &&
29209- not (is_semicolon prev_rawtoken) && not env#braced_init_flag &&
29236+ not (is_start_of_stmt sub_context) &&
29237+ not (is_semicolon prev_rawtoken) &&
29238+ not env#braced_init_flag &&
2921029239 (match prev_rawtoken with
2921129240 | NEWLINE | LBRACE -> false
2921229241 | RBRACE when not env#end_of_class_spec_flag -> false
0 commit comments