Skip to content

Commit 42833ed

Browse files
committed
Sync from latest syntax including PR 605
rescript-lang/syntax#605
1 parent 9ca2eed commit 42833ed

File tree

8 files changed

+893
-691
lines changed

8 files changed

+893
-691
lines changed

analysis/vendor/res_outcome_printer/res_comment.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
type style = SingleLine | MultiLine | DocComment
1+
type style = SingleLine | MultiLine | DocComment | ModuleComment
22

33
let styleToString s =
44
match s with
55
| SingleLine -> "SingleLine"
66
| MultiLine -> "MultiLine"
77
| DocComment -> "DocComment"
8+
| ModuleComment -> "ModuleComment"
89

910
type t = {
1011
txt: string;
@@ -23,6 +24,8 @@ let isSingleLineComment t = t.style = SingleLine
2324

2425
let isDocComment t = t.style = DocComment
2526

27+
let isModuleComment t = t.style = ModuleComment
28+
2629
let toString t =
2730
let {Location.loc_start; loc_end} = t.loc in
2831
Format.sprintf "(txt: %s\nstyle: %s\nlocation: %d,%d-%d,%d)" t.txt
@@ -34,11 +37,13 @@ let toString t =
3437
let makeSingleLineComment ~loc txt =
3538
{txt; loc; style = SingleLine; prevTokEndPos = Lexing.dummy_pos}
3639

37-
let makeMultiLineComment ~loc ~docComment txt =
40+
let makeMultiLineComment ~loc ~docComment ~standalone txt =
3841
{
3942
txt;
4043
loc;
41-
style = (if docComment then DocComment else MultiLine);
44+
style =
45+
(if docComment then if standalone then ModuleComment else DocComment
46+
else MultiLine);
4247
prevTokEndPos = Lexing.dummy_pos;
4348
}
4449

analysis/vendor/res_outcome_printer/res_comment.mli

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ val setPrevTokEndPos : t -> Lexing.position -> unit
1010

1111
val isDocComment : t -> bool
1212

13+
val isModuleComment : t -> bool
14+
1315
val isSingleLineComment : t -> bool
1416

1517
val makeSingleLineComment : loc:Location.t -> string -> t
16-
val makeMultiLineComment : loc:Location.t -> docComment:bool -> string -> t
18+
val makeMultiLineComment :
19+
loc:Location.t -> docComment:bool -> standalone:bool -> string -> t
1720
val fromOcamlComment :
1821
loc:Location.t -> txt:string -> prevTokEndPos:Lexing.position -> t
1922
val trimSpaces : string -> string

0 commit comments

Comments
 (0)