1
+ # convert to mrdox.rng with trang.jar (https://relaxng.org/jclark/trang.html)
2
+ # when commiting beacuse xmllint doesn't understand the compact format
3
+
4
+ namespace xsi= "http://www.w3.org/2001/XMLSchema-instance"
5
+
6
+ grammar {
7
+ start = element mrdox {
8
+ attribute xsi:noNamespaceSchemaLocation {text}?,
9
+ NamespaceInfo
10
+ }
11
+ Id = attribute id { text }
12
+ Name = attribute name { text }
13
+ Attr = element attr { Id, Name ?, attribute value { text } ?}
14
+
15
+ NamespaceInfo = element namespace {
16
+ Name,
17
+ Id?,
18
+ Info,
19
+ Javadoc?,
20
+ Scope
21
+ }
22
+
23
+ Symbol = (
24
+ attribute Tag { text },
25
+ attribute Name { text },
26
+ Id
27
+ )
28
+
29
+ Symbols = element symbols {
30
+ element symbol { Symbol }
31
+ }*
32
+
33
+ SymbolInfo = (
34
+ Info,
35
+ Location *
36
+ )
37
+
38
+ TemplateParamInfo = element tparam { attribute decl { text } }
39
+
40
+ BaseRecordinfo = element base {
41
+ Name, Access, attribute modifier { "virtual" } ?, Id
42
+ }
43
+
44
+ RecordInfoContent = (Name,
45
+ Id,
46
+ (SymbolInfo |
47
+ Attr |
48
+ TemplateParamInfo |
49
+ BaseRecordinfo |
50
+ MemberTypeInfo |
51
+ element friend { Id } |
52
+ Javadoc? |
53
+ Scope)*)
54
+
55
+ RecordInfo =
56
+ element class { RecordInfoContent } |
57
+ element struct { RecordInfoContent } |
58
+ element union { RecordInfoContent }
59
+
60
+ FunctionInfo = element function {
61
+ Name,
62
+ Access?,
63
+ Id,
64
+ (SymbolInfo |
65
+ Attr* |
66
+ element return { attribute type { text }, Id? } |
67
+ element param {
68
+ Name?,
69
+ attribute type { text },
70
+ attribute default { text } ?,
71
+ Id?
72
+ }* |
73
+ TemplateParamInfo* |
74
+ Javadoc?)*
75
+ }
76
+
77
+ TypedefInfo = element using
78
+ {
79
+ Name, Id,
80
+ SymbolInfo,
81
+ element type { Name, Id? }
82
+ } | element typedef
83
+ {
84
+ Name, Id,
85
+ SymbolInfo,
86
+ element type { Name, Id? }
87
+ }
88
+
89
+
90
+ EnumInfo = element enum {
91
+ Name,
92
+ attribute class {"scoped"} ?,
93
+ attribute type { text } ?,
94
+ Id,
95
+ SymbolInfo,
96
+ element \element {
97
+ Name,
98
+ attribute Value { text }
99
+ }*,
100
+ Javadoc?
101
+ }
102
+
103
+ VariableInfo = element variable {
104
+ Name,
105
+ Id,
106
+ (Location &
107
+ Attr* &
108
+ element type { Name, Id? } &
109
+ Javadoc?)
110
+ }
111
+
112
+ Info = empty
113
+
114
+ Location = element file {
115
+ attribute path {text},
116
+ attribute line {text},
117
+ attribute class {"def"}?,
118
+ empty}
119
+
120
+ BaseRecordInfo = element base {
121
+ Name,
122
+ Access,
123
+ attribute modifier {"virtual"} ?,
124
+ Id
125
+ }
126
+
127
+ Access = attribute access { "public"|"private"|"protected" }
128
+
129
+ MemberTypeInfo = element data {
130
+ Name,
131
+ attribute type { text },
132
+ attribute value { text } ?,
133
+ Access,
134
+ Id?
135
+ }
136
+
137
+ StorageClass = (
138
+ element extern {empty} |
139
+ element static {empty} |
140
+ element private-extern {empty} |
141
+ element sc-auto {empty} |
142
+ element sc-register {empty}
143
+ )
144
+
145
+ Scope = (
146
+ NamespaceInfo |
147
+ RecordInfo |
148
+ FunctionInfo |
149
+ TypedefInfo |
150
+ EnumInfo |
151
+ VariableInfo)*
152
+
153
+ # JavaDoc not in a nested grammar , so we can convert it to a XSD
154
+
155
+ Javadoc = element doc {Brief ?, Node* }
156
+ Text = element text { text }
157
+ Brief = element brief { Node * }
158
+ Node = (Text | Styled | Paragraph | Brief | Admonition | Code | Param | TParam | Returns)
159
+ Styled = (
160
+ element none { text } |
161
+ element mono { text } |
162
+ element bold { text } |
163
+ element italic { text })
164
+ Paragraph = element para {
165
+ attribute class { text } ?,
166
+ Node*
167
+ }
168
+
169
+ Admonition = Paragraph
170
+ Code = element code { Node * }
171
+ Param = element param {
172
+ attribute name { text } ?,
173
+ Node*
174
+ }
175
+
176
+ TParam = element tparam {
177
+ attribute name { text } ?,
178
+ Node*
179
+ }
180
+ Returns = element returns { Node * }
181
+
182
+ }
0 commit comments