Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit e1b2598

Browse files
authored
Fix example (#514)
1 parent 7cdefef commit e1b2598

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,20 @@ Right now, ReScript's compiler's error reporting mechanism, for architectural re
107107
### Example API usage
108108

109109
```ocaml
110-
module Parser = ResCore.Parser
111-
module Diagnostics = ResCore.Diagnostics
112-
113110
let filename = "foo.res"
114111
let src = FS.readFile filename
115112
116113
let p =
117114
(* intended for ocaml compiler *)
118-
let mode = Parser.ParseForTypeChecker in
119-
(* if you want to target the printer use: let mode = Parser.Default in*)
120-
Parser.make ~mode src filename
115+
let mode = Res_parser.ParseForTypeChecker in
116+
(* if you want to target the printer use: let mode = Res_parser.Default in*)
117+
Res_parser.make ~mode src filename
121118
122-
let structure = ResParser.parseImplementation p
123-
let signature = ResParser.parseInterface p
119+
let structure = Res_core.parseImplementation p
120+
let signature = Res_core.parseSpecification p
124121
125-
let () = match p.Parser.diagnostics with
122+
let () = match p.diagnostics with
126123
| [] -> () (* no problems *)
127124
| diagnostics -> (* parser contains problems *)
128-
prerr_string (
129-
Diagnostics.stringOfReport
130-
~style:Diagnostics.Pretty
131-
diagnostics src
132-
)
125+
Res_diagnostics.printReport diagnostics src
133126
```

0 commit comments

Comments
 (0)