tokenizerfunction.htm 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Language" content="en-us">
  5. <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
  6. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  7. <meta name="ProgId" content="FrontPage.Editor.Document">
  8. <title>TokenizerFunction Concept</title>
  9. </head>
  10. <body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink=
  11. "#FF0000">
  12. <p><img src="../../../boost.png" alt="C++ Boost" width="277" height="86"></p>
  13. <h1 align="center">TokenizerFunction Concept</h1>
  14. <p>A TokenizerFunction is a functor whose purpose is to parse a given
  15. sequence until exactly 1 token has been found or the end is reached. It
  16. then updates the token, and informs the caller of the location in the
  17. sequence of the next element immediately after the last element of the
  18. sequence that was parsed for the current token.</p>
  19. <h2>Refinement of</h2>
  20. <p>Assignable, CopyConstructable</p>
  21. <h2>Notation</h2>
  22. <table border="1" summary="">
  23. <tr>
  24. <td valign="top"><tt>X</tt></td>
  25. <td valign="top">A type that is a model of TokenizerFunction</td>
  26. </tr>
  27. <tr>
  28. <td valign="top"><tt>func</tt></td>
  29. <td valign="top">Object of type <tt>X</tt></td>
  30. </tr>
  31. <tr>
  32. <td valign="top"><tt>tok</tt></td>
  33. <td valign="top">Object of Token</td>
  34. </tr>
  35. <tr>
  36. <td>next</td>
  37. <td>iterator that points to the first unparsed element of the sequence
  38. being parsed</td>
  39. </tr>
  40. <tr>
  41. <td>end</td>
  42. <td>iterator that points to the past the end of the sequence being
  43. parsed</td>
  44. </tr>
  45. </table>
  46. <h2>Definitions</h2>
  47. <p>A token is the result of parsing a sequence.</p>
  48. <h2>Valid expressions</h2>
  49. <p>In addition to the expression in Assignable and CopyConstructable the
  50. following expressions are valid</p>
  51. <table border="1" summary="">
  52. <tr>
  53. <th>Name</th>
  54. <th>Expression</th>
  55. <th>Return type</th>
  56. </tr>
  57. <tr>
  58. <td valign="top">Functor</td>
  59. <td valign="top"><tt>func(next, end, tok)</tt></td>
  60. <td valign="top"><tt>bool</tt></td>
  61. </tr>
  62. <tr>
  63. <td valign="top">reset</td>
  64. <td valign="top"><tt>reset()</tt></td>
  65. <td valign="top"><tt>void</tt></td>
  66. </tr>
  67. </table>
  68. <h2>Expression semantics</h2>
  69. <p>In addition to the expression semantics in Assignable and
  70. CopyConstructable, TokenizerFunction has the following expression
  71. semantcs</p>
  72. <table border="1" summary="">
  73. <tr>
  74. <th>Name</th>
  75. <th>Expression</th>
  76. <th>Precondition</th>
  77. <th>Semantics</th>
  78. <th>Postcondition</th>
  79. </tr>
  80. <tr>
  81. <td>operator()</td>
  82. <td><tt>func(next, end, tok)</tt></td>
  83. <td><tt>next</tt> and <tt>end</tt> are valid iterators to the same
  84. sequence. next is a reference the function is free to modify. tok is
  85. constructed.</td>
  86. <td>The return value indicates whether a new token was found in the
  87. sequence [next,end)</td>
  88. <td>If the return value is true, the new token is assigned to tok. next
  89. is always updated to the position where parsing should start on the
  90. subsequent call.</td>
  91. </tr>
  92. <tr>
  93. <td>reset</td>
  94. <td><tt>reset()</tt></td>
  95. <td><tt>None</tt></td>
  96. <td>Clears out all state variables that are used by the object in
  97. parsing the current sequence.</td>
  98. <td>A new sequence to parse can be given.</td>
  99. </tr>
  100. </table>
  101. <h2>Complexity guarantees</h2>
  102. <p>No guarantees. Models of TokenizerFunction are free to define their own
  103. complexity</p>
  104. <h2>Models</h2>
  105. <p><a href="escaped_list_separator.htm">escaped_list_separator</a></p>
  106. <p><a href="offset_separator.htm">offset_separator</a></p>
  107. <p><a href=
  108. "char_delimiters_separator.htm">char_delimiters_separator</a></p>
  109. <p>&nbsp;</p>
  110. <hr>
  111. <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
  112. "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
  113. height="31" width="88"></a></p>
  114. <p>Revised
  115. <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->25
  116. December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38518" --></p>
  117. <p><i>Copyright &copy; 2001 John R. Bandela</i></p>
  118. <p><i>Distributed under the Boost Software License, Version 1.0. (See
  119. accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  120. copy at <a href=
  121. "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
  122. </body>
  123. </html>