Skip to content

Commit

Permalink
Backport changed newline parsing in code spans
Browse files Browse the repository at this point in the history
  • Loading branch information
Julow committed Nov 27, 2024
1 parent 6ff121f commit e5bcd2f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions test/passing/refs.default/doc_comments-no-wrap.mli.err
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Warning: doc_comments-no-wrap.mli:110 exceeds the margin
Warning: doc_comments-no-wrap.mli:115 exceeds the margin
Warning: doc_comments-no-wrap.mli:124 exceeds the margin
Warning: doc_comments-no-wrap.mli:328 exceeds the margin
Warning: doc_comments-no-wrap.mli:384 exceeds the margin
Warning: doc_comments-no-wrap.mli:556 exceeds the margin
Warning: doc_comments-no-wrap.mli:625 exceeds the margin
Warning: doc_comments-no-wrap.mli:648 exceeds the margin
Warning: doc_comments-no-wrap.mli:383 exceeds the margin
Warning: doc_comments-no-wrap.mli:555 exceeds the margin
Warning: doc_comments-no-wrap.mli:624 exceeds the margin
Warning: doc_comments-no-wrap.mli:647 exceeds the margin
3 changes: 1 addition & 2 deletions test/passing/refs.default/doc_comments-no-wrap.mli.ref
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ end

(** {%html:<p>Raw markup</p>%} {%Without language%} {%other:Other language%} *)

(** [Multi
Line]
(** [Multi Line]

[ A lot of spaces ]

Expand Down
8 changes: 4 additions & 4 deletions test/passing/refs.default/doc_comments.mli.err
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Warning: doc_comments.mli:110 exceeds the margin
Warning: doc_comments.mli:115 exceeds the margin
Warning: doc_comments.mli:124 exceeds the margin
Warning: doc_comments.mli:328 exceeds the margin
Warning: doc_comments.mli:384 exceeds the margin
Warning: doc_comments.mli:556 exceeds the margin
Warning: doc_comments.mli:625 exceeds the margin
Warning: doc_comments.mli:648 exceeds the margin
Warning: doc_comments.mli:383 exceeds the margin
Warning: doc_comments.mli:555 exceeds the margin
Warning: doc_comments.mli:624 exceeds the margin
Warning: doc_comments.mli:647 exceeds the margin
3 changes: 1 addition & 2 deletions test/passing/refs.default/doc_comments.mli.ref
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ end

(** {%html:<p>Raw markup</p>%} {%Without language%} {%other:Other language%} *)

(** [Multi
Line]
(** [Multi Line]

[ A lot of spaces ]

Expand Down
2 changes: 1 addition & 1 deletion test/passing/refs.default/js_source.ml.err
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Warning: js_source.ml:122 exceeds the margin
Warning: js_source.ml:156 exceeds the margin
Warning: js_source.ml:229 exceeds the margin
Warning: js_source.ml:327 exceeds the margin
Warning: js_source.ml:809 exceeds the margin
Warning: js_source.ml:808 exceeds the margin
3 changes: 1 addition & 2 deletions test/passing/refs.default/js_source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ let _ =

(*$ (* *) *)

(** xxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx
xxxx]
(** xxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx xxxx]
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx] *)

(* Hand-aligned comment
Expand Down
7 changes: 5 additions & 2 deletions vendor/odoc-parser/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,16 @@ and code_span buffer nesting_level start_offset input = parse
{ Buffer.add_char buffer c;
code_span buffer nesting_level start_offset input lexbuf }

| newline newline
| newline horizontal_space* (newline horizontal_space*)+
{ warning
input
(Parse_error.not_allowed
~what:(Token.describe (`Blank_line "\n\n"))
~in_what:(Token.describe (`Code_span "")));
Buffer.add_char buffer '\n';
Buffer.add_char buffer ' ';
code_span buffer nesting_level start_offset input lexbuf }
| newline horizontal_space*
{ Buffer.add_char buffer ' ';
code_span buffer nesting_level start_offset input lexbuf }

| eof
Expand Down

0 comments on commit e5bcd2f

Please sign in to comment.