Dmitri Gribenko | 740c0fb | 2012-08-07 17:54:38 +0000 | [diff] [blame^] | 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 | </choice> |
| 17 | </start> |
| 18 | |
| 19 | <define name="Other"> |
| 20 | <element name="Other"> |
| 21 | <ref name="attrSourceLocation" /> |
| 22 | <ref name="Name" /> |
| 23 | <optional> |
| 24 | <ref name="USR" /> |
| 25 | </optional> |
| 26 | <optional> |
| 27 | <ref name="Abstract" /> |
| 28 | </optional> |
| 29 | <optional> |
| 30 | <ref name="TemplateParameters" /> |
| 31 | </optional> |
| 32 | <optional> |
| 33 | <ref name="Parameters" /> |
| 34 | </optional> |
| 35 | <optional> |
| 36 | <ref name="ResultDiscussion" /> |
| 37 | </optional> |
| 38 | <optional> |
| 39 | <ref name="Discussion" /> |
| 40 | </optional> |
| 41 | </element> |
| 42 | </define> |
| 43 | |
| 44 | <define name="Function"> |
| 45 | <element name="Function"> |
| 46 | <optional> |
| 47 | <attribute name="templateKind"> |
| 48 | <choice> |
| 49 | <value>template</value> |
| 50 | <value>specialization</value> |
| 51 | </choice> |
| 52 | </attribute> |
| 53 | </optional> |
| 54 | <ref name="attrSourceLocation" /> |
| 55 | |
| 56 | <optional> |
| 57 | <attribute name="isInstanceMethod"> |
| 58 | <data type="boolean" /> |
| 59 | </attribute> |
| 60 | </optional> |
| 61 | <optional> |
| 62 | <attribute name="isClassMethod"> |
| 63 | <data type="boolean" /> |
| 64 | </attribute> |
| 65 | </optional> |
| 66 | |
| 67 | <ref name="Name" /> |
| 68 | <optional> |
| 69 | <ref name="USR" /> |
| 70 | </optional> |
| 71 | <!-- TODO: Add exception specification. --> |
| 72 | <optional> |
| 73 | <ref name="Abstract" /> |
| 74 | </optional> |
| 75 | <optional> |
| 76 | <ref name="TemplateParameters" /> |
| 77 | </optional> |
| 78 | <optional> |
| 79 | <ref name="Parameters" /> |
| 80 | </optional> |
| 81 | <optional> |
| 82 | <ref name="ResultDiscussion" /> |
| 83 | </optional> |
| 84 | <optional> |
| 85 | <ref name="Discussion" /> |
| 86 | </optional> |
| 87 | </element> |
| 88 | </define> |
| 89 | |
| 90 | <define name="Class"> |
| 91 | <element name="Class"> |
| 92 | <optional> |
| 93 | <attribute name="templateKind"> |
| 94 | <choice> |
| 95 | <value>template</value> |
| 96 | <value>specialization</value> |
| 97 | <value>partialSpecialization</value> |
| 98 | </choice> |
| 99 | </attribute> |
| 100 | </optional> |
| 101 | <ref name="attrSourceLocation" /> |
| 102 | |
| 103 | <ref name="Name" /> |
| 104 | <optional> |
| 105 | <ref name="USR" /> |
| 106 | </optional> |
| 107 | <optional> |
| 108 | <ref name="Abstract" /> |
| 109 | </optional> |
| 110 | <optional> |
| 111 | <ref name="TemplateParameters" /> |
| 112 | </optional> |
| 113 | |
| 114 | <!-- Parameters and results don't make sense for classes, but the user |
| 115 | can specify \param or \returns in a comment anyway. --> |
| 116 | <optional> |
| 117 | <ref name="Parameters" /> |
| 118 | </optional> |
| 119 | <optional> |
| 120 | <ref name="ResultDiscussion" /> |
| 121 | </optional> |
| 122 | |
| 123 | <optional> |
| 124 | <ref name="Discussion" /> |
| 125 | </optional> |
| 126 | </element> |
| 127 | </define> |
| 128 | |
| 129 | <define name="Variable"> |
| 130 | <element name="Variable"> |
| 131 | <ref name="attrSourceLocation" /> |
| 132 | <ref name="Name" /> |
| 133 | <optional> |
| 134 | <ref name="USR" /> |
| 135 | </optional> |
| 136 | <optional> |
| 137 | <ref name="Abstract" /> |
| 138 | </optional> |
| 139 | |
| 140 | <!-- Template parameters, parameters and results don't make sense for |
| 141 | variables, but the user can specify \tparam \param or \returns |
| 142 | in a comment anyway. --> |
| 143 | <optional> |
| 144 | <ref name="TemplateParameters" /> |
| 145 | </optional> |
| 146 | <optional> |
| 147 | <ref name="Parameters" /> |
| 148 | </optional> |
| 149 | <optional> |
| 150 | <ref name="ResultDiscussion" /> |
| 151 | </optional> |
| 152 | |
| 153 | <optional> |
| 154 | <ref name="Discussion" /> |
| 155 | </optional> |
| 156 | </element> |
| 157 | </define> |
| 158 | |
| 159 | <define name="Namespace"> |
| 160 | <element name="Namespace"> |
| 161 | <ref name="attrSourceLocation" /> |
| 162 | <ref name="Name" /> |
| 163 | <optional> |
| 164 | <ref name="USR" /> |
| 165 | </optional> |
| 166 | <optional> |
| 167 | <ref name="Abstract" /> |
| 168 | </optional> |
| 169 | |
| 170 | <!-- Template parameters, parameters and results don't make sense for |
| 171 | namespaces, but the user can specify \tparam, \param or \returns |
| 172 | in a comment anyway. --> |
| 173 | <optional> |
| 174 | <ref name="TemplateParameters" /> |
| 175 | </optional> |
| 176 | <optional> |
| 177 | <ref name="Parameters" /> |
| 178 | </optional> |
| 179 | <optional> |
| 180 | <ref name="ResultDiscussion" /> |
| 181 | </optional> |
| 182 | |
| 183 | <optional> |
| 184 | <ref name="Discussion" /> |
| 185 | </optional> |
| 186 | </element> |
| 187 | </define> |
| 188 | |
| 189 | <define name="Typedef"> |
| 190 | <element name="Typedef"> |
| 191 | <ref name="attrSourceLocation" /> |
| 192 | <ref name="Name" /> |
| 193 | <optional> |
| 194 | <ref name="USR" /> |
| 195 | </optional> |
| 196 | <optional> |
| 197 | <ref name="Abstract" /> |
| 198 | </optional> |
| 199 | |
| 200 | <optional> |
| 201 | <ref name="TemplateParameters" /> |
| 202 | </optional> |
| 203 | |
| 204 | <!-- Parameters and results might make sense for typedefs if the type is |
| 205 | a function pointer type. --> |
| 206 | <optional> |
| 207 | <ref name="Parameters" /> |
| 208 | </optional> |
| 209 | <optional> |
| 210 | <ref name="ResultDiscussion" /> |
| 211 | </optional> |
| 212 | |
| 213 | <optional> |
| 214 | <ref name="Discussion" /> |
| 215 | </optional> |
| 216 | </element> |
| 217 | </define> |
| 218 | |
| 219 | <define name="attrSourceLocation"> |
| 220 | <optional> |
| 221 | <attribute name="file"> |
| 222 | <!-- Non-empty text content. --> |
| 223 | <data type="string"> |
| 224 | <param name="pattern">.*\S.*</param> |
| 225 | </data> |
| 226 | </attribute> |
| 227 | </optional> |
| 228 | <optional> |
| 229 | <attribute name="line"> |
| 230 | <data type="positiveInteger" /> |
| 231 | </attribute> |
| 232 | <attribute name="column"> |
| 233 | <data type="positiveInteger" /> |
| 234 | </attribute> |
| 235 | </optional> |
| 236 | </define> |
| 237 | |
| 238 | <define name="Name"> |
| 239 | <element name="Name"> |
| 240 | <!-- Non-empty text content. --> |
| 241 | <data type="string"> |
| 242 | <param name="pattern">.*\S.*</param> |
| 243 | </data> |
| 244 | </element> |
| 245 | </define> |
| 246 | |
| 247 | <define name="USR"> |
| 248 | <element name="USR"> |
| 249 | <!-- Non-empty text content. --> |
| 250 | <data type="string"> |
| 251 | <param name="pattern">.*\S.*</param> |
| 252 | </data> |
| 253 | </element> |
| 254 | </define> |
| 255 | |
| 256 | <define name="Abstract"> |
| 257 | <element name="Abstract"> |
| 258 | <zeroOrMore> |
| 259 | <ref name="TextBlockContent" /> |
| 260 | </zeroOrMore> |
| 261 | </element> |
| 262 | </define> |
| 263 | |
| 264 | <define name="Discussion"> |
| 265 | <element name="Discussion"> |
| 266 | <oneOrMore> |
| 267 | <ref name="TextBlockContent" /> |
| 268 | </oneOrMore> |
| 269 | </element> |
| 270 | </define> |
| 271 | |
| 272 | <define name="TemplateParameters"> |
| 273 | <element name="TemplateParameters"> |
| 274 | <!-- Parameter elements should be sorted according to position. --> |
| 275 | <oneOrMore> |
| 276 | <element name="Parameter"> |
| 277 | <element name="Name"> |
| 278 | <!-- Non-empty text content. --> |
| 279 | <data type="string"> |
| 280 | <param name="pattern">.*\S.*</param> |
| 281 | </data> |
| 282 | </element> |
| 283 | <optional> |
| 284 | <!-- This is index at depth 0. libclang API can return more |
| 285 | information about position, but we expose only essential |
| 286 | information here, since "Parameter" elements are already |
| 287 | sorted. |
| 288 | |
| 289 | "Position" element could be added in future if needed. --> |
| 290 | <element name="Index"> |
| 291 | <data type="nonNegativeInteger" /> |
| 292 | </element> |
| 293 | </optional> |
| 294 | <!-- In general, template parameters with whitespace discussion |
| 295 | should not be emitted. Schema might be more strict here. --> |
| 296 | <element name="Discussion"> |
| 297 | <ref name="TextBlockContent" /> |
| 298 | </element> |
| 299 | </element> |
| 300 | </oneOrMore> |
| 301 | </element> |
| 302 | </define> |
| 303 | |
| 304 | <define name="Parameters"> |
| 305 | <element name="Parameters"> |
| 306 | <!-- Parameter elements should be sorted according to index. --> |
| 307 | <oneOrMore> |
| 308 | <element name="Parameter"> |
| 309 | <element name="Name"> |
| 310 | <!-- Non-empty text content. --> |
| 311 | <data type="string"> |
| 312 | <param name="pattern">.*\S.*</param> |
| 313 | </data> |
| 314 | </element> |
| 315 | <optional> |
| 316 | <element name="Index"> |
| 317 | <data type="nonNegativeInteger" /> |
| 318 | </element> |
| 319 | </optional> |
| 320 | <element name="Direction"> |
| 321 | <attribute name="isExplicit"> |
| 322 | <data type="boolean" /> |
| 323 | </attribute> |
| 324 | <choice> |
| 325 | <value>in</value> |
| 326 | <value>out</value> |
| 327 | <value>in,out</value> |
| 328 | </choice> |
| 329 | </element> |
| 330 | <!-- In general, template parameters with whitespace discussion |
| 331 | should not be emitted, unless direction is explicitly specified. |
| 332 | Schema might be more strict here. --> |
| 333 | <element name="Discussion"> |
| 334 | <ref name="TextBlockContent" /> |
| 335 | </element> |
| 336 | </element> |
| 337 | </oneOrMore> |
| 338 | </element> |
| 339 | </define> |
| 340 | |
| 341 | <define name="ResultDiscussion"> |
| 342 | <element name="ResultDiscussion"> |
| 343 | <zeroOrMore> |
| 344 | <ref name="TextBlockContent" /> |
| 345 | </zeroOrMore> |
| 346 | </element> |
| 347 | </define> |
| 348 | |
| 349 | <define name="TextBlockContent"> |
| 350 | <choice> |
| 351 | <element name="Para"> |
| 352 | <zeroOrMore> |
| 353 | <ref name="TextInlineContent" /> |
| 354 | </zeroOrMore> |
| 355 | </element> |
| 356 | <element name="Verbatim"> |
| 357 | <attribute name="kind"> |
| 358 | <!-- TODO: add all Doxygen verbatim kinds --> |
| 359 | <choice> |
| 360 | <value>code</value> |
| 361 | <value>verbatim</value> |
| 362 | </choice> |
| 363 | </attribute> |
| 364 | <text /> |
| 365 | </element> |
| 366 | </choice> |
| 367 | </define> |
| 368 | |
| 369 | <define name="TextInlineContent"> |
| 370 | <choice> |
| 371 | <text /> |
| 372 | <element name="bold"> |
| 373 | <!-- Non-empty text content. --> |
| 374 | <data type="string"> |
| 375 | <param name="pattern">.*\S.*</param> |
| 376 | </data> |
| 377 | </element> |
| 378 | <element name="monospaced"> |
| 379 | <!-- Non-empty text content. --> |
| 380 | <data type="string"> |
| 381 | <param name="pattern">.*\S.*</param> |
| 382 | </data> |
| 383 | </element> |
| 384 | <element name="emphasized"> |
| 385 | <!-- Non-empty text content. --> |
| 386 | <data type="string"> |
| 387 | <param name="pattern">.*\S.*</param> |
| 388 | </data> |
| 389 | </element> |
| 390 | <element name="rawHTML"> |
| 391 | <!-- Non-empty text content. --> |
| 392 | <data type="string"> |
| 393 | <param name="pattern">.*\S.*</param> |
| 394 | </data> |
| 395 | </element> |
| 396 | </choice> |
| 397 | </define> |
| 398 | |
| 399 | </grammar> |
| 400 | |