non_terminals.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Nonterminals</title>
  5. <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Spirit X3 3.0.4">
  8. <link rel="up" href="../quick_reference.html" title="Quick Reference">
  9. <link rel="prev" href="compound_attribute_rules.html" title="Compound Attribute Rules">
  10. <link rel="next" href="semantic_actions.html" title="Parser Semantic Actions">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="compound_attribute_rules.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="semantic_actions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="spirit_x3.quick_reference.non_terminals"></a><a class="link" href="non_terminals.html" title="Nonterminals">Nonterminals</a>
  28. </h3></div></div></div>
  29. <div class="variablelist">
  30. <p class="title"><b>Notation</b></p>
  31. <dl class="variablelist">
  32. <dt><span class="term"><code class="computeroutput"><span class="identifier">Attr</span></code></span></dt>
  33. <dd><p>
  34. Synthesized attribute. The rule return type.
  35. </p></dd>
  36. <dt><span class="term"><code class="computeroutput"><span class="identifier">ID</span></code></span></dt>
  37. <dd><p>
  38. The rule ID
  39. </p></dd>
  40. <dt><span class="term"><code class="computeroutput"><span class="identifier">r</span><span class="special">,</span>
  41. <span class="identifier">r2</span></code></span></dt>
  42. <dd><p>
  43. Rules
  44. </p></dd>
  45. <dt><span class="term"><code class="computeroutput"><span class="identifier">r_def</span><span class="special">,</span>
  46. <span class="identifier">r2_def</span></code></span></dt>
  47. <dd><p>
  48. A rule definition. By convention a rule named <code class="computeroutput"><span class="identifier">r</span></code>
  49. should have corresponding rule definition named <code class="computeroutput"><span class="identifier">r_def</span></code>
  50. </p></dd>
  51. <dt><span class="term"><code class="computeroutput"><span class="identifier">p</span></code></span></dt>
  52. <dd><p>
  53. A parser expression
  54. </p></dd>
  55. </dl>
  56. </div>
  57. <div class="informaltable"><table class="table">
  58. <colgroup>
  59. <col>
  60. <col>
  61. </colgroup>
  62. <thead><tr>
  63. <th>
  64. <p>
  65. Expression
  66. </p>
  67. </th>
  68. <th>
  69. <p>
  70. Description
  71. </p>
  72. </th>
  73. </tr></thead>
  74. <tbody>
  75. <tr>
  76. <td>
  77. <p>
  78. <code class="computeroutput"><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ID</span><span class="special">,</span>
  79. <span class="identifier">Attr</span><span class="special">&gt;</span>
  80. <span class="keyword">const</span> <span class="identifier">r</span>
  81. <span class="special">=</span> <span class="identifier">name</span><span class="special">;</span></code>
  82. </p>
  83. </td>
  84. <td>
  85. <p>
  86. Rule declaration. <code class="computeroutput"><span class="identifier">ID</span></code>
  87. is required. <code class="computeroutput"><span class="identifier">Attr</span></code>
  88. is optional and defaults to <code class="computeroutput"><span class="identifier">unused_type</span></code>.
  89. <code class="computeroutput"><span class="identifier">name</span></code> is an optional
  90. string that gives the rule its name, useful for debugging and error
  91. handling.
  92. </p>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td>
  97. <p>
  98. <code class="computeroutput"><span class="identifier">r</span><span class="special">.</span><span class="identifier">name</span><span class="special">()</span></code>
  99. </p>
  100. </td>
  101. <td>
  102. <p>
  103. Getting the name of a rule
  104. </p>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td>
  109. <p>
  110. <code class="computeroutput"><span class="keyword">auto</span> <span class="keyword">const</span>
  111. <span class="identifier">r_def</span> <span class="special">=</span>
  112. <span class="identifier">p</span><span class="special">;</span></code>
  113. </p>
  114. </td>
  115. <td>
  116. <p>
  117. Rule definition
  118. </p>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td>
  123. <p>
  124. <code class="computeroutput"><span class="identifier">BOOST_SPIRIT_DEFINE</span><span class="special">(</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">r2</span><span class="special">,</span> <span class="special">...)</span></code>
  125. </p>
  126. </td>
  127. <td>
  128. <p>
  129. Links one or more rules (<code class="computeroutput"><span class="identifier">r</span><span class="special">,</span> <span class="identifier">r2</span><span class="special">,</span> <span class="special">...</span></code>)
  130. with their definitions (<code class="computeroutput"><span class="identifier">r_def</span><span class="special">,</span> <span class="identifier">r2_def</span><span class="special">,</span> <span class="special">...</span></code>)
  131. </p>
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table></div>
  136. </div>
  137. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  138. <td align="left"></td>
  139. <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2018 Joel de Guzman,
  140. Hartmut Kaiser<p>
  141. Distributed under the Boost Software License, Version 1.0. (See accompanying
  142. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  143. </p>
  144. </div></td>
  145. </tr></table>
  146. <hr>
  147. <div class="spirit-nav">
  148. <a accesskey="p" href="compound_attribute_rules.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="semantic_actions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  149. </div>
  150. </body>
  151. </html>