a parser of Web IDL
latest version v1.4 surrpots Web IDL Editor’s Draft, 6 August 2018
opam install webidl
let () =
try
Webidl.Parse.data_from_file "file.idl" (* 1. *)
|> Webidl.Parse.show_data (* 2. *)
|> print_string
with
| Webidl.Parse.Syntax_error e -> (* 3. *)
print_string "[!]Syntax Error\nInfo:\n";
Webidl.Parse.show_syntax_error e (* 4. *)
|> print_string
|> print_newline
Webidl.Parse.data_from_file
Webidl.Parse.show_data
print parsed webidl data.
Webidl.Parse.Syntax_error e
if there is an syntax error, exception Syntax_error
is raised.
e
is a record which is defined in src/lib/parse.ml
Webidl.Parse.show_syntax_error
print infomation of parse error