ebnf.rng 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of DocBook V5.0
  4. Copyright 1992-2008 HaL Computer Systems, Inc.,
  5. O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software
  6. Corporation, Norman Walsh, Sun Microsystems, Inc., and the
  7. Organization for the Advancement of Structured Information
  8. Standards (OASIS).
  9. Release: $Id: ebnf.rnc 8931 2010-10-20 13:29:20Z nwalsh $
  10. Permission to use, copy, modify and distribute the DocBook schema
  11. and its accompanying documentation for any purpose and without fee
  12. is hereby granted in perpetuity, provided that the above copyright
  13. notice and this paragraph appear in all copies. The copyright
  14. holders make no representation about the suitability of the schema
  15. for any purpose. It is provided "as is" without expressed or implied
  16. warranty.
  17. If you modify the DocBook schema in any way, label your schema as a
  18. variant of DocBook. See the reference documentation
  19. (http://docbook.org/tdg5/en/html/ch05.html#s-notdocbook)
  20. for more information.
  21. Please direct all questions, bug reports, or suggestions for changes
  22. to the docbook@lists.oasis-open.org mailing list. For more
  23. information, see http://www.oasis-open.org/docbook/.
  24. ======================================================================
  25. -->
  26. <grammar ns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  27. <start combine="choice">
  28. <choice>
  29. <ref name="db.productionset"/>
  30. <ref name="db.constraintdef"/>
  31. </choice>
  32. </start>
  33. <define name="db.technical.inlines" combine="choice">
  34. <ref name="db.nonterminal"/>
  35. </define>
  36. <define name="db.technical.blocks" combine="choice">
  37. <choice>
  38. <ref name="db.productionset"/>
  39. <ref name="db.constraintdef"/>
  40. </choice>
  41. </define>
  42. <!-- ====================================================================== -->
  43. <div>
  44. <db:refname>productionset</db:refname>
  45. <db:refpurpose>A set of EBNF productions</db:refpurpose>
  46. <define name="db.productionset.role.attribute">
  47. <attribute name="role"/>
  48. </define>
  49. <define name="db.productionset.attlist">
  50. <interleave>
  51. <optional>
  52. <ref name="db.productionset.role.attribute"/>
  53. </optional>
  54. <ref name="db.common.attributes"/>
  55. <ref name="db.common.linking.attributes"/>
  56. </interleave>
  57. </define>
  58. <define name="db.productionset.info">
  59. <ref name="db._info.title.only"/>
  60. </define>
  61. <define name="db.productionset">
  62. <element name="productionset">
  63. <ref name="db.productionset.attlist"/>
  64. <ref name="db.productionset.info"/>
  65. <oneOrMore>
  66. <choice>
  67. <ref name="db.production"/>
  68. <ref name="db.productionrecap"/>
  69. </choice>
  70. </oneOrMore>
  71. </element>
  72. </define>
  73. </div>
  74. <!-- ====================================================================== -->
  75. <div>
  76. <db:refname>production</db:refname>
  77. <db:refpurpose>A production in a set of EBNF productions</db:refpurpose>
  78. <define name="db.production.role.attribute">
  79. <attribute name="role"/>
  80. </define>
  81. <define name="db.production.attlist">
  82. <interleave>
  83. <optional>
  84. <ref name="db.production.role.attribute"/>
  85. </optional>
  86. <ref name="db.common.idreq.attributes"/>
  87. <ref name="db.common.linking.attributes"/>
  88. </interleave>
  89. </define>
  90. <define name="db.production">
  91. <element name="production">
  92. <ref name="db.production.attlist"/>
  93. <ref name="db.lhs"/>
  94. <ref name="db.rhs"/>
  95. <zeroOrMore>
  96. <ref name="db.constraint"/>
  97. </zeroOrMore>
  98. </element>
  99. </define>
  100. </div>
  101. <!-- ====================================================================== -->
  102. <div>
  103. <db:refname>lhs</db:refname>
  104. <db:refpurpose>The left-hand side of an EBNF production</db:refpurpose>
  105. <define name="db.lhs.role.attribute">
  106. <attribute name="role"/>
  107. </define>
  108. <define name="db.lhs.attlist">
  109. <interleave>
  110. <optional>
  111. <ref name="db.lhs.role.attribute"/>
  112. </optional>
  113. <ref name="db.common.attributes"/>
  114. <ref name="db.common.linking.attributes"/>
  115. </interleave>
  116. </define>
  117. <define name="db.lhs">
  118. <element name="lhs">
  119. <ref name="db.lhs.attlist"/>
  120. <text/>
  121. </element>
  122. </define>
  123. </div>
  124. <!-- ====================================================================== -->
  125. <div>
  126. <db:refname>rhs</db:refname>
  127. <db:refpurpose>The right-hand side of an EBNF production</db:refpurpose>
  128. <define name="db.rhs.role.attribute">
  129. <attribute name="role"/>
  130. </define>
  131. <define name="db.rhs.attlist">
  132. <interleave>
  133. <optional>
  134. <ref name="db.rhs.role.attribute"/>
  135. </optional>
  136. <ref name="db.common.attributes"/>
  137. <ref name="db.common.linking.attributes"/>
  138. </interleave>
  139. </define>
  140. <define name="db.rhs">
  141. <element name="rhs">
  142. <ref name="db.rhs.attlist"/>
  143. <zeroOrMore>
  144. <choice>
  145. <text/>
  146. <ref name="db.nonterminal"/>
  147. <ref name="db.lineannotation"/>
  148. <ref name="db.sbr"/>
  149. </choice>
  150. </zeroOrMore>
  151. </element>
  152. </define>
  153. </div>
  154. <!-- ====================================================================== -->
  155. <div>
  156. <db:refname>nonterminal</db:refname>
  157. <db:refpurpose>A non-terminal in an EBNF production</db:refpurpose>
  158. <define name="db.nonterminal.role.attribute">
  159. <attribute name="role"/>
  160. </define>
  161. <define name="db.nonterminal.def.attribute">
  162. <attribute name="def">
  163. <db:refpurpose>Specifies a URI that points to a <db:tag>production</db:tag>
  164. where the <db:tag>nonterminal</db:tag>
  165. is defined</db:refpurpose>
  166. <data type="anyURI"/>
  167. </attribute>
  168. </define>
  169. <define name="db.nonterminal.attlist">
  170. <interleave>
  171. <optional>
  172. <ref name="db.nonterminal.role.attribute"/>
  173. </optional>
  174. <ref name="db.common.attributes"/>
  175. <ref name="db.common.linking.attributes"/>
  176. <ref name="db.nonterminal.def.attribute"/>
  177. </interleave>
  178. </define>
  179. <define name="db.nonterminal">
  180. <element name="nonterminal">
  181. <ref name="db.nonterminal.attlist"/>
  182. <text/>
  183. </element>
  184. </define>
  185. </div>
  186. <!-- ====================================================================== -->
  187. <div>
  188. <db:refname>constraint</db:refname>
  189. <db:refpurpose>A constraint in an EBNF production</db:refpurpose>
  190. <define name="db.constraint.role.attribute">
  191. <attribute name="role"/>
  192. </define>
  193. <define name="db.constraint.attlist">
  194. <interleave>
  195. <optional>
  196. <ref name="db.constraint.role.attribute"/>
  197. </optional>
  198. <ref name="db.common.attributes"/>
  199. <ref name="db.common.req.linking.attributes"/>
  200. </interleave>
  201. </define>
  202. <define name="db.constraint">
  203. <element name="constraint">
  204. <ref name="db.constraint.attlist"/>
  205. <empty/>
  206. </element>
  207. </define>
  208. </div>
  209. <!-- ====================================================================== -->
  210. <div>
  211. <db:refname>productionrecap</db:refname>
  212. <db:refpurpose>A cross-reference to an EBNF production</db:refpurpose>
  213. <define name="db.productionrecap.role.attribute">
  214. <attribute name="role"/>
  215. </define>
  216. <define name="db.productionrecap.attlist">
  217. <interleave>
  218. <optional>
  219. <ref name="db.productionrecap.role.attribute"/>
  220. </optional>
  221. <ref name="db.common.attributes"/>
  222. <ref name="db.common.req.linking.attributes"/>
  223. </interleave>
  224. </define>
  225. <define name="db.productionrecap">
  226. <element name="productionrecap">
  227. <ref name="db.productionrecap.attlist"/>
  228. <empty/>
  229. </element>
  230. </define>
  231. </div>
  232. <!-- ====================================================================== -->
  233. <div>
  234. <db:refname>constraintdef</db:refname>
  235. <db:refpurpose>The definition of a constraint in an EBNF production</db:refpurpose>
  236. <define name="db.constraintdef.role.attribute">
  237. <attribute name="role"/>
  238. </define>
  239. <define name="db.constraintdef.attlist">
  240. <interleave>
  241. <optional>
  242. <ref name="db.constraintdef.role.attribute"/>
  243. </optional>
  244. <ref name="db.common.attributes"/>
  245. <ref name="db.common.linking.attributes"/>
  246. </interleave>
  247. </define>
  248. <define name="db.constraintdef.info">
  249. <ref name="db._info.title.only"/>
  250. </define>
  251. <define name="db.constraintdef">
  252. <element name="constraintdef">
  253. <ref name="db.constraintdef.attlist"/>
  254. <ref name="db.constraintdef.info"/>
  255. <oneOrMore>
  256. <ref name="db.all.blocks"/>
  257. </oneOrMore>
  258. </element>
  259. </define>
  260. </div>
  261. </grammar>