Home | History | Annotate | Download | only in xml
      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             <choice>
    414               <element name="Index">
    415                 <data type="nonNegativeInteger" />
    416               </element>
    417               <element name="IsVarArg">
    418                 <empty />
    419               </element>
    420             </choice>
    421           </optional>
    422           <element name="Direction">
    423             <attribute name="isExplicit">
    424               <data type="boolean" />
    425             </attribute>
    426             <choice>
    427               <value>in</value>
    428               <value>out</value>
    429               <value>in,out</value>
    430             </choice>
    431           </element>
    432           <!-- In general, template parameters with whitespace discussion
    433                should not be emitted, unless direction is explicitly specified.
    434                Schema might be more strict here. -->
    435           <element name="Discussion">
    436             <ref name="TextBlockContent" />
    437           </element>
    438         </element>
    439       </oneOrMore>
    440     </element>
    441   </define>
    442 
    443   <define name="Availability">
    444     <element name="Availability">
    445       <attribute name="distribution">
    446         <data type="string" />
    447       </attribute>
    448       <optional>
    449         <element name="IntroducedInVersion">
    450           <data type="string">
    451             <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
    452           </data>
    453         </element>
    454       </optional>
    455       <optional>
    456         <element name="DeprecatedInVersion">
    457           <data type="string">
    458             <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
    459           </data>
    460         </element>
    461       </optional>
    462       <optional>
    463         <element name="RemovedAfterVersion">
    464           <data type="string">
    465             <param name="pattern">\d+|\d+\.\d+|\d+\.\d+.\d+</param>
    466           </data>
    467         </element>
    468       </optional>
    469       <optional>
    470         <element name="DeprecationSummary">
    471           <data type="string" />
    472         </element>
    473       </optional>
    474       <optional>
    475         <ref name="Unavailable" />
    476       </optional>
    477     </element>
    478   </define>
    479 
    480   <define name="Deprecated">
    481     <element name="Deprecated">
    482       <optional>
    483         <data type="string" />
    484       </optional>
    485     </element>
    486   </define>
    487 
    488   <define name="Unavailable">
    489     <element name="Unavailable">
    490       <optional>
    491         <data type="string" />
    492       </optional>
    493     </element>
    494   </define>
    495 
    496   <define name="ResultDiscussion">
    497     <element name="ResultDiscussion">
    498       <zeroOrMore>
    499         <ref name="TextBlockContent" />
    500       </zeroOrMore>
    501     </element>
    502   </define>
    503 
    504   <define name="TextBlockContent">
    505     <choice>
    506       <element name="Para">
    507         <optional>
    508           <attribute name="kind">
    509             <choice>
    510               <value>attention</value>
    511               <value>author</value>
    512               <value>authors</value>
    513               <value>bug</value>
    514               <value>copyright</value>
    515               <value>date</value>
    516               <value>invariant</value>
    517               <value>note</value>
    518               <value>post</value>
    519               <value>pre</value>
    520               <value>remark</value>
    521               <value>remarks</value>
    522               <value>sa</value>
    523               <value>see</value>
    524               <value>since</value>
    525               <value>todo</value>
    526               <value>version</value>
    527               <value>warning</value>
    528             </choice>
    529           </attribute>
    530         </optional>
    531         <zeroOrMore>
    532           <ref name="TextInlineContent" />
    533         </zeroOrMore>
    534       </element>
    535       <element name="Verbatim">
    536         <attribute name="xml:space">
    537           <value>preserve</value>
    538         </attribute>
    539         <attribute name="kind">
    540           <!-- TODO: add all Doxygen verbatim kinds -->
    541           <choice>
    542             <value>code</value>
    543             <value>verbatim</value>
    544           </choice>
    545         </attribute>
    546         <text />
    547       </element>
    548     </choice>
    549   </define>
    550 
    551   <define name="TextInlineContent">
    552     <choice>
    553       <text />
    554       <element name="bold">
    555         <!-- Non-empty text content. -->
    556         <data type="string">
    557           <param name="pattern">.*\S.*</param>
    558         </data>
    559       </element>
    560       <element name="monospaced">
    561         <!-- Non-empty text content. -->
    562         <data type="string">
    563           <param name="pattern">.*\S.*</param>
    564         </data>
    565       </element>
    566       <element name="emphasized">
    567         <!-- Non-empty text content. -->
    568         <data type="string">
    569           <param name="pattern">.*\S.*</param>
    570         </data>
    571       </element>
    572       <element name="rawHTML">
    573         <!-- Non-empty text content. -->
    574         <data type="string">
    575           <param name="pattern">.*\S.*</param>
    576         </data>
    577       </element>
    578     </choice>
    579   </define>
    580 
    581 </grammar>
    582 
    583