• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2
3<grammar xmlns="http://relaxng.org/ns/structure/1.0"
4         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
5
6  <start>
7    <choice>
8      <!-- Everything else not explicitly mentioned below. -->
9      <ref name="Other" />
10
11      <ref name="Function" />
12      <ref name="Class" />
13      <ref name="Variable" />
14      <ref name="Namespace" />
15      <ref name="Typedef" />
16      <ref name="Enum" />
17    </choice>
18  </start>
19
20  <define name="Other">
21    <element name="Other">
22      <ref name="attrSourceLocation" />
23      <ref name="Name" />
24      <optional>
25        <ref name="USR" />
26      </optional>
27      <optional>
28        <ref name="Headerfile" />
29      </optional>
30      <optional>
31        <ref name="Declaration" />
32      </optional>
33      <optional>
34        <ref name="Abstract" />
35      </optional>
36      <optional>
37        <ref name="TemplateParameters" />
38      </optional>
39      <optional>
40        <ref name="Parameters" />
41      </optional>
42      <optional>
43        <ref name="ResultDiscussion" />
44      </optional>
45      <optional>
46        <ref name="Discussion" />
47      </optional>
48    </element>
49  </define>
50
51  <define name="Function">
52    <element name="Function">
53      <optional>
54        <attribute name="templateKind">
55          <choice>
56            <value>template</value>
57            <value>specialization</value>
58          </choice>
59        </attribute>
60      </optional>
61      <ref name="attrSourceLocation" />
62
63      <optional>
64        <attribute name="isInstanceMethod">
65          <data type="boolean" />
66        </attribute>
67      </optional>
68      <optional>
69        <attribute name="isClassMethod">
70          <data type="boolean" />
71        </attribute>
72      </optional>
73
74      <ref name="Name" />
75      <optional>
76        <ref name="USR" />
77      </optional>
78      <!-- TODO: Add exception specification. -->
79      <optional>
80        <ref name="Headerfile" />
81      </optional>
82      <optional>
83        <ref name="Declaration" />
84      </optional>
85      <optional>
86        <ref name="Abstract" />
87      </optional>
88      <optional>
89        <ref name="TemplateParameters" />
90      </optional>
91      <optional>
92        <ref name="Parameters" />
93      </optional>
94      <zeroOrMore>
95        <ref name="Availability" />
96      </zeroOrMore>
97      <zeroOrMore>
98        <ref name="Deprecated" />
99      </zeroOrMore>
100      <zeroOrMore>
101        <ref name="Unavailable" />
102      </zeroOrMore>
103      <optional>
104        <ref name="ResultDiscussion" />
105      </optional>
106      <optional>
107        <ref name="Discussion" />
108      </optional>
109    </element>
110  </define>
111
112  <define name="Class">
113    <element name="Class">
114      <optional>
115        <attribute name="templateKind">
116          <choice>
117            <value>template</value>
118            <value>specialization</value>
119            <value>partialSpecialization</value>
120          </choice>
121        </attribute>
122      </optional>
123      <ref name="attrSourceLocation" />
124
125      <ref name="Name" />
126      <optional>
127        <ref name="USR" />
128      </optional>
129      <optional>
130        <ref name="Headerfile" />
131      </optional>
132      <optional>
133        <ref name="Declaration" />
134      </optional>
135      <optional>
136        <ref name="Abstract" />
137      </optional>
138      <optional>
139        <ref name="TemplateParameters" />
140      </optional>
141
142      <!-- Parameters and results don't make sense for classes, but the user
143           can specify \param or \returns in a comment anyway. -->
144      <optional>
145        <ref name="Parameters" />
146      </optional>
147      <optional>
148        <ref name="ResultDiscussion" />
149      </optional>
150
151      <optional>
152        <ref name="Discussion" />
153      </optional>
154    </element>
155  </define>
156
157  <define name="Variable">
158    <element name="Variable">
159      <ref name="attrSourceLocation" />
160      <ref name="Name" />
161      <optional>
162        <ref name="USR" />
163      </optional>
164      <optional>
165        <ref name="Headerfile" />
166      </optional>
167      <optional>
168        <ref name="Declaration" />
169      </optional>
170      <optional>
171        <ref name="Abstract" />
172      </optional>
173
174      <!-- Template parameters, parameters and results don't make sense for
175            variables, but the user can specify \tparam \param or \returns
176            in a comment anyway. -->
177      <optional>
178        <ref name="TemplateParameters" />
179      </optional>
180      <optional>
181        <ref name="Parameters" />
182      </optional>
183      <optional>
184        <ref name="ResultDiscussion" />
185      </optional>
186
187      <optional>
188        <ref name="Discussion" />
189      </optional>
190    </element>
191  </define>
192
193  <define name="Namespace">
194    <element name="Namespace">
195      <ref name="attrSourceLocation" />
196      <ref name="Name" />
197      <optional>
198        <ref name="USR" />
199      </optional>
200      <optional>
201        <ref name="Headerfile" />
202      </optional>
203      <optional>
204        <ref name="Declaration" />
205      </optional>
206      <optional>
207        <ref name="Abstract" />
208      </optional>
209
210      <!-- Template parameters, parameters and results don't make sense for
211           namespaces, but the user can specify \tparam, \param or \returns
212           in a comment anyway. -->
213      <optional>
214        <ref name="TemplateParameters" />
215      </optional>
216      <optional>
217        <ref name="Parameters" />
218      </optional>
219      <optional>
220        <ref name="ResultDiscussion" />
221      </optional>
222
223      <optional>
224        <ref name="Discussion" />
225      </optional>
226    </element>
227  </define>
228
229  <define name="Typedef">
230    <element name="Typedef">
231      <ref name="attrSourceLocation" />
232      <ref name="Name" />
233      <optional>
234        <ref name="USR" />
235      </optional>
236      <optional>
237        <ref name="Headerfile" />
238      </optional>
239      <optional>
240        <ref name="Declaration" />
241      </optional>
242      <optional>
243        <ref name="Abstract" />
244      </optional>
245
246      <optional>
247        <ref name="TemplateParameters" />
248      </optional>
249
250      <!-- Parameters and results might make sense for typedefs if the type is
251           a function pointer type. -->
252      <optional>
253        <ref name="Parameters" />
254      </optional>
255      <optional>
256        <ref name="ResultDiscussion" />
257      </optional>
258
259      <optional>
260        <ref name="Discussion" />
261      </optional>
262    </element>
263  </define>
264
265  <define name="Enum">
266    <element name="Enum">
267      <ref name="attrSourceLocation" />
268      <ref name="Name" />
269      <optional>
270        <ref name="USR" />
271      </optional>
272      <optional>
273        <ref name="Headerfile" />
274      </optional>
275      <optional>
276        <ref name="Declaration" />
277      </optional>
278      <optional>
279        <ref name="Abstract" />
280      </optional>
281
282      <!-- Template parameters, parameters and results don't make sense for
283            enums, but the user can specify \tparam \param or \returns in a
284            comment anyway. -->
285      <optional>
286        <ref name="TemplateParameters" />
287      </optional>
288      <optional>
289        <ref name="Parameters" />
290      </optional>
291      <optional>
292        <ref name="ResultDiscussion" />
293      </optional>
294
295      <optional>
296        <ref name="Discussion" />
297      </optional>
298    </element>
299  </define>
300
301  <define name="attrSourceLocation">
302    <optional>
303      <attribute name="file">
304        <!-- Non-empty text content. -->
305        <data type="string">
306          <param name="pattern">.*\S.*</param>
307        </data>
308      </attribute>
309    </optional>
310    <optional>
311      <attribute name="line">
312        <data type="positiveInteger" />
313      </attribute>
314      <attribute name="column">
315        <data type="positiveInteger" />
316      </attribute>
317    </optional>
318  </define>
319
320  <define name="Name">
321    <element name="Name">
322      <!-- Non-empty text content. -->
323      <data type="string">
324        <param name="pattern">.*\S.*</param>
325      </data>
326    </element>
327  </define>
328
329  <define name="USR">
330    <element name="USR">
331      <!-- Non-empty text content. -->
332      <data type="string">
333        <param name="pattern">.*\S.*</param>
334      </data>
335    </element>
336  </define>
337
338  <define name="Abstract">
339    <element name="Abstract">
340      <zeroOrMore>
341        <ref name="TextBlockContent" />
342      </zeroOrMore>
343    </element>
344  </define>
345
346  <define name="Declaration">
347    <element name="Declaration">
348      <!-- Non-empty text content. -->
349      <data type="string"/>
350    </element>
351  </define>
352
353  <define name="Headerfile">
354    <element name="Headerfile">
355      <oneOrMore>
356        <ref name="TextBlockContent" />
357      </oneOrMore>
358    </element>
359  </define>
360
361  <define name="Discussion">
362    <element name="Discussion">
363      <zeroOrMore>
364        <ref name="TextBlockContent" />
365      </zeroOrMore>
366    </element>
367  </define>
368
369  <define name="TemplateParameters">
370    <element name="TemplateParameters">
371      <!-- Parameter elements should be sorted according to position. -->
372      <oneOrMore>
373        <element name="Parameter">
374          <element name="Name">
375            <!-- Non-empty text content. -->
376            <data type="string">
377              <param name="pattern">.*\S.*</param>
378            </data>
379          </element>
380          <optional>
381            <!-- This is index at depth 0.  libclang API can return more
382                 information about position, but we expose only essential
383                 information here, since "Parameter" elements are already
384                 sorted.
385
386                 "Position" element could be added in future if needed.  -->
387            <element name="Index">
388              <data type="nonNegativeInteger" />
389            </element>
390          </optional>
391          <!-- In general, template parameters with whitespace discussion
392               should not be emitted.  Schema might be more strict here. -->
393          <element name="Discussion">
394            <ref name="TextBlockContent" />
395          </element>
396        </element>
397      </oneOrMore>
398    </element>
399  </define>
400
401  <define name="Parameters">
402    <element name="Parameters">
403      <!-- Parameter elements should be sorted according to index. -->
404      <oneOrMore>
405        <element name="Parameter">
406          <element name="Name">
407            <!-- Non-empty text content. -->
408            <data type="string">
409              <param name="pattern">.*\S.*</param>
410            </data>
411          </element>
412          <optional>
413            <element name="Index">
414              <data type="nonNegativeInteger" />
415            </element>
416          </optional>
417          <element name="Direction">
418            <attribute name="isExplicit">
419              <data type="boolean" />
420            </attribute>
421            <choice>
422              <value>in</value>
423              <value>out</value>
424              <value>in,out</value>
425            </choice>
426          </element>
427          <!-- In general, template parameters with whitespace discussion
428               should not be emitted, unless direction is explicitly specified.
429               Schema might be more strict here. -->
430          <element name="Discussion">
431            <ref name="TextBlockContent" />
432          </element>
433        </element>
434      </oneOrMore>
435    </element>
436  </define>
437
438  <define name="Availability">
439    <element name="Availability">
440      <attribute name="distribution">
441        <data type="string" />
442      </attribute>
443      <optional>
444        <element name="IntroducedInVersion">
445          <data type="string">
446            <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
447          </data>
448        </element>
449      </optional>
450      <optional>
451        <element name="DeprecatedInVersion">
452          <data type="string">
453            <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
454          </data>
455        </element>
456      </optional>
457      <optional>
458        <element name="RemovedAfterVersion">
459          <data type="string">
460            <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
461          </data>
462        </element>
463      </optional>
464      <optional>
465        <element name="DeprecationSummary">
466          <data type="string" />
467        </element>
468      </optional>
469      <optional>
470        <ref name="Unavailable" />
471      </optional>
472    </element>
473  </define>
474
475  <define name="Deprecated">
476    <element name="Deprecated">
477      <optional>
478        <data type="string" />
479      </optional>
480    </element>
481  </define>
482
483  <define name="Unavailable">
484    <element name="Unavailable">
485      <optional>
486        <data type="string" />
487      </optional>
488    </element>
489  </define>
490
491  <define name="ResultDiscussion">
492    <element name="ResultDiscussion">
493      <zeroOrMore>
494        <ref name="TextBlockContent" />
495      </zeroOrMore>
496    </element>
497  </define>
498
499  <define name="TextBlockContent">
500    <choice>
501      <element name="Para">
502        <optional>
503          <attribute name="kind">
504            <choice>
505              <value>attention</value>
506              <value>author</value>
507              <value>authors</value>
508              <value>bug</value>
509              <value>copyright</value>
510              <value>date</value>
511              <value>invariant</value>
512              <value>note</value>
513              <value>post</value>
514              <value>pre</value>
515              <value>remark</value>
516              <value>remarks</value>
517              <value>sa</value>
518              <value>see</value>
519              <value>since</value>
520              <value>todo</value>
521              <value>version</value>
522              <value>warning</value>
523            </choice>
524          </attribute>
525        </optional>
526        <zeroOrMore>
527          <ref name="TextInlineContent" />
528        </zeroOrMore>
529      </element>
530      <element name="Verbatim">
531        <attribute name="xml:space">
532          <value>preserve</value>
533        </attribute>
534        <attribute name="kind">
535          <!-- TODO: add all Doxygen verbatim kinds -->
536          <choice>
537            <value>code</value>
538            <value>verbatim</value>
539          </choice>
540        </attribute>
541        <text />
542      </element>
543    </choice>
544  </define>
545
546  <define name="TextInlineContent">
547    <choice>
548      <text />
549      <element name="bold">
550        <!-- Non-empty text content. -->
551        <data type="string">
552          <param name="pattern">.*\S.*</param>
553        </data>
554      </element>
555      <element name="monospaced">
556        <!-- Non-empty text content. -->
557        <data type="string">
558          <param name="pattern">.*\S.*</param>
559        </data>
560      </element>
561      <element name="emphasized">
562        <!-- Non-empty text content. -->
563        <data type="string">
564          <param name="pattern">.*\S.*</param>
565        </data>
566      </element>
567      <element name="rawHTML">
568        <!-- Non-empty text content. -->
569        <data type="string">
570          <param name="pattern">.*\S.*</param>
571        </data>
572      </element>
573    </choice>
574  </define>
575
576</grammar>
577
578