| 1 |
|
| 2 |
|
| 3 |
% Xml-light bindings for Elpi |
| 4 |
|
| 5 |
% license: GNU Lesser General Public License Version 2.1 or later |
| 6 |
|
| 7 |
% ------------------------------------------------------------------------ |
| 8 |
|
| 9 |
% This code is not Rocq specific, i.e. could go to an Elpi specific |
| 10 |
% package. |
| 11 |
|
| 12 |
% Xml.xml |
| 13 |
kind xml type. |
| 14 |
external symbol xml.element : string -> list (pair string string) -> |
| 15 |
list xml -> xml = "1". % Attributes are sorted by key |
| 16 |
external symbol xml.pcdata : string -> xml = "1". |
| 17 |
|
| 18 |
% [xml.parse_file File XML D] like Xml.parse_file reads XML from File. |
| 19 |
% If D is error then XML is not assigned. |
| 20 |
external func xml.parse_file string -> xml, diagnostic. |
| 21 |
|
| 22 |
% [xml.parse_string String XML D] like Xml.parse_string reads XML from |
| 23 |
% String. |
| 24 |
% If D is error then XML is not assigned. |
| 25 |
external func xml.parse_string string -> xml, diagnostic. |
| 26 |
|
| 27 |
% [xml.to_string XML S D] like Xml.to_string write XML to a compact string |
| 28 |
% S. |
| 29 |
external func xml.to_string xml -> string, diagnostic. |
| 30 |
|
| 31 |
% [xml.to_string_fmt XML S D] like Xml.to_string_fmt write XML to a nice |
| 32 |
% string S. |
| 33 |
external func xml.to_string_fmt xml -> string, diagnostic. |
| 34 |
|
| 35 |
% ------------------------------------------------------------------------ |
| 36 |
|
| 37 |
% Rocq-Elpi APIs |
| 38 |
|
| 39 |
% ------------------------------------------------------------------------ |
| 40 |
|
| 41 |
|
| 42 |
func coq.xml->string xml -> string. |
| 43 |
coq.xml->string XML S :- xml.to_string_fmt XML S ok. |
| 44 |
|
| 45 |
func coq.string->xml string -> xml. |
| 46 |
coq.string->xml S XML :- xml.parse_string S XML ok. |
| 47 |
|
| 48 |
% [coq.extra-dep->xml Dep XML D] reads a xml file declared as an extra |
| 49 |
% dependency, see the coq.extra-dep API. |
| 50 |
func coq.extra-dep->xml string -> xml, diagnostic. |
| 51 |
coq.extra-dep->xml S XML D :- coq.extra-dep S (some P), !, xml.parse_file P XML D. |
| 52 |
coq.extra-dep->xml S _ (error Msg) :- Msg is "unknown Extra Dependency " ^ S. |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|