File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -4885,16 +4885,27 @@ and parse_constr_decl_args p =
48854885 * | constr-name const-args
48864886 * | attrs constr-name const-args *)
48874887and parse_type_constructor_declaration_with_bar p =
4888- let doc_comment_attrs =
4889- match p.Parser. token with
4890- | DocComment (loc , s ) ->
4891- Parser. next p;
4892- [doc_comment_to_attribute loc s]
4893- | _ -> []
4888+ let is_constructor_with_bar p =
4889+ Parser. lookahead p (fun state ->
4890+ match state.Parser. token with
4891+ | DocComment _ -> (
4892+ Parser. next state;
4893+ match state.token with
4894+ | Bar -> true
4895+ | _ -> false )
4896+ | Bar -> true
4897+ | _ -> false )
48944898 in
4895- let has_doc_comment = not (doc_comment_attrs = [] ) in
48964899 match p.Parser. token with
4897- | Bar ->
4900+ | _ when is_constructor_with_bar p ->
4901+ let doc_comment_attrs =
4902+ match p.Parser. token with
4903+ | DocComment (loc , s ) ->
4904+ Parser. next p;
4905+ [doc_comment_to_attribute loc s]
4906+ | _ -> []
4907+ in
4908+ let has_doc_comment = not (doc_comment_attrs = [] ) in
48984909 let start_pos = p.Parser. start_pos in
48994910 Parser. next p;
49004911 let constr = parse_type_constructor_declaration ~start_pos p in
@@ -4946,6 +4957,7 @@ and parse_type_constructor_declarations ?first p =
49464957 let first_constr_decl =
49474958 match first with
49484959 | None ->
4960+ (* bar *)
49494961 let doc_comment_attrs =
49504962 match p.Parser. token with
49514963 | DocComment (loc , s ) ->
You can’t perform that action at this time.
0 commit comments