Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ profile. This started with version 0.26.0.
This might change the formatting of some functions due to the formatting code
being completely rewritten.

- Support OCaml 5.3 syntax (#2609, @Julow)

- Documentation comments are now formatted by default (#2390, @Julow)
Use the option `parse-docstrings = false` to restore the previous behavior.

Expand Down
2 changes: 1 addition & 1 deletion lib/Extended_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module Parse = struct
map fg (normalize_mapper ~ocaml_version ~preserve_beginend)
@@
let lexbuf = Lexing.from_string str in
Location.init lexbuf input_name ;
Location.init_info lexbuf input_name ;
match fg with
| Structure -> Parse.implementation lexbuf
| Signature -> Parse.interface lexbuf
Expand Down
4 changes: 2 additions & 2 deletions lib/Parse_with_comments.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let tokens lexbuf =

let fresh_lexbuf source =
let lexbuf = Lexing.from_string source in
Location.init lexbuf !Location.input_name ;
Location.init_info lexbuf !Location.input_name ;
let hash_bang =
Lexer.skip_hash_bang lexbuf ;
let len = lexbuf.lex_last_pos in
Expand All @@ -54,7 +54,7 @@ let fresh_lexbuf source =

let split_hash_bang source =
let lexbuf = Lexing.from_string source in
Location.init lexbuf !Location.input_name ;
Location.init_info lexbuf !Location.input_name ;
Lexer.skip_hash_bang lexbuf ;
let len = lexbuf.lex_last_pos in
let hash_bang = String.sub source ~pos:0 ~len in
Expand Down
2 changes: 1 addition & 1 deletion lib/Std_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let map (type a) (x : a t) (m : Ast_mapper.mapper) : a -> a =
module Parse = struct
let ast (type a) (fg : a t) ~input_name str : a =
let lexbuf = Lexing.from_string str in
Location.init lexbuf input_name ;
Location.init_info lexbuf input_name ;
match fg with
| Structure -> Parse.implementation lexbuf
| Signature -> Parse.interface lexbuf
Expand Down
4 changes: 4 additions & 0 deletions test/unit/test_translation_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ let test_parse_and_format_core_type =
(Error
{|test_unit: ignoring "<test>" (syntax error)
File "<test>", line 1, characters 0-2:
1 | ;;
^^
Error: Syntax error
|}
) ]
Expand Down Expand Up @@ -69,6 +71,8 @@ let test_parse_and_format_module_type =
File "<test>", line 1, characters 3-3:
Error: Syntax error: "end" expected
File "<test>", line 1, characters 0-3:
1 | sig
^^^
This "sig" might be unmatched
|}
)
Expand Down
Loading
Loading