-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathxml.dtd.m
96 lines (78 loc) · 2.42 KB
/
xml.dtd.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Copyright (C) 2000 The University of Melbourne.
% Copyright (C) 2014, 2018, 2022 The Mercury team.
% This file is distributed under the terms specified in COPYING.LIB.
%---------------------------------------------------------------------------%
%
% Main author: conway@cs.mu.oz.au.
%
%---------------------------------------------------------------------------%
:- module xml.dtd.
:- interface.
:- import_module list.
:- import_module map.
%---------------------------------------------------------------------------%
:- type name == string.
:- type token == string.
:- type dtd
---> dtd(
dtd_root :: name,
dtd_elements :: map(name, element),
dtd_entities :: map(name, entity_def),
dtd_p_entities :: map(name, entity_def)
).
:- type element
---> element(
elt_name :: name,
elt_attrs :: map(name, attribute),
elt_content :: content
).
:- type content
---> empty
; any
; children(content_particle)
; mixed(mixed).
:- type content_particle
---> children_reps(children, multiplicity).
:- type children
---> seq(list(content_particle))
; alt(list(content_particle))
; element(name).
:- type mixed
---> mixed(list(name)).
:- type multiplicity
---> one
; zero_or_more
; one_or_more
; zero_or_one.
:- type attribute
---> attribute(
attr_name :: name,
attr_type :: attr_type,
attr_default :: default
).
:- type attr_type
---> attr_cdata
; attr_id
; attr_id_ref
; attr_id_refs
; attr_entity
; attr_entities
; attr_nm_token
; attr_nm_tokens
; attr_notation(list(token))
; attr_enum(list(token)).
:- type default
---> required
; implied
; defaulted(string)
; fixed(string).
:- type entity_def
---> entity_internal(entity)
; entity_external(external_id).
:- type entity == string.
:- type external_id
---> system(string)
; public(string, string).