[boost-doc-zh] r335 committed - Spirit库译文,由 青菜肉丝 提供,第二批

  • From: codesite-noreply@xxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Mon, 21 Sep 2009 07:38:27 +0000

Revision: 335
Author: alai04
Date: Sun Sep 20 23:13:57 2009
Log: Spirit库译文,由 青菜肉丝 提供,第二批
http://code.google.com/p/boost-doc-zh/source/detail?r=335

Modified:
 /trunk/libs/spirit/classic/doc/character_sets.html
 /trunk/libs/spirit/classic/doc/closures.html
 /trunk/libs/spirit/classic/doc/confix.html
 /trunk/libs/spirit/classic/doc/distinct.html
 /trunk/libs/spirit/classic/doc/dynamic_parsers.html
 /trunk/libs/spirit/classic/doc/escape_char_parser.html
 /trunk/libs/spirit/classic/doc/functional.html
 /trunk/libs/spirit/classic/doc/functor_parser.html
 /trunk/libs/spirit/classic/doc/list_parsers.html
 /trunk/libs/spirit/classic/doc/loops.html
 /trunk/libs/spirit/classic/doc/parametric_parsers.html
 /trunk/libs/spirit/classic/doc/phoenix.html
 /trunk/libs/spirit/classic/doc/predefined_actors.html
 /trunk/libs/spirit/classic/doc/refactoring.html
 /trunk/libs/spirit/classic/doc/regular_expression_parser.html
 /trunk/libs/spirit/classic/doc/scoped_lock.html
 /trunk/libs/spirit/classic/doc/select_parser.html
 /trunk/libs/spirit/classic/doc/stored_rule.html
 /trunk/libs/spirit/classic/doc/switch_parser.html
 /trunk/libs/spirit/classic/doc/the_lazy_parser.html
 /trunk/libs/spirit/classic/index.html

=======================================
--- /trunk/libs/spirit/classic/doc/character_sets.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/character_sets.html Sun Sep 20 23:13:57 2009
@@ -1,133 +1,126 @@
-<html>
-<head>
-<title>Character Sets</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Character Sets</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
     <td width="85%">
- <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Character Sets</b></font> + <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Character Sets 字符集</b></font>
     </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="loops.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="confix.html"><img src="theme/r_arr.gif" border="0"></a></td>
    </tr>
-</table>
+</tbody></table>
<p>The character set <tt>chset</tt> matches a set of characters over a finite range bounded by the limits of its template parameter <tt>CharT</tt>. This class is an optimization of a parser that acts on a set of single characters. The template class is parameterized by the character type <tt>CharT</tt> and can
-  work efficiently with 8, 16 and 32 and even 64 bit characters.</p>
-<pre><span class=identifier> </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>CharT </span><span class=special>= </span><span class=keyword>char</span><span class=special>&gt; - </span><span class=keyword>class </span><span class=identifier>chset</span><span class=special>;</span></pre> + work efficiently with 8, 16 and 32 and even 64 bit characters.<br>字符集 分析器<span style="font-family: Courier New;"> </span><tt>chset</tt><span style="font-family: Courier New;">&nbsp;匹配由它的模板参数 </span><tt>CharT</tt><span style="font-family: Courier New;"> 所限制的范围内 的有限字符子集。这个分析器针对单个字符的集合的分析而优化。这个模板类由字符类 </span><tt>CharT</tt> <span style="font-family: Courier New;">参数化并且可以 使用8、16和32甚至64位的字符。</span></p> +<pre><span class="identifier"> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">CharT </span><span class="special">= </span><span class="keyword">char</span><span class="special">&gt;<br> </span><span class="keyword">class </span><span class="identifier">chset</span><span class="special">;</span></pre> <p>The <tt>chset</tt> is constructed from literals (e.g. <tt>'x'</tt>), <tt>ch_p</tt> or <tt>chlit&lt;&gt;</tt>, <tt>range_p</tt> or <tt>range&lt;&gt;</tt>, <tt>anychar_p</tt> and <tt>nothing_p</tt> (see <a href="primitives.html">primitives</a>) or copy-constructed from another <tt>chset</tt>. The <tt>chset</tt> class uses a copy-on-write scheme
-  that enables instances to be passed along easily by value.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><img src="theme/lens.gif" width="15" height="16"> <b>Sparse
-      bit vectors</b><br>
+ that enables instances to be passed along easily by value.<br><tt>chset</tt> 构造自字符分析器 (如 <tt>'x'</tt>),<tt>ch_p</tt> 或 <tt>chlit&lt;&gt;</tt>, <tt>range_p</tt> 或 <tt>range&lt;&gt;</tt>, <tt>anychar_p</tt> 和 <tt>nothing_p</tt>(见<a href="primitives.html">元素 </a>)或者拷贝构造自其他 <tt>chset</tt>。<tt>chset</tt> 类使用"延迟拷贝"技 术,使其可以轻松传值使用。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><img src="theme/lens.gif" height="16" width="15"> <b>Sparse
+      bit vectors 稀疏的bit vector</b><br>
       <br>
       To accomodate 16/32 and 64 bit characters, the <tt>chset</tt> class
statically switches from a <tt>std::bitset</tt> implementation when the character type is not greater than 8 bits, to a sparse bit/boolean set which uses a sorted vector of disjoint ranges (<tt>range_run</tt>). The set is - constructed from ranges such that adjacent or overlapping ranges are coalesced.<br> + constructed from ranges such that adjacent or overlapping ranges are coalesced.<br>为了容纳16/32和64位字符,当字符类长度小于8位 时,<tt>chset</tt> 类的实现从 <tt>std::bitset</tt> 类切换到一个使用不连续范 +(<tt>range_run</tt>)的有序向量(vector)的位/布尔集合。这个集合使用区间,使得 那些相邻的或重叠的范围得以链接。<br>
       <br>
range_runs are very space-economical in situations where there are lots of ranges and a few individual disjoint values. Searching is O(log n) where
-      n is the number of ranges.</td>
+ n is the number of ranges.<br>range_run 在有大批间续的值和少量离散值 的情况下是非常节省空间的。搜索时间为 O(log n),n 是区间的大小。</td>
   </tr>
-</table>
-<p> Examples:<br>
+</tbody></table>
+<p> Examples:<br>例如:<br>
 </p>
-<pre><span class=identifier> </span><span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s1</span><span class=special>(</span><span class=literal>'x'</span><span class=special>); - </span><span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s2</span><span class=special>(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>s1</span><span class=special>);</span></pre> +<pre><span class="identifier"> </span><span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s1</span><span class="special">(</span><span class="literal">'x'</span><span class="special">);<br> </span><span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s2</span><span class="special">(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">s1</span><span class="special">);</span></pre> <p>Optionally, character sets may also be constructed using a definition string following a syntax that resembles posix style regular expression character sets, except that double quotes delimit the set elements instead of square brackets
-  and there is no special negation <tt>^</tt> character.</p>
-<pre> <span class=identifier>range </span><span class=special>= </span><span class=identifier>anychar_p </span><span class=special>&gt;&gt; </span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>anychar_p</span><span class=special>; - </span><span class=identifier>set </span><span class=special>= *(</span><span class=identifier>range_p </span><span class=special>| </span><span class=identifier>anychar_p</span><span class=special>);</span></pre> + and there is no special negation <tt>^</tt> character.<br>此外,字符集可 以由一个根据类似于posix风格正则表达式(除了用双引号代替方括号且没有特殊的反 ^字符)的字符串定义。
+</p>
+<pre> <span class="identifier">range </span><span class="special">= </span><span class="identifier">anychar_p </span><span class="special">&gt;&gt; </span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">anychar_p</span><span class="special">;<br> </span><span class="identifier">set </span><span class="special">= *(</span><span class="identifier">range_p </span><span class="special">| </span><span class="identifier">anychar_p</span><span class="special">);</span></pre> <p>Since we are defining the set using a C string, the usual C/C++ literal string
-  syntax rules apply. Examples:<br>
+ syntax rules apply. Examples:<br>由于我们用C字符串定义,因此通常的C/C++字 符串语法同样适用。例子:
 </p>
-<pre> <span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s1</span><span class=special>(</span><span class=string>&quot;a-zA-Z&quot;</span><span class=special>); </span><span class=comment>// alphabetic characters - </span><span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s2</span><span class=special>(</span><span class=string>&quot;0-9a-fA-F&quot;</span><span class=special>); </span><span class=comment>// hexadecimal characters - </span><span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s3</span><span class=special>(</span><span class=string>&quot;actgACTG&quot;</span><span class=special>); </span><span class=comment>// DNA identifiers - </span><span class=identifier>chset</span><span class=special>&lt;&gt; </span><span class=identifier>s4</span><span class=special>(</span><span class=string>&quot;\x7f\x7e&quot;</span><span class=special>); </span><span class=comment>// Hexadecimal 0x7F and 0x7E</span></pre> +<pre> <span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s1</span><span class="special">(</span><span class="string">"a-zA-Z"</span><span class="special">); </span><span class="comment">// alphabetic characters<br> </span><span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s2</span><span class="special">(</span><span class="string">"0-9a-fA-F"</span><span class="special">); </span><span class="comment">// hexadecimal characters<br> </span><span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s3</span><span class="special">(</span><span class="string">"actgACTG"</span><span class="special">); </span><span class="comment">// DNA identifiers<br> </span><span class="identifier">chset</span><span class="special">&lt;&gt; </span><span class="identifier">s4</span><span class="special">(</span><span class="string">"\x7f\x7e"</span><span class="special">); </span><span class="comment">// Hexadecimal 0x7F and 0x7E</span></pre> <p>The standard Spirit set operators apply (see <a href="operators.html">operators</a>) - plus an additional character-set-specific inverse (negation <tt>~</tt>) operator:<span class=comment></span></p>
-
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="2">Character set operators</td>
+ plus an additional character-set-specific inverse (negation <tt>~</tt>) operator:<br>标准的Spirit集合操作符(见<a href="operators.html">操作符 </a>)还添加了一个字符集专属的补集(求反~)操作符:
+
+
+
+<span class="comment"></span></p>
+
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td class="table_title" colspan="2">Character set operators 字符集操作 符</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>~a</b></td>
-    <td class="table_cells" width="72%">Set inverse</td>
+    <td class="table_cells" width="72%">Set inverse 补集</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>a | b</b></td>
-    <td class="table_cells" width="72%">Set union</td>
+    <td class="table_cells" width="72%">Set union 并集</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>a &amp; </b></td>
-    <td class="table_cells" width="72%">Set intersection</td>
+    <td class="table_cells" width="72%">Set intersection 交集</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>a - b</b></td>
-    <td class="table_cells" width="72%">Set difference</td>
+    <td class="table_cells" width="72%">Set difference 差集</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>a ^ b</b></td>
-    <td class="table_cells" width="72%">Set xor</td>
+    <td class="table_cells" width="72%">Set xor 集合异或</td>
   </tr>
-</table>
-<p></p>
-<p></p>
-<p></p>
-<p></p>
-<p></p>
-<p></p>
-<p></p>
-<p></p>
+</tbody></table>
<p>where operands a and b are both <tt>chsets</tt> or one of the operand is either a literal character, <tt>ch_p</tt> or <tt>chlit</tt>, <tt>range_p</tt> or <tt>range</tt>, <tt>anychar_p</tt> or <tt>nothing_p</tt>. Special optimized overloads are provided for <tt>anychar_p</tt> and <tt>nothing_p</tt> operands. A <tt>nothing_p</tt> - operand is converted to an empty set, while an <tt>anychar_p</tt> operand is
+  operand is converted to an empty set, while an&nbsp;anychar_p operand is
converted to a set having elements of the full range of the character type used
-  (e.g. 0-255 for unsigned 8 bit chars).</p>
+ (e.g. 0-255 for unsigned 8 bit chars).<br>这里算子 a 和 b 都是 <tt>chsets</tt>&nbsp;或者其中一个是字面字符,<tt>ch_p</tt> 或 <tt>chlit</tt>, <tt>range_p</tt> 或 <tt>range</tt>, + <tt>anychar_p</tt> 或 <tt>nothing_p</tt><span style="font-weight: bold;"></span>。为 <tt>anychar_p</tt> 和 <tt>nothing_p</tt>&nbsp;算子提供了 特别优化的算符重载。<tt>nothing_p</tt>&nbsp;算子被转化为一个空集而 +anychar_p 算子则被转化为一个所使用的字符的全集(比如8位的字符就是0-255)。 </p> <p>A special case is <tt>~anychar_p</tt> which yields <tt>nothing_p</tt>, but <tt>~nothing_p</tt> is illegal. Inversion of <tt>anychar_p</tt> is asymmetrical, - a one-way trip comparable to converting <tt>T*</tt> to a <tt>void*.</tt></p>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="2">Special conversions</td>
+ a one-way trip comparable to converting <tt>T*</tt> to a <tt>void*.</tt><br>一个特例是,<tt>~anychar_p</tt> 会产生 <tt>nothing_p</tt>,而 + <tt>~nothing_p</tt> 是非法的。<tt>anychar_p</tt> 的求反是不对称的、单向 的,类似于从 <tt>T*</tt> 到 <tt>void*.</tt></p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+    <td class="table_title" colspan="2">Special conversions 特殊的转换</td>
   </tr>
   <tr>
<td class="table_cells" width="28%"><b>chset&lt;CharT&gt;(nothing_p)</b></td>
-    <td class="table_cells" width="72%">empty set</td>
+    <td class="table_cells" width="72%">empty set 空集</td>
   </tr>
   <tr>
<td class="table_cells" width="28%"><b>chset&lt;CharT&gt;(anychar_p)</b></td> <td class="table_cells" width="72%">full range of CharT (e.g. 0-255 for unsigned
-      8 bit chars)</td>
+      8 bit chars)<br>CharT的全范围(比如8位的字符就是0-255)</td>
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>~anychar_p</b></td>
@@ -135,24 +128,23 @@
   </tr>
   <tr>
     <td class="table_cells" width="28%"><b>~nothing_p</b></td>
-    <td class="table_cells" width="72%">illegal</td>
+    <td class="table_cells" width="72%">illegal 非法</td>
   </tr>
-</table>
+</tbody></table>

 <p></p><table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="loops.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="confix.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/closures.html        Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/closures.html        Sun Sep 20 23:13:57 2009
@@ -1,50 +1,54 @@
-<html>
-<head>
-<title>Closures</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Closures</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link rel="stylesheet" href="theme/style.css" type="text/css">
 <style type="text/css">
 <!--
 .style1 {font-family: "Courier New", Courier, mono}
 -->
-</style>
-</head>
-
+</style></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
     <td width="85%">
- <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Closures</b></font> + <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Closures 闭包</b></font>
     </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="phoenix.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="dynamic_parsers.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<h2>Overview</h2>
-<p>Using phoenix, in the previous chapter, we've seen how we can get data from our parsers using <tt>var</tt>:</p> -<pre><code><font color="#000000"><span class=special> </span><span class=keyword>int </span><span class=identifier>i</span><span class=special>; -</span><span class=identifier> integer </span><span class=special>= </span><span class=identifier>int_p</span><span class=special>[</span><span class="identifier">var</span><span class=special>(</span><span class=identifier>i</span><span class=special>) = </span><span class="identifier">arg1</span><span class=special>];</span></font></code></pre>
+</tbody></table>
+<h2>Overview 概览</h2>
+<p>Using phoenix, in the previous chapter, we've seen how we can get data from our parsers using <tt>var</tt>:<br>在上一章中,通过使用Phoenix,我们已 经看到了如何用 <tt>var</tt> 从分析器中取得数据:</p> +<pre><code><font color="#000000"><span class="special"> </span><span class="keyword">int </span><span class="identifier">i</span><span class="special">;<br></span><span class="identifier"> integer </span><span class="special">= </span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">i</span><span class="special">) = </span><span class="identifier">arg1</span><span class="special">];</span></font></code></pre> <p>Nifty! Our rule <tt>integer</tt>, if successful, passes the parsed integer to the variable <tt>i</tt>. Everytime we need to parse an integer, we can call our rule <tt>integer</tt> and simply extract the parsed number from the variable <tt>i</tt>. There's something you should be aware of though. In the viewpoint of the grammar, the variable <tt>i</tt> is global. When the grammar gets more complex, it's hard to keep track of the current state of <tt>i</tt>. And, with
-  recursive rules, global variables simply won't be adequate. </p>
-<p>Closures are needed if you need your rules (or grammars) to be reentrant. For example, a rule (or grammar) might be called recursively indirectly or directly by itself. The calculator is a good example. The expression rule recursively calls itself indirectly when it invokes the factor rule. </p> -<p>Closures provide named (lazy) variables associated with each parse rule invocation. A closure variable is addressed using member syntax:</p> -<pre><code><font color="#000000"><span class=identifier> </span>rulename<span class="special">.</span>varname</font></code></pre> -<p>A closure variable <tt>R.x</tt> may be addressed in the semantic action of any other rule invoked by <tt>R</tt>; it refers to the innermost enclosing invocation of <tt>R</tt>. If no such invocation exists, an assertion occurs at runtime. </p> + recursive rules, global variables simply won't be adequate.<br>好极了!我 们的规则 <tt>integer</tt>,如果成功匹配,将把所分析出的整数传递给变量 <tt>i</tt>。每次我们需要分析一个整数,都可以调用 <tt>integer</tt>&nbsp;规 则,并简单地 +从变量 <tt>i</tt> 提取分析出的整数。但这里还是有些事情要注意。从语法的视角 来看,<tt>i</tt>&nbsp;是全局的。当语法变得越来越复杂时,是很难掌握 <tt>i</tt> 的当前状态的。并且,在递归
+规则的情况下,全局变量通常并不适用。</p>
+<p>Closures are needed if you need your rules (or grammars) to be
+reentrant. For example, a rule (or grammar) might be called recursively
+indirectly or directly by itself. The calculator is a good example. The
+expression rule recursively calls itself indirectly when it invokes the
+factor rule.<br>如果你想让你的规则(或者语法)变成可再入的,那闭包就是必须 的了。比如,一个规则(或语法)可能被自身直接或间接地递归调用。caculator是一 个好例子。expression规则在调用factor规则时,间接地调用自身。</p>
+<p>Closures provide named (lazy) variables associated with each parse
+rule invocation. A closure variable is addressed using member syntax:<br>闭 包提供了与每次规则调用相关联的命名(惰性)变量。一个闭包变量用成员语法表 示:</p> +<pre><code><font color="#000000"><span class="identifier"> </span>rulename<span class="special">.</span>varname</font></code></pre> +<p>A closure variable <tt>R.x</tt> may be addressed in the semantic action of any other rule invoked by <tt>R</tt>; it refers to the innermost enclosing invocation of <tt>R</tt>. If no such invocation exists, an assertion occurs at runtime.<br>一个闭包变量 <tt>R.x</tt>&nbsp;可以在关联于 由 <tt>R</tt> 所调用的任何规则的语义动作中出现;它关联到 <tt>R</tt>&nbsp;的 最深一层的调用。如果这样的调用不存在,将产生一个运行时断言错误。</p>
 <p>Closures provide an environment, a stack frame, for local variables.
Most importantly, the closure variables are accessible from the EBNF grammar specification and can be used to pass parser information upstream or downstream
@@ -52,287 +56,193 @@
   Closures facilitate dynamic scoping in C++.
Spirit's closure implementation is based on <em>Todd Veldhuizen</em>'s <strong>Dynamic scoping in C++</strong> technique that he presented in his paper <a href="ftp://ftp.cs.indiana.edu/pub/techreports/TR542.pdf";>Techniques
-  for Scientic C++</a>. </p>
+ for Scientic C++</a>.<br>闭包为本地变量提供了一个环境,一个栈框架。最重要 的是,闭包变量可以在EBNF语法定义中访问且可以在自顶向下递归下降中顺流或逆流传 递分析器信息。闭包完善了C++的动态作用范围。Spirit的闭包实现基于<em>Todd Veldhuizen的</em><strong> Dynamic scoping in C++</strong> 技术,见于他的文 章 <a href="ftp://ftp.cs.indiana.edu/pub/techreports/TR542.pdf";>Techniques for Scientic C++</a>。</p> <p>When a rule is given a closure, the closure's local variables are created prior to entering the parse function and destructed after exiting the parse function. - These local variables are true local variables that exist on the hardware stack.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><img src="theme/alert.gif" width="16" height="16"> <strong>Closures</strong>
-      <strong>and Phoenix</strong><br> <br>
+ These local variables are true local variables that exist on the hardware stack.<br>当一个规则被给定一个闭包,闭包的本地变量在进入parse函数前 创建,在退出parse函数后析构。这些本地变量都是真实存在于硬件栈上的本地变量。 </p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><img src="theme/alert.gif" height="16" width="16"> <strong>Closures</strong>
+      <strong>and Phoenix </strong><strong>闭包和Phoenix</strong><br> <br>
Spirit v1.8 closure support requires <a href="../phoenix/index.html">Phoenix</a>. In the future, Spirit will fully support <a href="../../../../libs/lambda/index.html">BLL</a>. - Currently, work is underway to merge the features of both libraries.</td> + Currently, work is underway to merge the features of both libraries.<br>Spirit1.8闭包需要 <a href="../phoenix/index.html">Phoenix</a> 的支持。在将来,Spirit将完全支持 <a href="../../../lambda/index.html">BLL</a><a href="http://www.boost.org/libs/lambda/index.html";></a>。目前正在进行合并这 两个库的功能的工作。</td>
   </tr>
-</table>
-<h2>Example</h2>
-<p>Let's go back to the calculator grammar introduced in the <a href="functional.html">Functional</a> chapter. Here's the full grammar again, plus the closure declarations:</p> -<pre><span class=special> </span><span class=keyword>struct </span><span class=identifier>calc_closure </span><span class=special>: </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>closure</span><span class=special>&lt;</span><span class=identifier>calc_closure</span><span class=special>, </span><span class=keyword>double</span><span class=special>&gt;
-    </span><span class=special>{
- </span><span class=identifier>member1 </span><span class=identifier>val</span><span class=special>;
-    </span><span class=special>};
-
- </span><span class=keyword>struct </span><span class=identifier>calculator </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>grammar</span><span class=special>&lt;</span><span class=identifier>calculator</span><span class=special>, </span><span class=identifier>calc_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt;
-    </span><span class=special>{
- </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt; - </span><span class=keyword>struct </span><span class=identifier>definition
-        </span><span class=special>{
- </span><span class=identifier>definition</span><span class=special>(</span><span class=identifier>calculator </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>self</span><span class=special>)
-            </span><span class=special>{
- </span><span class=identifier>top </span><span class=special>= </span><span class=identifier>expression</span><span class=special>[</span><span class=identifier>self</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>];
-
-                </span><span class=identifier>expression
- </span><span class=special>= </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>+= </span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>-= </span><span class=identifier>arg1</span><span class=special>])
-                            </span><span class=special>)
-                    </span><span class=special>;
-
-                </span><span class=identifier>term
- </span><span class=special>= </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'*' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>*= </span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'/' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>/= </span><span class=identifier>arg1</span><span class=special>])
-                            </span><span class=special>)
-                    </span><span class=special>;
-
-                </span><span class=identifier>factor
- </span><span class=special>= </span><span class=identifier>ureal_p</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>| </span><span class=literal>'(' </span><span class=special>&gt;&gt; </span><span class=identifier>expression</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=literal>')' - </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=special>-</span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>])
-                    </span><span class=special>;
-            </span><span class=special>}
-
- </span><span class=keyword>typedef </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>, </span><span class=identifier>calc_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt; </span><span class=identifier>rule_t</span><span class=special>; - </span><span class=identifier>rule_t </span><span class=identifier>expression</span><span class=special>, </span><span class=identifier>term</span><span class=special>, </span><span class=identifier>factor</span><span class=special>; - </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>&gt; </span><span class=identifier>top</span><span class=special>;
-
- </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; - </span><span class=identifier>start</span><span class=special>() </span><span class=keyword>const </span><span class=special>{ </span><span class=keyword>return </span><span class=identifier>top</span><span class=special>; </span><span class=special>}
-        </span><span class=special>};
-    </span><span class=special>};</span></pre>
-<p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/phoenix_calc.cpp">viewed here</a>. This is part of the Spirit distribution.</p> -<p>Surely, we've come a long way from the original version of this calculator. With inline <a href="phoenix.html#lambda">lambda expressions</a>, we were able to write self contained grammars complete with semantic actions. </p> -<p>The first thing to notice is the declaration of <tt>calc_closure</tt>. </p>
-<p> <strong>Declaring closures</strong></p>
-<p> The general closure declaration syntax is:</p>
-<pre><code> <span class=keyword>struct </span><span class=identifier>name</span><span class=special></span> <span class=special>: </span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>closure</span><span class=special>&lt;</span><span class=identifier>name</span><span class=special>, </span><span class=keyword>type1, type2, type3,... typeN</span><span class=special>&gt;
-    {
- </span><span class=identifier>member1 m_name1</span><span class=special>; - </span><span class=identifier>member2 m_name2</span><span class=special>; - </span><span class=identifier>member3 m_name3</span><span class=special>;
-        ...
- </span><span class=identifier>memberN m_nameN</span><span class=special>;
-    };</span></code></pre>
-<p> <tt>member1</tt>... <tt>memberN</tt> are indirect links to the actual closure variables. Their indirect types correspond to <code><tt>type1</tt></code>... <code><tt>typeN</tt></code>. In our example, we declared <tt>calc_closure</tt>:</p> -<pre><span class=number> </span><span class=keyword>struct </span><span class=identifier>calc_closure </span><span class=special>: </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>closure</span><span class=special>&lt;</span><span class=identifier>calc_closure</span><span class=special>, </span><span class=keyword>double</span><span class=special>&gt;
-    </span><span class=special>{
- </span><span class=identifier>member1 </span><span class=identifier>val</span><span class=special>;
-    </span><span class=special>};</span></pre>
-<p><tt>calc_closure</tt> has a single variable <tt>val</tt> of type <span class=keyword>double</span><span class=special></span>.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><p><img src="theme/alert.gif" width="16" height="16"> <tt>BOOST_SPIRIT_CLOSURE_LIMIT</tt><br>
+</tbody></table>
+<h2>Example 例子</h2>
+<p>Let's go back to the calculator grammar introduced in the <a href="functional.html">Functional</a> chapter. Here's the full grammar again, plus the closure declarations:<br>让我们回到在<a href="functional.html">函数式</a>一章中介绍的计算器语法。这次又是一个完整的 语法,附带闭包声明:</p> +<pre><span class="special"> </span><span class="keyword">struct </span><span class="identifier">calc_closure </span><span class="special">: </span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">closure</span><span class="special">&lt;</span><span class="identifier">calc_closure</span><span class="special">, </span><span class="keyword">double</span><span class="special">&gt;<br> </span><span class="special">{<br> </span><span class="identifier">member1 </span><span class="identifier">val</span><span class="special">;<br> </span><span class="special">};<br><br> </span><span class="keyword">struct </span><span class="identifier">calculator </span><span class="special">: </span><span class="keyword">public </span><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">calculator</span><span class="special">, </span><span class="identifier">calc_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt;<br> </span><span class="special">{<br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">ScannerT</span><span class="special">&gt;<br> </span><span class="keyword">struct </span><span class="identifier">definition<br> </span><span class="special">{<br> </span><span class="identifier">definition</span><span class="special">(</span><span class="identifier">calculator </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">self</span><span class="special">)<br> </span><span class="special">{<br> </span><span class="identifier">top </span><span class="special">= </span><span class="identifier">expression</span><span class="special">[</span><span class="identifier">self</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">];<br><br> </span><span class="identifier">expression<br> </span><span class="special">= </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">+= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">-= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">)<br> </span><span class="special">;<br><br> </span><span class="identifier">term<br> </span><span class="special">= </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="special">(</span><span class="literal">'*' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">*= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'/' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">/= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">)<br> </span><span class="special">;<br><br> </span><span class="identifier">factor<br> </span><span class="special">= </span><span class="identifier">ureal_p</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">| </span><span class="literal">'(' </span><span class="special">&gt;&gt; </span><span class="identifier">expression</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">] </span><span class="special">&gt;&gt; </span><span class="literal">')'<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="special">-</span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">;<br> </span><span class="special">}<br><br> </span><span class="keyword">typedef </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">, </span><span class="identifier">calc_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt; </span><span class="identifier">rule_t</span><span class="special">;<br> </span><span class="identifier">rule_t </span><span class="identifier">expression</span><span class="special">, </span><span class="identifier">term</span><span class="special">, </span><span class="identifier">factor</span><span class="special">;<br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">top</span><span class="special">;<br><br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="keyword">const</span><span class="special">&amp;<br> </span><span class="identifier">start</span><span class="special">() </span><span class="keyword">const </span><span class="special">{ </span><span class="keyword">return </span><span class="identifier">top</span><span class="special">; </span><span class="special">}<br> </span><span class="special">};<br> </span><span class="special">};</span></pre>
+
+<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/phoenix_calc.cpp">viewed here</a>. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15"> 完整的源码<a href="../example/fundamental/phoenix_calc.cpp">在此查阅</a>。这是Spirit发布 包的组成部分。</p><p>Surely, we've come a long way from the original version of this calculator. With inline <a href="phoenix.html#lambda">lambda expressions</a>, we were able to write self contained grammars complete with semantic actions.<br>当然,我们离最初 版本的计算器已经很远了。借助内联<a href="phoenix.html#lambda">λ表达式 </a>,我们可以写出完全自持的带语义动作的语法。</p> +<p>The first thing to notice is the declaration of <tt>calc_closure</tt>.<br>首先要注意的是 <tt>calc_closure</tt><span style="font-family: Courier New;"> </span>的生命。</p>
+<p> <strong>Declaring closures 声明闭包</strong></p>
+<p> The general closure declaration syntax is:<br>一般的闭包声明语法 为:</p> +<pre><code> <span class="keyword">struct </span><span class="identifier">name</span><span class="special"></span> <span class="special">: </span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">closure</span><span class="special">&lt;</span><span class="identifier">name</span><span class="special">, </span><span class="keyword">type1, type2, type3,... typeN</span><span class="special">&gt;<br> {<br> </span><span class="identifier">member1 m_name1</span><span class="special">;<br> </span><span class="identifier">member2 m_name2</span><span class="special">;<br> </span><span class="identifier">member3 m_name3</span><span class="special">;<br> ...<br> </span><span class="identifier">memberN m_nameN</span><span class="special">;<br> };</span></code></pre> +<p> <tt>member1</tt>... <tt>memberN</tt> are indirect links to the actual closure variables. Their indirect types correspond to <code><tt>type1</tt></code>... <code><tt>typeN</tt></code>. In our example, we declared <tt>calc_closure</tt>:<br><tt>member1</tt>... <tt>memberN</tt> 间接地链接到真正的本地变量。它们的间接类型对应于 <code><tt>type1</tt></code>... <code><tt>typeN</tt></code>。在我们的例子 中,我们如下声明 <tt>calc_closure</tt>:</p> +<pre><span class="number"> </span><span class="keyword">struct </span><span class="identifier">calc_closure </span><span class="special">: </span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">closure</span><span class="special">&lt;</span><span class="identifier">calc_closure</span><span class="special">, </span><span class="keyword">double</span><span class="special">&gt;<br> </span><span class="special">{<br> </span><span class="identifier">member1 </span><span class="identifier">val</span><span class="special">;<br> </span><span class="special">};</span></pre> +<p><tt>calc_closure</tt> has a single variable <tt>val</tt> of type <span class="keyword">double</span><span class="special"></span>.<br><tt>calc_closure</tt> 有一个类型为 <span class="keyword">double</span><span class="special"></span> 的变量 <tt>val</tt>。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><p><img src="theme/alert.gif" height="16" width="16"> <tt>BOOST_SPIRIT_CLOSURE_LIMIT</tt><br>
         <br>
- Spirit predefined maximum closure limit. This limit defines the maximum number of elements a closure can hold. This number defaults to 3. The actual maximum is rounded up in multiples of 3. Thus, if this value is 4, the actual limit is 6. The ultimate maximum limit in this implementation is 15. It should <strong>NOT</strong> be greater than <tt>PHOENIX_LIMIT</tt> (see <a href="../phoenix/index.html">phoenix</a>). Example:<br>
+Spirit predefined maximum closure limit. This limit defines the maximum
+number of elements a closure can hold. This number defaults to 3. The
+actual maximum is rounded up in multiples of 3. Thus, if this value is
+4, the actual limit is 6. The ultimate maximum limit in this
+implementation is 15. It should <strong>NOT</strong> be greater than <tt>PHOENIX_LIMIT</tt> (see <a href="../phoenix/index.html">phoenix</a>). Example:<br>Spirit预定义了闭包的最大限制。它限制了一个闭包所能持有的元素的最 大数目。默认值为3。实际上最大值可以是3的整数倍。因此,如果该值为4,那么实际 的最大值为6。这个版本的实现所允许的极大值为15。这个值<strong>不能</strong>大 于<tt>PHOENIX_LIMIT</tt> (见 <a href="../phoenix/index.html">phoenix</a>)。 例子:
       <br>
- <span class="comment style1">// Define these before including anything else <br> + <span class="comment style1"></span></p><p><span class="comment style1">// Define these before including anything else <br> </span><span class="preprocessor style1">#define</span><span class="style1"> PHOENIX_LIMIT 10<br> </span><span class="preprocessor">#define</span><span class="style1"> BOOST_SPIRIT_CLOSURE_LIMIT 10</span></p> </td>
   </tr>
-</table>
-<p><strong>Attaching closures</strong></p>
+</tbody></table>
+<p><strong>Attaching closures 关联闭包</strong></p>
<p>Closures can be applied to rules, subrules and grammars (non-terminals). The closure has a special <a href="indepth_the_parser_context.html">parser context</a> that can be used with these non-terminals. The closure's - context is its means to hook into the non-terminal. The context of the closure <tt>C</tt> is <tt>C::context_t</tt>. </p> -<p>We can see in the example that we attached <tt>calc_closure</tt> to the <tt>expression</tt>, <tt>term</tt> and <tt>factor</tt> rules in our grammar:</p> -<pre><span class=special> </span><span class=keyword>typedef </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>, </span><span class=identifier>calc_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt; </span><span class=identifier>rule_t</span><span class=special>; - </span><span class=identifier>rule_t </span><span class=identifier>expression</span><span class=special>, </span><span class=identifier>term</span><span class=special>, </span><span class=identifier>factor</span><span class=special>;</span> </pre>
-<p>as well as the grammar itself:</p>
-<pre><span class=special> </span><span class=keyword>struct </span><span class=identifier>calculator </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>grammar</span><span class=special>&lt;</span><span class=identifier>calculator</span><span class=special>, </span><span class=identifier>calc_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt;</span></pre>
-<p><strong>Closure return value</strong></p>
-<p>The closure <tt>member1</tt> is the closure's return value. This return value, like the one returned by <tt>anychar_p</tt>, for example, can be used to propagate data up the parser hierarchy or passed to semantic actions. Thus, <tt>expression</tt>, <tt>term</tt> and <tt>factor</tt>, as well as the <tt>calculator</tt> grammar itself, all return a <tt>double</tt>. </p>
-<p><strong>Accessing closure variables</strong></p>
+ context is its means to hook into the non-terminal. The context of the closure <tt>C</tt> is <tt>C::context_t</tt>.<br>闭包可应用于规则、子规则和语 法(非终结符)。配合这些非终结符使用的闭包有一个特殊的<a href="indepth_the_parser_context.html">分析器语境</a>。这个语境用来把闭包与 非终结符挂钩。闭包的语境是它与非终结符挂钩的方法。闭包 <tt>C</tt> 的语境是 <tt>C::context_t</tt></p> +<p>We can see in the example that we attached <tt>calc_closure</tt> to the <tt>expression</tt>, <tt>term</tt> and <tt>factor</tt> rules in our grammar:<br>在例子中可以看到,在语法中我们把 <tt>calc_closure</tt> 关联到 <tt>expression</tt>, <tt>term</tt> 和 <tt>factor</tt> :<span style="font-family: Courier New;"><tt></tt></span></p> +<pre><span class="special"> </span><span class="keyword">typedef </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">, </span><span class="identifier">calc_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt; </span><span class="identifier">rule_t</span><span class="special">;<br> </span><span class="identifier">rule_t </span><span class="identifier">expression</span><span class="special">, </span><span class="identifier">term</span><span class="special">, </span><span class="identifier">factor</span><span class="special">;</span> </pre>
+<p>as well as the grammar itself:<br>以及语法本身:</p>
+<pre><span class="special"> </span><span class="keyword">struct </span><span class="identifier">calculator </span><span class="special">: </span><span class="keyword">public </span><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">calculator</span><span class="special">, </span><span class="identifier">calc_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt;</span></pre>
+<p><strong>Closure return value 闭包的返回值</strong></p>
+<p>The closure <tt>member1</tt> is the closure's return value. This return value, like the one returned by <tt>anychar_p</tt>, for example, can be used to propagate data up the parser hierarchy or passed to semantic actions. Thus, <tt>expression</tt>, <tt>term</tt> and <tt>factor</tt>, as well as the <tt>calculator</tt> grammar itself, all return a <tt>double</tt>.<br>闭包成员 <tt>member1</tt>&nbsp;是闭包的返回值。这个返回 值,类似于<span style="font-family: Courier New;"> </span><tt>anychar_p</tt><span style="font-family: Courier New;">&nbsp;</span>的返回值,例如,可用于在分析器层次中传递数据或传递给语义 动作。因此, <tt>expression</tt>, <tt>term</tt> 和 <tt>factor</tt>, 以及 <tt>calculator</tt>&nbsp;语法本身,都返回一个 <tt>double</tt>。</p>
+<p><strong>Accessing closure variables 访问闭包变量</strong></p>
<p>Closure variables can be accessed from within semantic actions just like you would struct members: by qualifying the member name with its owner rule, subrule - or grammar. In our example above, notice how we referred to the closure member val. Example:</p> -<pre class="identifier"><code> expression<span class=special>.</span>val <span class="comment">// refer to expression's closure member val</span></code></pre>
-<p><strong>Initializing closure variables </strong></p>
-<p>We didn't use this feature in the example, yet, for completeness... </p>
-<p>Sometimes, we need to initialize our closure variables upon entering a non-terminal (rule, subrule or grammar). Closure enabled non-terminals, by default, default-construct variables upon entering the parse member function. - If this is not desirable, we can pass constructor arguments to the non-terminal. The syntax mimics a
-  function call. </p>
+ or grammar. In our example above, notice how we referred to the closure member val. Example:<br>闭包变量可以在语义动作中访问,就用你组织成员变量的方 式:指定它所属的规则、子规则或语法以及闭包变量的名字。在上面的例子中,要注意 我们是如何引用闭包变量的。例子:</p> +<pre class="identifier"><code> expression<span class="special">.</span>val <span class="comment">// refer to expression's closure member val 引向expression的闭包成员val</span></code></pre>
+<p><strong>Initializing closure variables 初始化闭包变量 </strong></p>
+<p>We didn't use this feature in the example, yet, for completeness...<br>虽然我们的例子并未使用这个功能,但为了完整性……</p>
+<p>Sometimes, we need to initialize our closure variables upon entering
+a non-terminal (rule, subrule or grammar). Closure enabled
+non-terminals, by default, default-construct variables upon entering
+the parse member function. If this is not desirable, we can pass
+constructor arguments to the non-terminal. The syntax mimics a function
+call.<br>有时,我们在进入一个非终结符(规则、子规则或语法)前需要初始化闭包 变量。默认的,闭包允许非终结符在进入parse成员函数前初始化有默认构造函数的变 量。如果这不是我们想要的,我们可以把构造函数的参数传给非终结符。这个语法模仿 了函数调用。</p> <p>For (<em>a contrived</em>) example, if you wish to construct <tt>calc_closure</tt>'s variables - to <tt>3.6</tt>, when we invoke the rule <tt>expression</tt>, we write:</p> -<pre class="identifier"><code> expression<span class="special">(</span><span class="keyword">3.6</span><span class="special">) </span><span class="comment">// invoke rule expression and set its closure variable to 3.6</span></code></pre> + to <tt>3.6</tt>, when we invoke the rule <tt>expression</tt>, we write:<br>(特意的)例如,如果你想把 <tt>calc_closure</tt> <span style="font-family: Courier New;">的变量初始化为</span> <tt>3.6</tt><span style="font-family: Courier New;">,当我们调用</span> <tt>expression</tt><span style="font-family: Courier New;">,这么 写:</span></p> +<pre class="identifier"><code> expression<span class="special">(</span><span class="keyword">3.6</span><span class="special">) </span><span class="comment">// invoke rule expression and set its closure variable to 3.6 调用规则expression并设置其闭包变量为 3.6</span></code></pre> <p>The constructor arguments are actually Phoenix lambda expressions, so you can - use arbitrarily complex expressions. Here's another <em>contrived example<strong>: </strong></em></p> -<pre class="identifier"><code> <span class="comment">// call rule factor and set its closure variable to (expression.x / 8) * factor.y -</span> <code>factor</code><span class="special">((</span>expression<span class="special">.</span>x<span class="keyword"> </span><span class="special">/</span><span class="keyword"> 8</span><span class="special">) *</span><span class="keyword"> </span>term<span class="special">.</span>y<span class="special">)</span></code></pre> -<p><img src="theme/lens.gif" width="15" height="16"> We can pass less arguments than the actual number of variables in the closure. + use arbitrarily complex expressions. Here's another <em>contrived example<strong>:</strong></em><br>构造函数参数实际上是Phoenix的λ表达式,因此 你可以使用任意复杂的表达式。这里是另一个<em>特意的例子:</em></p> +<pre class="identifier"><code> <span class="comment">// call rule factor and set its closure variable to (expression.x / 8) * factor.y <br> // 调用规则factor并设置其闭包变量为 (expression.x / 8) * factor.y<br></span> <code>factor</code><span class="special">((</span>expression<span class="special">.</span>x<span class="keyword"> </span><span class="special">/</span><span class="keyword"> 8</span><span class="special">) *</span><span class="keyword"> </span>term<span class="special">.</span>y<span class="special">)</span></code></pre> +<p><img src="theme/lens.gif" height="16" width="15"> We can pass less arguments than the actual number of variables in the closure. The variables at the right with no corresponding constructor arguments are default - constructed. Passing more arguments than there are closure variables is an error.</p> -<p><img src="theme/lens.gif" width="15" height="16"> See <a href="../example/intermediate/parameters.cpp">parameters.cpp</a> for a compilable example. This is part of the Spirit distribution.</p>
-<h2>Closures and Dynamic parsing</h2>
-<p>Let's write a very simple parser for an XML/HTML like language with arbitrarily nested tags. The typical approach to this type of nested tag parsing is to delegate the actual tag matching to semantic actions, perhaps using a symbol table. For example, the semantic actions are responsible for ensuring that the tags are nested (e.g. this code: <tt>&lt;p&gt;&lt;table&gt;&lt;/p&gt;&lt;/table&gt;</tt> is erroneous).</p> -<p>Spirit allows us to dynamically modify the parser at runtime. The ability to guide parser behavior through semantic actions makes it possible to ensure the nesting of tags directly in the parser. We shall see how this is possible. here's the grammar in its simplest form:</p> -<pre><span class=identifier> element </span><span class=special>= </span><span class=identifier>start_tag </span><span class=special>&gt;&gt; </span><span class=special>*</span><span class=identifier>element </span><span class=special>&gt;&gt; </span><span class=identifier>end_tag</span><span class=special>;</span> + constructed. Passing more arguments than there are closure variables is an error.<br><img src="theme/lens.gif" height="16" width="15"> 我们可以传递 少于实际的闭包变量数目的参数。右边那些没有对应的构造函数参数的变量将被默认构 造。传递多余变量数目的参数将产生一个错误。</p> +<p><img src="theme/lens.gif" height="16" width="15"> See <a href="../example/intermediate/parameters.cpp">parameters.cpp</a> for a compilable example. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15"> 可编译例子见 <a href="../example/intermediate/parameters.cpp">parameters.cpp</a> 。这是 Spirit分发包的组成部分。</p>
+<h2>Closures and Dynamic parsing 闭包与动态分析</h2>
+<p>Let's write a very simple parser for an XML/HTML like language with
+arbitrarily nested tags. The typical approach to this type of nested
+tag parsing is to delegate the actual tag matching to semantic actions,
+perhaps using a symbol table. For example, the semantic actions are
+responsible for ensuring that the tags are nested (e.g. this code: <tt>&lt;p&gt;&lt;table&gt;&lt;/p&gt;&lt;/table&gt;</tt> is erroneous).<br>让 我们来写一个类似于XML/HTML的任意的标记语言的分析器。对这种嵌套标记语言典型的 方法是在语义动作中进行真正的标记匹配,也许是通过一个符号表。例如,由语义动作 负责保证这些标记是嵌套的(比如类似这样的代码是错误 的:<tt>&lt;p&gt;&lt;table&gt;&lt;/p&gt;&lt;/table&gt;</tt>)<tt></tt></p>
+<p>Spirit allows us to dynamically modify the parser at runtime. The
+ability to guide parser behavior through semantic actions makes it
+possible to ensure the nesting of tags directly in the parser. We shall
+see how this is possible. here's the grammar in its simplest form:<br>Spirit允许我们在运行时动态地修改分析器。通过语义动作引导分析器行为 的能力使得可以直接使用分析器保证标签的嵌套。我们将看到这是如何成为可能的。这 是最简形式的语法:</p> +<pre><span class="identifier"> element </span><span class="special">= </span><span class="identifier">start_tag </span><span class="special">&gt;&gt; </span><span class="special">*</span><span class="identifier">element </span><span class="special">&gt;&gt; </span><span class="identifier">end_tag</span><span class="special">;</span>
 </pre>
-<p>An element is a <tt>start_tag</tt> (e.g. <tt>&lt;font&gt;</tt>) folowed by zero or more elements, and ended by an <tt>end_tag</tt> (e.g. <tt>&lt;/font&gt;</tt>). Now, here's a first shot at our <tt>start_tag</tt>:</p> -<pre><span class=special> </span><span class=identifier>start_tag </span><span class=special>= </span><span class=literal>'&lt;' </span><span class=special>&gt;&gt; </span><span class=identifier>lexeme_d</span><span class=special>[</span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>)</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=literal>'&gt;'</span><span class=special>;</span></pre> -<p>Notice that the <tt>end_tag</tt> is just the same as <tt>start_tag</tt> with the addition of a slash:</p> -<pre><span class=special> </span><span class=identifier>end_tag </span><span class=special>= </span><span class=literal>&quot;&lt;/&quot; </span><span class=special>&gt;&gt; </span>what_we_got_in_the_start_tag <span class=special></span><span class=special>&gt;&gt; </span><span class=literal>'&gt;'</span><span class=special>;</span> +<p>An element is a <tt>start_tag</tt> (e.g. <tt>&lt;font&gt;</tt>) folowed by zero or more elements, and ended by an <tt>end_tag</tt> (e.g. <tt>&lt;/font&gt;</tt>). Now, here's a first shot at our <tt>start_tag</tt>:<br>一个元素即一个 <tt>start_tag</tt> (如 <tt>&lt;font&gt;</tt>)<font>跟随零个或更多元素,且以</font> <tt>end_tag</tt> (如<tt>&lt;/font&gt;</tt>)结尾。那么,下面就是我们的 <tt>start_tag</tt> 的首次定义:</p> +<pre><span class="special"> </span><span class="identifier">start_tag </span><span class="special">= </span><span class="literal">'&lt;' </span><span class="special">&gt;&gt; </span><span class="identifier">lexeme_d</span><span class="special">[</span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">)</span><span class="special">] </span><span class="special">&gt;&gt; </span><span class="literal">'&gt;'</span><span class="special">;</span></pre> +<p>Notice that the <tt>end_tag</tt> is just the same as <tt>start_tag</tt> with the addition of a slash:<br>注意 <tt>end_tag</tt>&nbsp;和 <tt>start_tag</tt>&nbsp;类似,只是多了一个斜线:</p> +<pre><span class="special"> </span><span class="identifier">end_tag </span><span class="special">= </span><span class="literal">"&lt;/" </span><span class="special">&gt;&gt; </span>what_we_got_in_the_start_tag <span class="special"></span><span class="special">&gt;&gt; </span><span class="literal">'&gt;'</span><span class="special">;</span>
 </pre>
-<p>What we need to do is to temporarily store what we got in our <tt>start_tag</tt> and use that later to parse our <tt>end_tag</tt>. Nifty, we can use the <a href="parametric_parsers.html">parametric parser</a> primitives to parse our <tt>end_tag</tt>: </p> -<pre><span class=special> </span><span class=identifier>end_tag </span><span class=special>= </span><span class=string>&quot;&lt;/&quot; </span><span class=special>&gt;&gt; </span><span class=identifier>f_str_p</span><span class=special>(</span>tag<span class=special>) </span><span class=special>&gt;&gt; </span><span class=literal>'&gt;'</span><span class=special>;</span></pre>
-<p>where we parameterize <tt>f_str_p</tt> with what we stored (tag). </p>
-<p>Be reminded though that our grammar is recursive. The element rule calls itself. Hence, we can't just use a variable and use <tt>phoenix::var</tt> or <tt>boost::ref</tt>. Nested recursion will simply gobble up the variable. Each invocation of element must have a closure variable <tt>tag</tt>. Here now is the complete grammar:</p> -<pre><span class=number> </span><span class=keyword>struct </span><span class=identifier>tags_closure </span><span class=special>: </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>closure</span><span class=special>&lt;</span><span class=identifier>tags_closure</span><span class=special>, </span><span class=identifier>string</span><span class=special>&gt; </span><span class=special>
-    {
- </span><span class=identifier>member1 </span><span class=identifier>tag</span><span class=special>;
-    </span><span class=special>};
-
- </span><span class=keyword>struct </span><span class=identifier>tags </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>grammar</span><span class=special>&lt;</span><span class=identifier>tags</span><span class=special>&gt;
-    </span><span class=special>{
- </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt; - </span><span class=keyword>struct </span><span class=identifier>definition </span><span class=special>{
-
- </span><span class=identifier>definition</span><span class=special>(</span><span class=identifier>tags </span><span class=keyword>const</span><span class=special>&amp; </span><span class=comment>/*self*/</span><span class=special>)
-            </span><span class=special>{
- </span><span class=identifier>element </span><span class=special>= </span><span class=identifier>start_tag </span><span class=special>&gt;&gt; </span><span class=special>*</span><span class=identifier>element </span><span class=special>&gt;&gt; </span><span class=identifier>end_tag</span><span class=special>;
-
- </span><span class=identifier>start_tag </span><span class=special>=
-                        </span><span class=literal>'&lt;'
- </span><span class=special>&gt;&gt; </span><span class=identifier>lexeme_d
-                        </span><span class=special>[
- </span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>)
-                            </span><span class=special>[
- </span><span class=comment>// construct string from arg1 and arg2 lazily - </span><span class=comment>// and assign to element.tag
-
- </span><span class=identifier>element</span><span class=special>.</span><span class=identifier>tag </span><span class=special>= </span><span class=identifier>construct_</span><span class=special>&lt;</span><span class=identifier>string</span><span class=special>&gt;(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>)
-                            </span><span class=special>]
-                        </span><span class=special>]
- </span><span class=special>&gt;&gt; </span><span class=literal>'&gt;'</span><span class=special>;
-
- </span><span class=identifier>end_tag </span><span class=special>= </span><span class=string>&quot;&lt;/&quot; </span><span class=special>&gt;&gt; </span><span class=identifier>f_str_p</span><span class=special>(</span><span class=identifier>element</span><span class=special>.</span><span class=identifier>tag</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=literal>'&gt;'</span><span class=special>;
-            </span><span class=special>}
-
- </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>, </span><span class=identifier>tags_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt; </span><span class=identifier>element</span><span class=special>; - </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>&gt; </span><span class=identifier>start_tag</span><span class=special>, </span><span class=identifier>end_tag</span><span class=special>;
-
- </span><span class=identifier>rule</span><span class=special>&lt;</span><span class=identifier>ScannerT</span><span class=special>, </span><span class=identifier>tags_closure</span><span class=special>::</span><span class=identifier>context_t</span><span class=special>&gt; </span><span class=keyword>const</span><span class=special>&amp; - </span><span class=identifier>start</span><span class=special>() </span><span class=keyword>const </span><span class=special>{ </span><span class=keyword>return </span><span class=identifier>element</span><span class=special>; </span><span class=special>}
-        </span><span class=special>};
-    </span><span class=special>};</span></pre>
-<p>We attached a semantic action to the <tt>(+alpha_p)</tt> part of the start_tag. There, we stored the parsed tag in the <tt>element</tt>'s closure variable <tt>tag</tt>. Later, in the <tt>end_tag</tt>, we simply used the <tt>element</tt>'s closure variable <tt>tag</tt> to parameterize our <tt>f_str_p</tt> parser. Simple and elegant. If some of the details begin to look like greek (e.g. what is <tt>construct_</tt>?), please consult the <a href="phoenix.html">Phoenix</a> chapter. </p> -<p><img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/matching_tags.cpp">viewed here</a>. This is part of the Spirit distribution.</p> -<h2><img src="theme/lens.gif" width="15" height="16"> Closures in-depth</h2>
-<p><strong>What are Closures?</strong></p>
-<p>The closure is an object that <span class="quotes">&quot;closes&quot;</span> +<p>What we need to do is to temporarily store what we got in our <tt>start_tag</tt> and use that later to parse our <tt>end_tag</tt>. Nifty, we can use the <a href="parametric_parsers.html">parametric parser</a> primitives to parse our <tt>end_tag</tt>:<br>我们所需要做的是临时储存 <tt>start_tag</tt>&nbsp;并且在随后分析 <tt>end_tag</tt> 中使用它。很好,我们 可以用<a href="parametric_parsers.html">参数化</a>的元素分析器来解析 <tt>end_tag</tt>:</p> +<pre><span class="special"> </span><span class="identifier">end_tag </span><span class="special">= </span><span class="string">"&lt;/" </span><span class="special">&gt;&gt; </span><span class="identifier">f_str_p</span><span class="special">(</span>tag<span class="special">) </span><span class="special">&gt;&gt; </span><span class="literal">'&gt;'</span><span class="special">;</span></pre> +<p>where we parameterize <tt>f_str_p</tt> with what we stored (tag).<br>这 里我们用我们所储存的tag来参数化 <tt>f_str_p</tt>。</p> +<p>Be reminded though that our grammar is recursive. The element rule calls itself. Hence, we can't just use a variable and use <tt>phoenix::var</tt> or <tt>boost::ref</tt>. Nested recursion will simply gobble up the variable. Each invocation of element must have a closure variable <tt>tag</tt>. Here now is the complete grammar:<br>注意我们的语法是 递归的。element 规则调用自身。因此,我们不能只用一个变量和 <tt>phoenix::var</tt> 或 <tt>boost::ref</tt>。嵌套的递归将更改变量。每次对 element 的调用都必须有一个闭包变量 <tt>tag</tt>。下面是完整的语法:</p> +<pre><span class="number"> </span><span class="keyword">struct </span><span class="identifier">tags_closure </span><span class="special">: </span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">closure</span><span class="special">&lt;</span><span class="identifier">tags_closure</span><span class="special">, </span><span class="identifier">string</span><span class="special">&gt; </span><span class="special">
+    {
+ </span><span class="identifier">member1 </span><span class="identifier">tag</span><span class="special">;<br> </span><span class="special">};<br><br> </span><span class="keyword">struct </span><span class="identifier">tags </span><span class="special">: </span><span class="keyword">public </span><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">tags</span><span class="special">&gt;<br> </span><span class="special">{<br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">ScannerT</span><span class="special">&gt;<br> </span><span class="keyword">struct </span><span class="identifier">definition </span><span class="special">{<br><br> </span><span class="identifier">definition</span><span class="special">(</span><span class="identifier">tags </span><span class="keyword">const</span><span class="special">&amp; </span><span class="comment">/*self*/</span><span class="special">)<br> </span><span class="special">{<br> </span><span class="identifier">element </span><span class="special">= </span><span class="identifier">start_tag </span><span class="special">&gt;&gt; </span><span class="special">*</span><span class="identifier">element </span><span class="special">&gt;&gt; </span><span class="identifier">end_tag</span><span class="special">;<br><br> </span><span class="identifier">start_tag </span><span class="special">=<br> </span><span class="literal">'&lt;'<br> </span><span class="special">&gt;&gt; </span><span class="identifier">lexeme_d<br> </span><span class="special">[<br> </span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">)<br> </span><span class="special">[<br> </span><span class="comment">// construct string from arg1 and arg2 lazily 从arg1和 arg2惰性地构造字符串<br> </span><span class="comment">// and assign to element.tag 并赋值给 element.tag<br><br> </span><span class="identifier">element</span><span class="special">.</span><span class="identifier">tag </span><span class="special">= </span><span class="identifier">construct_</span><span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">arg1</span><span class="special">, </span><span class="identifier">arg2</span><span class="special">)<br> </span><span class="special">]<br> </span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="literal">'&gt;'</span><span class="special">;<br><br> </span><span class="identifier">end_tag </span><span class="special">= </span><span class="string">"&lt;/" </span><span class="special">&gt;&gt; </span><span class="identifier">f_str_p</span><span class="special">(</span><span class="identifier">element</span><span class="special">.</span><span class="identifier">tag</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="literal">'&gt;'</span><span class="special">;<br> </span><span class="special">}<br><br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">, </span><span class="identifier">tags_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt; </span><span class="identifier">element</span><span class="special">;<br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">start_tag</span><span class="special">, </span><span class="identifier">end_tag</span><span class="special">;<br><br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">, </span><span class="identifier">tags_closure</span><span class="special">::</span><span class="identifier">context_t</span><span class="special">&gt; </span><span class="keyword">const</span><span class="special">&amp;<br> </span><span class="identifier">start</span><span class="special">() </span><span class="keyword">const </span><span class="special">{ </span><span class="keyword">return </span><span class="identifier">element</span><span class="special">; </span><span class="special">}<br> </span><span class="special">};<br> </span><span class="special">};</span></pre> +<p>We attached a semantic action to the <tt>(+alpha_p)</tt> part of the start_tag. There, we stored the parsed tag in the <tt>element</tt>'s closure variable <tt>tag</tt>. Later, in the <tt>end_tag</tt>, we simply used the <tt>element</tt>'s closure variable <tt>tag</tt> to parameterize our <tt>f_str_p</tt> parser. Simple and elegant. If some of the details begin to look like greek (e.g. what is <tt>construct_</tt>?), please consult the <a href="phoenix.html">Phoenix</a> chapter.<br>我们把语义动作关 联到 start_tag 的 <tt>(+alpha_p)</tt>&nbsp;部分上。在那里,我们把分析出的标 记储存在这个 <tt>element</tt> 的闭包变量 <tt>tag</tt> 里。随 +后,在 <tt>end_tag</tt> 中,我们简单地用 <tt>element</tt> 的闭包变量  <tt>tag</tt> 来参数化我们的 <tt>f_str_p</tt>&nbsp;分析器。简单而优雅。如果 某些细节看起来有点晦涩(比如, <tt>construct_</tt><span style="font-family: Courier New;"> 是干嘛的?</span>),请见<a href="phoenix.html">Phoenix</a>章节。</p> +<p><img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/matching_tags.cpp">viewed here</a>. This is part of the Spirit distribution.</p><p><img src="theme/lens.gif" height="16" width="15"> 完整的源码<a href="../example/fundamental/matching_tags.cpp">在此查阅</a>,这是Spirit分发 包的组成部分。</p> +<h2><img src="theme/lens.gif" height="16" width="15"> Closures in-depth 深 入闭包</h2>
+<p><strong>What are Closures? 闭包是什么?</strong></p>
+<p>The closure is an object that <span class="quotes">"closes"</span>
over the local variables of a function making them visible and accessible outside the function. What is more interesting is that the closure actually packages a local context (stack frame where some variables reside) and makes it available outside the scope in which they actually exist. The information is essentially - <span class="quotes">&quot;captured&quot;</span> by the closure allowing it
+  <span class="quotes">"captured"</span> by the closure allowing it
to be referred to anywhere and anytime, even prior to the actual creation of
-  the variables. </p>
+ the variables.<br>闭包指"包裹"函数的本地变量,使其在函数外可见及可访问的 对象。更有趣的是闭包实际上包裹了一个本地语境(变量所处的栈框架)并使其在他们 实际的可见范围之外可见。这些信息本质上被闭包所"捕捉"以使其在任一时刻任意地点 都可以被引用,甚至在变量被实际创建之前。</p> <p>The following diagram depicts the situation where a function <tt>A</tt> (or rule) exposes its closure and another function <tt>B</tt> references <tt>A</tt>'s
-  variables through its closure.</p>
-<table width="40%" border="0" align="center">
-  <tr>
+ variables through its closure.<br>下图描绘了一个函数 <tt>A</tt>(或者规则 )暴露其闭包且另一个函数 <tt>B</tt> 通过这个闭包引用 <tt>A</tt> 的变量。</p>
+<table align="center" border="0" width="40%">
+  <tbody><tr>
     <td><img src="theme/closure1.png"></td>
   </tr>
   <tr>
- <td> <div align="center"><b><font face="Geneva, Arial, Helvetica, san-serif" size="+1" color="#003399">The - closure as an object that <i>&quot;closes&quot;</i> over the local variables - of a function making them visible and accessible outside the function</font></b></div></td> + <td> <div align="center"><b><font color="#003399" face="Geneva, Arial, Helvetica, san-serif" size="+1">The
+        closure as an object that <i>"closes"</i> over the local variables
+ of a function making them visible and accessible outside the function<br>闭包就象一个"包裹"着一个函数的某个局部变量的对象,使之可以在函数 以外可见并被访问</font></b></div></td>
   </tr>
-</table>
+</tbody></table>
<p>Of course, function <tt>A</tt> should be active when <tt>A.x</tt> is referenced. What this means is that function <tt>B</tt> is reliant on function <tt>A</tt> (If <tt>B</tt> is a nested function of <tt>A</tt>, this will always be the case). The free form nature of Spirit rules allows access to a closure variable anytime, anywhere. Accessing <tt>A.x</tt> is equivalent to referring to the topmost stack variable <tt>x</tt> of function <tt>A</tt>. If function <tt>A</tt> is not active
-  when <tt>A.x</tt> is referenced, a runtime exception will be thrown.</p>
-<p><strong>Nested Functions</strong></p>
+ when <tt>A.x</tt> is referenced, a runtime exception will be thrown.<br>当然,在 <tt>A.x</tt>&nbsp;被引用时,函数 <tt>A</tt>&nbsp;应当是 活动的。这意味着函数 <tt>B</tt> 依赖于函数 <tt>A</tt>(如果 <tt>B</tt> 嵌套 于 <tt>A</tt> 内,那么这永远成立)。Spirit拥有的自由形式允 +许在任何时刻任何地点引用闭包变量。访问 <tt>A.x</tt> 等价于访问函数 <tt>A</tt> 栈内最顶层的变量 <tt>x</tt>。如果在 <tt>A.x</tt>&nbsp;被引用时 <tt>A</tt> 并不是活动的,将抛出一个运行时异常。</p>
+<p><strong>Nested Functions 嵌套函数</strong></p>
<p>To fully understand the importance of closures, it is best to look at a language such as Pascal which allows nested functions. Since we are dealing with C++, lets us assume for the moment that C++ allows nested functions. Consider the
-  following <b><i>pseudo</i></b> C++ code:</p>
-<pre><span class=identifier> </span><span class=keyword>void </span><span class=identifier>a</span><span class=special>()
-    </span><span class=special>{
- </span><span class=keyword>int </span><span class=identifier>va</span><span class=special>; - </span><span class=keyword>void </span><span class=identifier>b</span><span class=special>()
-        </span><span class=special>{
- </span><span class=keyword>int </span><span class=identifier>vb</span><span class=special>; -</span> <span class=keyword>void </span><span class=identifier>c</span><span class=special>()
-            </span><span class=special>{
- </span><span class=keyword>int </span><span class=identifier>vc</span><span class=special>;
-            </span><span class=special>}
-
- </span><span class=identifier>c</span><span class=special>()</span><span class=special>;
-        </span><span class=special>}
-
-        </span><span class=identifier>b</span><span class=special>();
-    </span><span class=special>}</span></pre>
+ following <b><i>pseudo</i></b> C++ code:<br>要完全明白闭包的重要性,最好 看看诸如Pascal这样允许嵌套函数的语言。由于我们是在和C++打交道,让我们假设 C++允许嵌套函数。考虑下面的C++伪代码:</p> +<pre><span class="identifier"> </span><span class="keyword">void </span><span class="identifier">a</span><span class="special">()<br> </span><span class="special">{<br> </span><span class="keyword">int </span><span class="identifier">va</span><span class="special">;<br> </span><span class="keyword">void </span><span class="identifier">b</span><span class="special">()<br> </span><span class="special">{<br> </span><span class="keyword">int </span><span class="identifier">vb</span><span class="special">;<br></span> <span class="keyword">void </span><span class="identifier">c</span><span class="special">()<br> </span><span class="special">{<br> </span><span class="keyword">int </span><span class="identifier">vc</span><span class="special">;<br> </span><span class="special">}<br><br> </span><span class="identifier">c</span><span class="special">()</span><span class="special">;<br> </span><span class="special">}<br><br> </span><span class="identifier">b</span><span class="special">();<br> </span><span class="special">}</span></pre> <p>We have three functions <tt>a</tt>, <tt>b</tt> and <tt>c</tt> where <tt>c</tt> is nested in <tt>b</tt> and <tt>b</tt> is nested in <tt>a</tt>. We also have three variables <tt>va</tt>, <tt>vb</tt> and <tt>vc</tt>. The lifetime of each of these local variables starts when the function where it is declared is entered and ends when the function exits. The scope of a local variable spans all nested - functions inside the enclosing function where the variable is declared.</p> + functions inside the enclosing function where the variable is declared.<br>我们有三个函数 <tt>a</tt>, <tt>b</tt> 和 <tt>c</tt>。这里 <tt>c</tt> 嵌套于 <tt>b</tt>,<tt>b</tt> 嵌套于 <tt>a</tt>。我们也有三个变 量 <tt>va</tt>, <tt>vb</tt> 和 <tt>vc</tt>。这三个局部变量的生命周期从函数中 他们声明的位置开始,结束于函数退出之时。局部变量的周期跨越所有在变量声明之后 的嵌套函数。</p> <p>Going downstream from function <tt>a</tt> to function <tt>c</tt>, when function a is entered, the variable <tt>va</tt> will be created in the stack. When function <tt>b</tt> is entered (called by <tt>a</tt>), <tt>va</tt> is very well in scope and is visble in <tt>b</tt>. At which point a fresh variable, <tt>vb</tt>, is created on the stack. When function <tt>c</tt> is entered, both <tt>va</tt> and <tt>vb</tt> are visibly in scope, and a fresh local variable <tt>vc</tt>
-  is created. </p>
+ is created.<br>从函数 <tt>a </tt>顺流来到函数 <tt>c</tt>,当进入 <tt>a</tt>&nbsp;函数时,变量 <tt>va</tt>&nbsp;将被在栈上创建。当进入函数 <tt>b</tt>(由 <tt>a</tt> 调用),<tt>va</tt> 处于它的周期之内并在 <tt>b</tt> 中可见。此时一个新的变量,<tt>vb</tt> 在栈上创建。当进入函数 <tt>c</tt>,<tt>va</tt> 和 <tt>vb</tt>&nbsp;都在可见范围内,同时新的局部变 量 <tt>vc</tt>&nbsp;被创建。</p> <p>Going upstream, <tt>vc</tt> is not and cannot be visible outside the function <tt>c</tt>. <tt>vc</tt>'s life has already expired once <tt>c</tt> exits. The same is true with <tt>vb</tt>; vb is accessible in function <tt>c</tt> but not
-  in function <tt>a</tt>. </p>
-<strong>Nested Mutually Recursive Rules</strong>
-<p>Now consider that <tt>a</tt>, <tt>b</tt> and <tt>c</tt> are rules:</p>
-<pre><span class=identifier> </span><span class=identifier>a </span><span class=special>= </span><span class=identifier>b </span><span class=special>&gt;&gt; </span><span class=special>*((</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>b</span><span class=special>) </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>b</span><span class=special>)); - </span><span class=identifier>b </span><span class=special>= </span><span class=identifier>c </span><span class=special>&gt;&gt; </span><span class=special>*((</span><span class=literal>'*' </span><span class=special>&gt;&gt; </span><span class=identifier>c</span><span class=special>) </span><span class=special>| </span><span class=special>(</span><span class=literal>'/' </span><span class=special>&gt;&gt; </span><span class=identifier>c</span><span class=special>)); - </span><span class=identifier>c </span><span class=special>= </span><span class=identifier>int_p </span><span class=special>| </span><span class=literal>'(' </span><span class=special>&gt;&gt; </span><span class=identifier>a </span><span class=special>&gt;&gt; </span><span class=literal>')' </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>c</span><span class=special>) </span><span class=special>| </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>c</span><span class=special>);</span></pre> + in function <tt>a</tt>.<br>由底而上,<tt>vc</tt> 不是且不能在函数 &nbsp;<tt>c</tt>&nbsp;外可见。<tt>vc</tt> 的生命在退出 &nbsp;<tt>c</tt>&nbsp;时已经结束了。这同样适用于 <tt>vb</tt>;<tt>vb</tt> 在 函数&nbsp;<tt>c</tt>&nbsp;内是可访问的,但在函数&nbsp;<tt>a</tt> 内不是。 </p> +<strong>Nested Mutually Recursive Rules&nbsp;</strong><strong>嵌套交叉递归 规则</strong> +<p>Now consider that <tt>a</tt>, <tt>b</tt> and <tt>c</tt> are rules:<br>下 面考虑规则 <tt>a</tt>, <tt>b</tt> 和 <tt>c</tt>:</p> +<pre><span class="identifier"> </span><span class="identifier">a </span><span class="special">= </span><span class="identifier">b </span><span class="special">&gt;&gt; </span><span class="special">*((</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">b</span><span class="special">) </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">b</span><span class="special">));<br> </span><span class="identifier">b </span><span class="special">= </span><span class="identifier">c </span><span class="special">&gt;&gt; </span><span class="special">*((</span><span class="literal">'*' </span><span class="special">&gt;&gt; </span><span class="identifier">c</span><span class="special">) </span><span class="special">| </span><span class="special">(</span><span class="literal">'/' </span><span class="special">&gt;&gt; </span><span class="identifier">c</span><span class="special">));<br> </span><span class="identifier">c </span><span class="special">= </span><span class="identifier">int_p </span><span class="special">| </span><span class="literal">'(' </span><span class="special">&gt;&gt; </span><span class="identifier">a </span><span class="special">&gt;&gt; </span><span class="literal">')' </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">c</span><span class="special">) </span><span class="special">| </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">c</span><span class="special">);</span></pre> <p>We can visualize <tt>a</tt>, <tt>b</tt> and <tt>c</tt> as mutually recursive functions where <tt>a</tt> calls <tt>b</tt>, <tt>b</tt> calls <tt>c</tt> and <tt>c</tt> recursively calls <tt>a</tt>. Now, imagine if <tt>a</tt>, <tt>b</tt> and <tt>c</tt> each has a local variable named <tt>value</tt> that can be referred
-  to in our grammar by explicit qualification:</p>
-<pre><span class=special> </span><span class=identifier>a</span><span class=special>.</span><span class=identifier>value </span><span class=comment>// refer to a's value local variable - </span><span class=identifier>b</span><span class=special>.</span><span class=identifier>value </span><span class=comment>// refer to b's value local variable - </span><span class=identifier>c</span><span class=special>.</span><span class=identifier>value </span><span class=comment>// refer to c's value local variable</span> + to in our grammar by explicit qualification:<br>我们可以看到 <tt>a</tt>, <tt>b</tt> 和 <tt>c</tt> 是交叉引用的,<tt>a</tt> 调用 <tt>b</tt>,<tt>b</tt> 调用 <tt>c</tt> 而 <tt>c</tt> 又回过头来调用 &nbsp;<tt>a</tt>。现在,想像 <tt>a</tt>、<tt>b</tt> 和 <tt>c</tt> 都有一个局 部变量,名为 <tt>value</tt>,可以在我们的语法中通过显式指定来引用:</p> +<pre><span class="special"> </span><span class="identifier">a</span><span class="special">.</span><span class="identifier">value </span><span class="comment">// refer to a's value local variable 引用a的局部变量value<br> </span><span class="identifier">b</span><span class="special">.</span><span class="identifier">value </span><span class="comment">// refer to b's value local variable</span><span class="comment"> 引用b的局部变量 value</span><span class="comment"> <br> </span><span class="identifier">c</span><span class="special">.</span><span class="identifier">value </span><span class="comment">// refer to c's value local variable</span><span class="comment"> 引用c的局部变量 value</span><span class="comment"> </span>
 </pre>
<p>Like above, when <tt>a</tt> is entered, a local variable <tt>value</tt> is created on the stack. This variable can be referred to by both <tt>b</tt> and <tt>c</tt>. Again, when <tt>b</tt> is called by <tt>a</tt>, <tt>b</tt> creates a local variable <tt>value</tt>. This variable is accessible by <tt>c</tt> but
-  not by <tt>a</tt>. </p>
+ not by <tt>a</tt>.<br>就像上面一样,当进入 <tt>a</tt>&nbsp;时,一个本地变 量 <tt>value</tt>&nbsp;在栈上创建。这个变量可以由 <tt>b</tt> 和 <tt>c</tt> 引用。同样,当 <tt>b</tt> 被 <tt>a</tt>&nbsp;调用,<tt>b</tt> 创建一个本地变 量 <tt>value</tt>。这个变量可以由&nbsp;<tt>c</tt> 引用,但 <tt>a</tt>&nbsp;不行。</p> <p>Here now is where the analogy with nested functions end: when <tt>c</tt> is called, a fresh variable <tt>value</tt> is created which, as usual, lasts the whole lifetime of <tt>c</tt>. Pay close attention however that <tt>c</tt> may call <tt>a</tt> recursively. When this happens, <tt>a</tt> may now refer to - the local variable of <tt>c</tt><code><span class=special>.</span></code></p> + the local variable of <tt>c</tt><code><span class="special">.<br></span></code>现在这里有了一个类似于嵌套函数的结局:当 <tt>c</tt> 被调用时,一个新的变量 <tt>value</tt> 被创建,持续于 <tt>c</tt> 的整个生命周期。请密切注意,<tt>c</tt> 可能会递归调用 <tt>a</tt>。如果发生了 这种情况,那么 <tt>a</tt> 也可以引用 <tt>c</tt> 的局部变量。 <tt></tt><code><span class="special"></span></code></p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="phoenix.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="dynamic_parsers.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/confix.html  Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/confix.html  Sun Sep 20 23:13:57 2009
@@ -1,185 +1,175 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Confix Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
+<html><head>
+
+<title>Confix Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>

 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
- <td width="10"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>&nbsp;</b></font></td> - <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Confix Parsers</b></font></td> - <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
+ <td width="10"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>&nbsp;</b></font></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Confix Parsers 片段分析器</b></font></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="character_sets.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="list_parsers.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<p><a name="confix_parser"></a><b>Confix Parsers</b></p>
+</tbody></table>
+<p><a name="confix_parser"></a><b>Confix Parsers 片段分析器</b></p>
<p>Confix Parsers recognize a sequence out of three independent elements: an
-       opening, an expression and a closing. A simple example is a C comment:
+ opening, an expression and a closing. A simple example is a C comment:<br>片段分析器识别一个包含三个元素的序列:一个开头、一个表达式和一个 结尾。简单的例子就是C的注释:
 </p>
 <pre><code class="comment">    /* This is a C comment */</code></pre>
-<p>which could be parsed through the following rule definition:<code><font color="#000000"> +<p>which could be parsed through the following rule definition:<br>它可以用 下面定义的规则来分析:<code><font color="#000000">
   </font></code> </p>
-<pre><span class=identifier> </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>c_comment_rule - </span><span class=special>= </span><span class=identifier>confix_p</span><span class=special>(</span><span class=literal>"/*"</span><span class=special>, </span><span class=special>*</span><span class=identifier>anychar_p</span><span class=special>, </span><span class=literal>"*/"</span><span class=special>)
-        </span><span class=special>;</span></pre>
+<pre><span class="identifier"> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">c_comment_rule<br> </span><span class="special">= </span><span class="identifier">confix_p</span><span class="special">(</span><span class="literal">"/*"</span><span class="special">, </span><span class="special">*</span><span class="identifier">anychar_p</span><span class="special">, </span><span class="literal">"*/"</span><span class="special">)<br> </span><span class="special">;</span></pre>
 <p>The <tt>confix_p</tt> parser generator
   should be used for generating the required Confix Parser. The
   three parameters to <tt>confix_p</tt> can be single
characters (as above), strings or, if more complex parsing logic is required, auxiliary parsers, each of which is automatically converted to the corresponding
-  parser type needed for successful parsing.</p>
-<p>The generated parser is equivalent to the following rule: </p>
-<pre><code> <span class=identifier>open </span><span class=special>&gt;&gt; (</span><span class=identifier>expr </span><span class=special>- </span><span class=identifier>close</span><span class=special>) &gt;&gt; </span><span class=identifier>close</span></code></pre> + parser type needed for successful parsing.<br><tt>confix_p</tt> 分析器生 成器用于生成所要求的片段分析器。<tt>confix_p</tt> 的三个参数可以是单个字符 (如上)、字符串或是任意的分析器,如果需要更复杂的分析逻辑,三者都被自动转化为 成功分析所需的恰当的分析器类型。</p> +<p>The generated parser is equivalent to the following rule:<br>所生成的分 析器等价于下面的规则: </p> +<pre><code> <span class="identifier">open </span><span class="special">&gt;&gt; (</span><span class="identifier">expr </span><span class="special">- </span><span class="identifier">close</span><span class="special">) &gt;&gt; </span><span class="identifier">close</span></code></pre> <p>If the expr parser is an <tt>action_parser_category</tt> type parser (a parser with an attached semantic action) we have to do something special. This happens,
-  if the user wrote something like:</p>
-<pre><code><span class=identifier> confix_p</span><span class=special>(</span><span class=identifier>open</span><span class=special>, </span><span class=identifier>expr</span><span class=special>[</span><span class=identifier>func</span><span class=special>], </span><span class=identifier>close</span><span class=special>)</span></code></pre> + if the user wrote something like:<br>如果 expr 分析器是一个 <tt>action_parser_category</tt> 类型的分析器(可挂接语义动作的分析器),我们就 需要进行特别处理。这是在用户写出类似下面的代码时会发生的:</p> +<pre><code><span class="identifier"> confix_p</span><span class="special">(</span><span class="identifier">open</span><span class="special">, </span><span class="identifier">expr</span><span class="special">[</span><span class="identifier">func</span><span class="special">], </span><span class="identifier">close</span><span class="special">)</span></code></pre> <p>where <code>expr</code> is the parser matching the expr of the confix sequence and <code>func</code> is a functor to be called after matching the <code>expr</code>. - If we would do nothing, the resulting code would parse the sequence as follows:</p> -<pre><code> <span class=identifier>open </span><span class=special>&gt;&gt; (</span><span class=identifier>expr</span><span class=special>[</span><span class=identifier>func</span><span class=special>] - </span><span class=identifier>close</span><span class=special>) &gt;&gt; </span><span class=identifier>close</span></code></pre> + If we would do nothing, the resulting code would parse the sequence as follows:<br>其中 <code>expr</code> 是匹配片段中的 expr 部分,而 <code>func</code> 则是在匹配 <code>expr</code> 之后所调用的仿函数。如果我们 不做任何事情,则产生的代码就会进行类似于如下的分析:</p> +<pre><code> <span class="identifier">open </span><span class="special">&gt;&gt; (</span><span class="identifier">expr</span><span class="special">[</span><span class="identifier">func</span><span class="special">] - </span><span class="identifier">close</span><span class="special">) &gt;&gt; </span><span class="identifier">close</span></code></pre> <p>which in most cases is not what the user expects. (If this <u>is</u> what you've
   expected, then please use the <tt>confix_p</tt> generator
function <tt>direct()</tt>, which will inhibit the parser refactoring). To make
-  the confix parser behave as expected:</p>
-<pre><code><span class=identifier> open </span><span class=special>&gt;&gt; (</span><span class=identifier>expr </span><span class=special>- </span><span class=identifier>close</span><span class=special>)[</span><span class=identifier>func</span><span class=special>] &gt;&gt; </span><span class=identifier>close</span></code></pre> + the confix parser behave as expected:<br>而这不是大多数用户所要的(如果这 <u>就是</u>你想要的,那么请使用 <tt>confix_p</tt> 生成器函数 <tt>direct()</tt>,它将返回所重构的分析器)。为了让片段分析器按照如下所预期的 方式工作:</p> +<pre><code><span class="identifier"> open </span><span class="special">&gt;&gt; (</span><span class="identifier">expr </span><span class="special">- </span><span class="identifier">close</span><span class="special">)[</span><span class="identifier">func</span><span class="special">] &gt;&gt; </span><span class="identifier">close</span></code></pre> <p>the actor attached to the <code>expr</code> parser has to be re-attached to the <code>(expr - close)</code> parser construct, which will make the resulting confix parser 'do the right thing'. This refactoring is done by the help of the <a href="refactoring.html">Refactoring Parsers</a>. Additionally special care must be taken, if the expr parser is a <tt>unary_parser_category</tt> type
-  parser as </p>
-<pre><code><span class=identifier> confix_p</span><span class=special>(</span><span class=identifier>open</span><span class=special>, *</span><span class=identifier>anychar_p</span><span class=special>, </span><span class=identifier>close</span><span class=special>)</span></code></pre>
-<p>which without any refactoring would result in </p>
-<pre><code> <span class=identifier>open</span> <span class=special>&gt;&gt; (*</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>close</span><span class=special>) &gt;&gt; </span><span class=identifier>close</span></code></pre> + parser as<br>挂接于 <code>expr</code>&nbsp;分析器之上的动作器必须重挂接 到 <code>(expr - close)</code>&nbsp;分析器上,才能使得所产生的片段分析器"行 为得当"。这一重构借由<a href="refactoring.html">重构分析器</a>完成。还有必须 要注意的是,如果 expr 分析器属于<tt>unary_parser_category</tt>&nbsp;类型的分 析器,比如:</p> +<pre><code><span class="identifier"> confix_p</span><span class="special">(</span><span class="identifier">open</span><span class="special">, *</span><span class="identifier">anychar_p</span><span class="special">, </span><span class="identifier">close</span><span class="special">)</span></code></pre> +<p>which without any refactoring would result in<br>以上如果不经重构则变 成:</p> +<pre><code> <span class="identifier">open</span> <span class="special">&gt;&gt; (*</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">close</span><span class="special">) &gt;&gt; </span><span class="identifier">close</span></code></pre> <p>and will not give the expected result (*anychar_p will eat up all the input up
-to the end of the input stream). So we have to refactor this into:
-<pre><code><span class=identifier> open </span><span class=special>&gt;&gt; *(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>close</span><span class=special>) &gt;&gt; </span><span class=identifier>close</span></code></pre>
-<p>what will give the correct result. </p>
+to the end of the input stream). So we have to refactor this into:<br>而这 将无法得出所期望的结果(*anychar_p 将接受任意字符,直到输入耗尽)。因此我们 必须把这个重构为:</p><pre><code><span class="identifier"> open </span><span class="special">&gt;&gt; *(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">close</span><span class="special">) &gt;&gt; </span><span class="identifier">close</span></code></pre>
+<p>what will give the correct result.<br>从而得出正确的结果。</p>
<p>The case, where the expr parser is a combination of the two mentioned problems (i.e. the expr parser is a unary parser with an attached action), is handled
-  accordingly too, so: </p>
-<pre><code><span class=identifier> confix_p</span><span class=special>(</span><span class=identifier>open</span><span class=special>, (*</span><span class=identifier>anychar_p</span><span class=special>)[</span><span class=identifier>func</span><span class=special>], </span>close<span class=special>)</span></code></pre>
-<p>will be parsed as expected: </p>
-<pre><code> <span class=identifier>open</span> <span class=special>&gt;&gt; (*(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>end</span><span class=special>))[</span><span class=identifier>func</span><span class=special>] &gt;&gt; </span>close</code></pre> + accordingly too, so:<br>expr 分析器揉杂了以上两个问题的情况(比如 expr 分 析器是一个一元的且挂接了语义动作),也是通过同样的方法处理,因此:</p> +<pre><code><span class="identifier"> confix_p</span><span class="special">(</span><span class="identifier">open</span><span class="special">, (*</span><span class="identifier">anychar_p</span><span class="special">)[</span><span class="identifier">func</span><span class="special">], </span>close<span class="special">)</span></code></pre>
+<p>will be parsed as expected:<br>将会像下面所期望地那样分析:</p>
+<pre><code> <span class="identifier">open</span> <span class="special">&gt;&gt; (*(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">end</span><span class="special">))[</span><span class="identifier">func</span><span class="special">] &gt;&gt; </span>close</code></pre> <p>The required refactoring is implemented here with the help of the <a href="refactoring.html">Refactoring
-  Parsers</a> too.</p>
-<table width="90%" border="0" align="center">
-  <tr>
- <td colspan="2" class="table_title"><b>Summary of Confix Parser refactorings</b></td> + Parsers</a> too.<br>必要的重构也是借由<a href="refactoring.html">重构分析 器</a>来完成的。</p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td colspan="2" class="table_title"><b>Summary of Confix Parser refactorings 片段分析器重构概览</b></td>
   </tr>
   <tr class="table_title">
-    <td width="40%"><b>You write it as:</b></td>
+    <td width="40%"><b>You write it as: 源代码:</b></td>
<td width="60%"><code><font face="Verdana, Arial, Helvetica, sans-serif">It
-      is refactored to:</font></code></td>
+      is refactored to: 重构为:</font></code></td>
   </tr>
   <tr>
- <td width="40%" class="table_cells"><code>confix_p<span class="special">(</span><span class=identifier>open</span><span class="special">,</span> + <td class="table_cells" width="40%"><code>confix_p<span class="special">(</span><span class="identifier">open</span><span class="special">,</span> expr<span class="special">,</span> close<span class="special">)</span></code></td> - <td width="60%" class="table_cells"> <p><code>open <span class=special>&gt;&gt; - (</span>expr <span class=special>-</span> close<span class=special>)</span><font color="#0000FF">
-        </font><span class=special>&gt;&gt;</span> close</code></p>
+ <td class="table_cells" width="60%"> <p><code>open <span class="special">&gt;&gt; + (</span>expr <span class="special">-</span> close<span class="special">)</span><font color="#0000ff">
+        </font><span class="special">&gt;&gt;</span> close</code></p>
     </td>
   </tr>
   <tr>
- <td width="40%" class="table_cells"><code>confix_p<span class="special">(</span><span class=identifier>open</span><span class="special">,</span> + <td class="table_cells" width="40%"><code>confix_p<span class="special">(</span><span class="identifier">open</span><span class="special">,</span> expr<span class="special">[</span>func<span class="special">],</span> close<span class="special">)</span></code></td> - <td width="60%" class="table_cells"> <p><code>open <span class=special>&gt;&gt; - (</span>expr <span class=special>-</span> close<span class="special">)[</span>func<span class="special">] - <font color="#0000FF" class="special">&gt;&gt;</font></span> close</code></p> + <td class="table_cells" width="60%"> <p><code>open <span class="special">&gt;&gt; + (</span>expr <span class="special">-</span> close<span class="special">)[</span>func<span class="special">] + <font class="special" color="#0000ff">&gt;&gt;</font></span> close</code></p>
     </td>
   </tr>
   <tr>
- <td width="40%" class="table_cells" height="9"><code>confix_p<span class="special">(</span><span class=identifier>open</span><span class="special">, + <td class="table_cells" height="9" width="40%"><code>confix_p<span class="special">(</span><span class="identifier">open</span><span class="special">, *</span>expr<span class="special">,</span> close<span class="special">)</span></code></td> - <td width="60%" class="table_cells" height="9"> <p><code>open <font color="#0000FF"><span class="special">&gt;&gt;</span></font> - <span class="special"><font color="#0000FF" class="special">*</font>(</span>expr - <font color="#0000FF" class="special">-</font> close<span class="special">) - <font color="#0000FF" class="special">&gt;&gt;</font></span> close</code></p> + <td class="table_cells" height="9" width="60%"> <p><code>open <font color="#0000ff"><span class="special">&gt;&gt;</span></font> + <span class="special"><font class="special" color="#0000ff">*</font>(</span>expr + <font class="special" color="#0000ff">-</font> close<span class="special">) + <font class="special" color="#0000ff">&gt;&gt;</font></span> close</code></p>
     </td>
   </tr>
   <tr>
- <td width="40%" class="table_cells"><code>confix_p<span class="special">(</span><span class=identifier>open</span><span class="special">, + <td class="table_cells" width="40%"><code>confix_p<span class="special">(</span><span class="identifier">open</span><span class="special">, (*</span>expr<span class="special">)[</span>func<span class="special">],
       close</span><span class="special">)</span></code></td>
- <td width="60%" class="table_cells"> <p><code>open <font color="#0000FF"><span class="special">&gt;&gt;</span></font><span class="special"> - (<font color="#0000FF" class="special">*</font>(</span>expr <font color="#0000FF" class="special">-</font> - close<span class="special">))[</span>func<span class="special">] <font color="#0000FF" class="special">&gt;&gt;</font></span> + <td class="table_cells" width="60%"> <p><code>open <font color="#0000ff"><span class="special">&gt;&gt;</span></font><span class="special"> + (<font class="special" color="#0000ff">*</font>(</span>expr <font class="special" color="#0000ff">-</font> + close<span class="special">))[</span>func<span class="special">] <font class="special" color="#0000ff">&gt;&gt;</font></span>
         close</code></p>
     </td>
   </tr>
-</table>
-<p><a name="comment_parsers"></a><b>Comment Parsers</b></p>
+</tbody></table>
+<p><a name="comment_parsers"></a><b>Comment Parsers 注释分析器</b></p>
 <p>The Comment Parser generator template <tt>comment_p</tt>
is helper for generating a correct <a href="#confix_parser">Confix Parser</a> - from auxiliary parameters, which is able to parse comment constructs as follows: + from auxiliary parameters, which is able to parse comment constructs as follows:<br>注释分析器生成器模板 <tt>comment_p</tt>&nbsp;是一个用于从附加的 参数生成正确的<a href="#confix_parser">片段分析器</a>的辅助生成器,它可以正 确分析类似下面结构的注释:
 </p>
<pre><code> StartCommentToken <span class="special">&gt;&gt;</span> Comment text <span class="special">&gt;&gt;</span> EndCommentToken</code></pre>
 <p>There are the following types supported as parameters: parsers, single
   characters and strings (see as_parser). If it
is used with one parameter, a comment starting with the given first parser parameter up to the end of the line is matched. So for instance the following
-  parser matches C++ style comments:</p>
-
-<pre><code><span class=identifier> comment_p</span><span class=special>(</span><span class=string>"//"</span><span class=special>)</span></code></pre> + parser matches C++ style comments:<br>参数可以是如下类型:分析器、单个字 符和字符串(见as_parser)。如果只有一个参数,那么就认为一个注释就从给定的参数 开始直到一行的结束。所以,例如下面的分析器就匹配C++风格的注释:</p>
+
+<pre><code><span class="identifier"> comment_p</span><span class="special">(</span><span class="string">"//"</span><span class="special">)</span></code></pre> <p>If it is used with two parameters, a comment starting with the first parser parameter up to the second parser parameter is matched. For instance a C style
-  comment parser could be constrcuted as:</p>
-<pre><code> <span class=identifier>comment_p</span><span class=special>(</span><span class=string>"/*"</span><span class=special>, </span><span class=string>"*/"</span><span class=special>)</span></code></pre> + comment parser could be constrcuted as:<br>如果使用两个参数,则一个注释从 第一个参数开始,直到匹配了第二个参数才结束。比如C风格的注释就可以构造如 下:</p> +<pre><code> <span class="identifier">comment_p</span><span class="special">(</span><span class="string">"/*"</span><span class="special">, </span><span class="string">"*/"</span><span class="special">)</span></code></pre> <p>The <tt>comment_p</tt> parser generator allows to generate parsers for matching non-nested comments (as for C/C++ comments). Sometimes it is necessary to parse
-  nested comments as for instance allowed in Pascal.</p>
+ nested comments as for instance allowed in Pascal.<br><tt>comment_p</tt><span style="font-family: Courier New;">&nbsp;</span>生成器允许生成非嵌套的注释(就像C/C++的注释)。有时需要分 析嵌套的注释,就像下面给出的Pascal里的:</p> <pre><code class="comment"> { This is a { nested } PASCAL-comment }</code></pre>
 <p>Such nested comments are
parseable through parsers generated by the <tt>comment_nest_p</tt> generator template functor. The following example shows a parser, which can be used for
-  parsing the two different (nestable) Pascal comment styles:</p>
-<pre><code> <span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>pascal_comment - </span><span class=special>= </span><span class=identifier>comment_nest_p</span><span class=special>(</span><span class=string>"(*"</span><span class=special>, </span><span class=string>"*)"</span><span class=special>) - | </span><span class=identifier>comment_nest_p</span><span class=special>(</span><span class=literal>'{'</span><span class=special>, </span><span class=literal>'}'</span><span class=special>)
-        ;</span></code></pre>
+ parsing the two different (nestable) Pascal comment styles:<br>这样的嵌套 注释可以用生成器模板仿函数&nbsp;<tt>comment_nest_p</tt><span style="font-family: Courier New;"></span> 所生成的分析器分析。下面的例子给出 了一个分析器,它可以用于分析两种不同风格(可嵌套)的Pascal注释:</p> +<pre><code> <span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">pascal_comment<br> </span><span class="special">= </span><span class="identifier">comment_nest_p</span><span class="special">(</span><span class="string">"(*"</span><span class="special">, </span><span class="string">"*)"</span><span class="special">)<br> | </span><span class="identifier">comment_nest_p</span><span class="special">(</span><span class="literal">'{'</span><span class="special">, </span><span class="literal">'}'</span><span class="special">)<br> ;</span></code></pre> <p>Please note, that a comment is parsed implicitly as if the whole <tt>comment_p(...)</tt> statement were embedded into a <tt>lexeme_d[]</tt> directive, i.e. during parsing of a comment no token skipping will occur, even if you've defined a skip parser
-for your whole parsing process.</p>
-<p> <img height="16" width="15" src="theme/lens.gif"> <a href="../example/fundamental/comments.cpp">comments.cpp</a> demonstrates various comment parsing schemes: </p> +for your whole parsing process.<br>请注意,这样分析的注释暗示着类似把整个 <span style="font-family: Courier New;"> </span><tt>comment_p(...)</tt><span style="font-family: Courier New;">&nbsp;</span>语句放到一个 <tt>lexeme_d[]</tt>&nbsp;里面,举例而言,在 整个分析注释的过程中,将不会有忽略符号的情况发生,即使你已经为你的整个分析过 程指定了忽略分析器。</p> +<p> <img src="theme/lens.gif" height="16" width="15"> <a href="../example/fundamental/comments.cpp">comments.cpp</a> demonstrates various comment parsing schemes:<br><img src="theme/lens.gif" height="16" width="15">&nbsp;<a href="../example/fundamental/comments.cpp">comments.cpp</a> 给出了各种各样的 注释分析方案:</p>
 <ol>
-  <li>Parsing of different comment styles  </li>
+  <li>Parsing of different comment styles<br>分析不同风格的注释  </li>
   <ul>
-    <li>parsing C/C++-style comment</li>
-    <li>parsing C++-style comment</li>
-    <li>parsing PASCAL-style comment</li>
+    <li>parsing C/C++-style comment<br>分析C/C++风格的注释</li>
+    <li>parsing C++-style comment<br>分析C++风格的注释</li>
+    <li>parsing PASCAL-style comment<br>分析PASCAL风格的注释</li>
   </ul>
-  <li>Parsing tagged data with the help of the confix_parser</li>
- <li>Parsing tagged data with the help of the confix_parser but the semantic<br>
-  action is directly attached to the body sequence parser</li>
+ <li>Parsing tagged data with the help of the confix_parser<br>借助 confix_parser 分析标记语言的数据</li> + <li>Parsing tagged data with the help of the confix_parser but the semantic action is directly attached to the body sequence parser<br>借助 confix_parser分析标记语言的数据,但语义动作直接挂接到片段的内容上</li>
 </ol>
-<p>This is part of the Spirit distribution.</p>
+<p>This is part of the Spirit distribution.<br>这是Spirit发布包的组成部分。 </p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="character_sets.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="list_parsers.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2001-2002 Hartmut Kaiser<br>
+<p class="copyright">Copyright © 2001-2002 Hartmut Kaiser<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/distinct.html        Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/distinct.html        Sun Sep 20 23:13:57 2009
@@ -1,122 +1,98 @@
-<html>
-<head>
-<!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
-<title>Distinct Parser</title>
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
+
+
+<title>Distinct Parser</title><link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" height="48" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" height="48" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
     <td width="85%">
- <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Distinct Parser </b></font></td> + <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Distinct Parser 区分分析器 </b></font></td> <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="scoped_lock.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="symbols.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<h3>Distinct Parsers</h3><p>
+</tbody></table>
+<h3>Distinct Parsers 区分分析器</h3><p>
 The distinct parsers are utility parsers which ensure that matched input is
 not immediately followed by a forbidden pattern. Their typical usage is to
-distinguish keywords from identifiers.</p>
+distinguish keywords from identifiers.<br>区分分析器是一个工具分析器,它确 保被匹配的输入没有被一个禁止的模式所跟随。它们的典型用途是区分关键字和标识 符。</p>
 <h3>distinct_parser</h3>
 <p>
The basic usage of the <tt>distinct_parser</tt> is to replace the <tt>str_p</tt> parser. For
-example the <tt>declaration_rule</tt> in the following example:</p>
-<pre>
- <code><span class=identifier>rule</span><span class=special>&lt;</span><span class="identifier">ScannerT</span><span class=special>&gt; </span><span class=identifier>declaration_rule </span><span class=special>= </span><span class=identifier>str_p</span><span class=special>(</span><span class=string>&quot;declare&quot;</span><span class=special>) &gt;&gt; </span><span class=identifier>lexeme_d</span><span class=special>[+</span><span class=identifier>alpha_p</span><span class=special>];
-</span></code></pre>
+example the <tt>declaration_rule</tt> in the following example:<br><tt>distinct_parser</tt> 的基本用途是替换 <tt>str_p</tt> 分析 器。例如,以下例子中的 <tt>declaration_rule</tt>&nbsp;:</p> +<pre> <code><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">declaration_rule </span><span class="special">= </span><span class="identifier">str_p</span><span class="special">(</span><span class="string">"declare"</span><span class="special">) &gt;&gt; </span><span class="identifier">lexeme_d</span><span class="special">[+</span><span class="identifier">alpha_p</span><span class="special">];<br></span></code></pre>
 <p>
-would correctly match an input &quot;declare abc&quot;, but as well an input&quot;declareabc&quot; what is usually not intended. In order to avoid this, we can
-use <tt>distinct_parser</tt>:</p>
+would correctly match an input "declare abc", but as well an
+input"declareabc" what is usually not intended. In order to avoid this,
+we can
+use <tt>distinct_parser</tt>:<br>可以正确地匹配输入 "declare abc",也可能匹 配 "declareabc",但这通常不是想要的。 为了避免这种情况,我们可以使用 &nbsp;<tt>distinct_parser</tt>:</p>
 <code>
-<pre>
-    <span class=comment>// keyword_p may be defined in the global scope
- </span><span class=identifier>distinct_parser</span><span class=special>&lt;&gt; </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=string>&quot;a-zA-Z0-9_&quot;</span><span class=special>);
-
- </span><span class=identifier>rule</span><span class=special>&lt;</span><span class="identifier">ScannerT</span><span class=special>&gt; </span><span class=identifier>declaration_rule </span><span class=special>= </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=string>&quot;declare&quot;</span><span class=special>) &gt;&gt; </span><span class=identifier>lexeme_d</span><span class=special>[+</span><span class=identifier>alpha_p</span><span class=special>];
-</span></pre>
-</code>
+</code><pre> <span class="comment">// keyword_p may be defined in the global scope keyword_p可以在全局范围内定义<br> </span><span class="identifier">distinct_parser</span><span class="special">&lt;&gt; </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="string">"a-zA-Z0-9_"</span><span class="special">);<br><br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">declaration_rule </span><span class="special">= </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="string">"declare"</span><span class="special">) &gt;&gt; </span><span class="identifier">lexeme_d</span><span class="special">[+</span><span class="identifier">alpha_p</span><span class="special">];<br></span></pre>
+
 <p>
The <tt>keyword_p</tt> works in the same way as the <tt>str_p</tt> parser but matches only
 when the matched input is not immediately followed by one of the characters
from the set passed to the constructor of <tt>keyword_p</tt>. In the example the -&quot;declare&quot; can't be immediately followed by any alphabetic character, any
-number or an underscore.</p>
+"declare" can't be immediately followed by any alphabetic character, any
+number or an underscore.<br><tt>keyword_p</tt> 的用法与 <tt>str_p</tt> 分析 器相同,但仅当被匹配的输入不是被传给 <tt>keyword_p</tt> 的构造函数的字符集中 的某个字符所紧随时,才匹配成功。在本例中,"declare" 不能被任何字母、数字或下 划线所紧随。</p>
 <p>
-See the full <a href="../example/fundamental/distinct/distinct_parser.cpp">example here </a>.</p> +See the full <a href="../example/fundamental/distinct/distinct_parser.cpp">example here </a>.<br>完整的<a href="../example/fundamental/distinct/distinct_parser.cpp">例子在此</a>。 </p>
 <h3>distinct_directive</h3><p>
 For more sophisticated cases, for example when keywords are stored in a
-symbol table, we can use <tt>distinct_directive</tt>.</p>
-<pre>
- <code><span class=identifier>distinct_directive</span><span class=special>&lt;&gt; </span><span class=identifier>keyword_d</span><span class=special>(</span><span class=string>&quot;a-zA-Z0-9_&quot;</span><span class=special>);
-
- </span><span class=identifier>symbol</span><span class=special>&lt;&gt; </span><span class=identifier>keywords </span><span class=special>= </span><span class=string>&quot;declare&quot;</span><span class=special>, </span><span class=string>&quot;begin&quot;</span><span class=special>, </span><span class=string>&quot;end&quot;</span><span class=special>; - </span><span class=identifier>rule</span><span class=special>&lt;</span><span class="identifier">ScannerT</span><span class=special>&gt; </span><span class=identifier>keyword </span><span class=special>= </span><span class=identifier>keyword_d</span><span class=special>[</span><span class=identifier>keywords</span><span class=special>];
-</span></code></pre>
+symbol table, we can use <tt>distinct_directive</tt>.<br>对于更复杂的情 况,例如当关键字被保存在一个符号表中时,我们可以使用 <tt>distinct_directive</tt>。</p> +<pre> <code><span class="identifier">distinct_directive</span><span class="special">&lt;&gt; </span><span class="identifier">keyword_d</span><span class="special">(</span><span class="string">"a-zA-Z0-9_"</span><span class="special">);<br><br> </span><span class="identifier">symbol</span><span class="special">&lt;&gt; </span><span class="identifier">keywords </span><span class="special">= </span><span class="string">"declare"</span><span class="special">, </span><span class="string">"begin"</span><span class="special">, </span><span class="string">"end"</span><span class="special">;<br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">keyword </span><span class="special">= </span><span class="identifier">keyword_d</span><span class="special">[</span><span class="identifier">keywords</span><span class="special">];<br></span></code></pre>
 <h3>dynamic_distinct_parser and dynamic_distinct_directive</h3><p>
 In some cases a set of forbidden follow-up characters is not sufficient.
 For example ASN.1 naming conventions allows identifiers to contain dashes,
 but not double dashes (which marks the beginning of a comment).
 Furthermore, identifiers can't end with a dash. So, a matched keyword can't
 be followed by any alphanumeric character or exactly one dash, but can be
-followed by two dashes.</p>
+followed by two dashes.<br>有些情况下,只有一组被禁用的跟随字符是不够的。例 如,ASN.1 命名约定允许标识符带有破折号,但不允许双划线(这标志着一个注释的开 始)。此外,标识符不能以破折号结束。所以,一个被匹配的关键字不能后随任何字母 数字和单一个破折号,但可以后随两个破折号。</p>
 <p>
This is when <tt>dynamic_distinct_parser</tt> and the <tt>dynamic_distinct_directive </tt>come into play. The constructor of the <tt>dynamic_distinct_parser</tt> accepts a -parser which matches any input that <strong>must NOT</strong> follow the keyword.</p>
-<pre>
- <code><span class=comment>// Alphanumeric characters and a dash followed by a non-dash
-    // may not follow an ASN.1 identifier.
- </span><span class=identifier>dynamic_distinct_parser</span><span class=special>&lt;&gt; </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=identifier>alnum_p </span><span class=special>| (</span><span class=literal>'-' </span><span class=special>&gt;&gt; ~</span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'-'</span><span class=special>)));
-
- </span><span class=identifier>rule</span><span class=special>&lt;</span><span class="identifier">ScannerT</span><span class=special>&gt; </span><span class=identifier>declaration_rule </span><span class=special>= </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=string>&quot;declare&quot;</span><span class=special>) &gt;&gt; </span><span class=identifier>lexeme_d</span><span class=special>[+</span><span class=identifier>alpha_p</span><span class=special>];
-</span></code></pre>
+parser which matches any input that <strong>must NOT</strong> follow the keyword.<br>这就是 <tt>dynamic_distinct_parser</tt> 和 <tt>dynamic_distinct_directive </tt>大显身手的时候了。 <tt>dynamic_distinct_parser</tt> 的构造函数接受一个分析器,用于匹配 <strong>不能</strong>跟在该关键字之后的任意输入。</p> +<pre> <code><span class="comment">// Alphanumeric characters and a dash followed by a non-dash<br> // may not follow an ASN.1 identifier.<br> </span><span class="identifier">dynamic_distinct_parser</span><span class="special">&lt;&gt; </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="identifier">alnum_p </span><span class="special">| (</span><span class="literal">'-' </span><span class="special">&gt;&gt; ~</span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'-'</span><span class="special">)));<br><br> </span><span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">ScannerT</span><span class="special">&gt; </span><span class="identifier">declaration_rule </span><span class="special">= </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="string">"declare"</span><span class="special">) &gt;&gt; </span><span class="identifier">lexeme_d</span><span class="special">[+</span><span class="identifier">alpha_p</span><span class="special">];<br></span></code></pre>
 <p>
Since the <tt>dynamic_distinct_parser</tt> internally uses a rule, its type is dependent on the scanner type. So, the <tt>keyword_p</tt> shouldn't be defined
-globally, but rather within the grammar.</p>
+globally, but rather within the grammar.<br>由于 <tt>dynamic_distinct_parser</tt> 在内部使用了一个规则,所以它的类型依赖于扫 描器的类型。因此,<tt>keyword_p</tt> 不能在全局被定义,而应在语法内部。</p>
 <p>
-See the full <a href="../example/fundamental/distinct/distinct_parser_dynamic.cpp">example here</a>.</p>
-<h3>How it works</h3><p>
-When the <tt>keyword_p_1</tt> and the <tt>keyword_p_2</tt> are defined as</p>
-<code><pre>
- <span class=identifier>distinct_parser</span><span class=special>&lt;&gt; </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=identifier>forbidden_chars</span><span class=special>); - </span><span class=identifier>distinct_parser_dynamic</span><span class=special>&lt;&gt; </span><span class=identifier>keyword_p</span><span class=special>(</span><span class=identifier>forbidden_tail_parser</span><span class=special>);
-</span></pre></code>
+See the full <a href="../example/fundamental/distinct/distinct_parser_dynamic.cpp">example here</a>.<br>完整的<a href="../example/fundamental/distinct/distinct_parser_dynamic.cpp">例子在此 </a>。</p>
+<h3>How it works 它是如何工作的</h3><p>
+When the <tt>keyword_p_1</tt> and the <tt>keyword_p_2</tt> are defined as<br>当 <tt>keyword_p_1</tt> 和 <tt>keyword_p_2</tt> 被定义为</p> +<code></code><pre> <span class="identifier">distinct_parser</span><span class="special">&lt;&gt; </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="identifier">forbidden_chars</span><span class="special">);<br> </span><span class="identifier">distinct_parser_dynamic</span><span class="special">&lt;&gt; </span><span class="identifier">keyword_p</span><span class="special">(</span><span class="identifier">forbidden_tail_parser</span><span class="special">);<br></span></pre>
 <p>
-the parsers</p>
-<code><pre>
- <span class=identifier>keyword_p_1</span><span class=special>(</span><span class=identifier>str</span><span class=special>) - </span><span class=identifier>keyword_p_2</span><span class=special>(</span><span class=identifier>str</span><span class=special>)
-</span></pre></code>
+the parsers<br>分析器</p>
+<code></code><pre> <span class="identifier">keyword_p_1</span><span class="special">(</span><span class="identifier">str</span><span class="special">)<br> </span><span class="identifier">keyword_p_2</span><span class="special">(</span><span class="identifier">str</span><span class="special">)<br></span></pre>
 <p>
-are equivalent to the rules</p>
-<code><pre>
- <span class=identifier>lexeme_d</span><span class=special>[</span><span class=identifier>chseq_p</span><span class=special>(</span><span class=identifier>str</span><span class=special>) &gt;&gt; ~</span><span class=identifier>epsilon_p</span><span class=special>(</span><span class=identifier>chset_p</span><span class=special>(</span><span class=identifier>forbidden_chars</span><span class=special>))] - </span><span class=identifier>lexeme_d</span><span class=special>[</span><span class=identifier>chseq_p</span><span class=special>(</span><span class=identifier>str</span><span class=special>) &gt;&gt; ~</span><span class=identifier>epsilon_p</span><span class=special>(</span><span class=identifier>forbidden_tail_parser</span><span class=special>)]
-</span></pre></code>
+are equivalent to the rules<br>相当于规则</p>
+<code></code><pre> <span class="identifier">lexeme_d</span><span class="special">[</span><span class="identifier">chseq_p</span><span class="special">(</span><span class="identifier">str</span><span class="special">) &gt;&gt; ~</span><span class="identifier">epsilon_p</span><span class="special">(</span><span class="identifier">chset_p</span><span class="special">(</span><span class="identifier">forbidden_chars</span><span class="special">))]<br> </span><span class="identifier">lexeme_d</span><span class="special">[</span><span class="identifier">chseq_p</span><span class="special">(</span><span class="identifier">str</span><span class="special">) &gt;&gt; ~</span><span class="identifier">epsilon_p</span><span class="special">(</span><span class="identifier">forbidden_tail_parser</span><span class="special">)]<br></span></pre>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="scoped_lock.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="symbols.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003-2004
+<p class="copyright">Copyright © 2003-2004


  Vaclav Vesely<br><br>
- <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+ <font size="2">Use,
+modification and distribution is subject to the Boost Software License,
+Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt) </font>  </p>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/dynamic_parsers.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/dynamic_parsers.html Sun Sep 20 23:13:57 2009
@@ -1,95 +1,102 @@
-<html>
-<head>
-<title>Dynamic Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Dynamic Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Dynamic
-      Parsers </b></font></td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Dynamic
+      Parsers 动态分析器 </b></font></td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="closures.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="stored_rule.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<p>We see dynamic parsing everywhere in Spirit. A special group of parsers, aptly named dynamic parsers, form the most basic building blocks to dynamic parsing. This chapter focuses on these critters. You'll notice the similarity of these parsers with C++'s control structures. The similarity is not a coincidence. These parsers give an imperative flavor to parsing, and, since imperative constructs are not native to declarative EBNF, mimicking the host language, C++, should make their use immediately familiar. </p>
+</tbody></table>
+<p>We see dynamic parsing everywhere in Spirit. A special group of
+parsers, aptly named dynamic parsers, form the most basic building
+blocks to dynamic parsing. This chapter focuses on these critters.
+You'll notice the similarity of these parsers with C++'s control
+structures. The similarity is not a coincidence. These parsers give an
+imperative flavor to parsing, and, since imperative constructs are not
+native to declarative EBNF, mimicking the host language, C++, should
+make their use immediately familiar.<br>在Spirit中动态分析随处可见。有一组 特别的分析器,被恰当地命名为动态分析器,组成了动态分析中最基本的成分。这章的 焦点集中于这些关键要素 +上。你将看到这些分析器和C++控制结构的相似性。但相似性并非一致性。这些分析器 带来了指令式分析,并且,由于指令式结构并非声明式的EBNF的特征,而是
+模仿宿主语言C++,将使这些分析器的使用方法能够被迅速熟悉。</p>
<p>Dynamic parsers modify the parsing behavior according to conditions. Constructing dynamic parsers requires a condition argument and a body parser argument. Additional
-    arguments are required by some parsers.</p>
-<h2>Conditions</h2>
+ arguments are required by some parsers.<br>动态分析器通过条件改变分析行 为。构造动态分析器需要一个条件参数和一个分析器体参数。某些分析器需要更多的参 数。</p>
+<h2>Conditions 条件</h2>
<p>Functions or functors returning values convertable to bool can be used as conditions. When the evaluation of the function/functor yields true it will be considered
-  as meeting the condition.</p>
+ as meeting the condition.<br>其返回值可以转换为bool型的函数或仿函数可以被 用作条件。当函数/仿函数的演算值为真时,则认为条件被符合。
+</p>
<p>Parsers can be used as conditions, as well. When the parser matches the condition is met. Parsers used as conditions work in an all-or-nothing manner: the scanner
-  will not be advanced when they don't match.</p>
-<p>A failure to meet the condition will not result in a parse error.</p>
+ will not be advanced when they don't match.&nbsp;<br>分析器也可以作为条件 使用。当分析器匹配时,认为条件被符合。被当成条件使用的分析器以一种"零或全 部"的行为工作:当不匹配时,扫描器不会前进。</p> +<p>A failure to meet the condition will not result in a parse error.<br>失 败的条件匹配不会引起分析错误。</p>
 <h2>if_p</h2>
-<p><tt>if_p</tt> can be used with or without an else-part. The syntax is:</p> -<pre> <span class=identifier>if_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>then</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre>
-<p><span class=special></span>or</p>
-<pre><span class=identifier> if_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>then</span><span class=special>-</span><span class=identifier>parser</span><span class=special>].</span><span class=identifier>else_p</span><span class=special>[</span><span class="identifier">else</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre> +<p><tt>if_p</tt> can be used with or without an else-part. The syntax is:<br><tt>if_p</tt>&nbsp;<span style="font-family: Courier New;">的 else 部 分可有可无。它的语法为:</span></p> +<pre> <span class="identifier">if_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">then</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre>
+<p><span class="special"></span>or<br>或</p>
+<pre><span class="identifier"> if_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">then</span><span class="special">-</span><span class="identifier">parser</span><span class="special">].</span><span class="identifier">else_p</span><span class="special">[</span><span class="identifier">else</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre> <p>When the condition is met the then-parser is used next in the parsing process. When the condition is not met and an else-parser is available the else-parser is used next. When the condition isn't met and no else-parser is available then - the whole parser matches the empty sequence. (<img src="theme/alert.gif" width="16" height="16"> + the whole parser matches the empty sequence. (<img src="theme/alert.gif" height="16" width="16"> Note: older versions of <tt>if_p</tt> report a failure when the condition isn't
-  met and no else-parser is available.)</p>
-<p>Example:</p>
-<pre> <span class=special></span><span class=identifier>if_p</span><span class=special>(</span><span class=string>&quot;0x&quot;</span><span class=special>)[</span><span class=identifier>hex_p</span><span class=special>].</span><span class=identifier>else_p</span><span class=special>[</span><span class=identifier>uint_p</span><span class=special>]</span></pre> + met and no else-parser is available.)<br>当条件匹配时,then-分析器将被用 于下一步的分析过程。当条件不匹配且else-分析器存在时,else-分析器被接着调用。 当条件不匹配而else-分析器也不存在时,那么整个分析器将匹配空序列(<img src="theme/alert.gif" height="16" width="16">注意:老版本的 <tt>if_p</tt>&nbsp;在条件不匹配且没有else-分析器时会报告一个失败)。</p>
+<p>Example:<br>例如:</p>
+<pre> <span class="special"></span><span class="identifier">if_p</span><span class="special">(</span><span class="string">"0x"</span><span class="special">)[</span><span class="identifier">hex_p</span><span class="special">].</span><span class="identifier">else_p</span><span class="special">[</span><span class="identifier">uint_p</span><span class="special">]</span></pre>
 <h2>while_p, do_p</h2>
-<p><tt>while_p</tt>/<tt>do_p</tt> syntax is:</p>
-<pre> <span class=identifier>while_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>] - </span><span class=identifier>do_p</span><span class=special>[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>].</span><span class=identifier>while_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)</span></pre> +<p><tt>while_p</tt>/<tt>do_p</tt> syntax is:<br><tt>while_p</tt>/<tt>do_p</tt> 的语法为:</p> +<pre> <span class="identifier">while_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]<br> </span><span class="identifier">do_p</span><span class="special">[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">].</span><span class="identifier">while_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)</span></pre> <p>As long as the condition is met the dynamic parser constructed by <tt>while_p</tt> will try to match the body-parser. <tt>do_p</tt> returns a parser that tries to match the body-parser and then behaves just like the parser returned by <tt>while_p</tt>. A failure to match the body-parser will cause a failure to be reported by the
-  while/do-parser.</p>
-<p>Example:</p>
-<pre><span class=special> </span><span class=identifier>uint_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>sum</span><span class=special>)] &gt;&gt; </span><span class=identifier>while_p</span><span class=special>(</span><span class=literal>'+'</span><span class=special>)[</span><span class=identifier>uint_p</span><span class=special>(</span><span class=identifier>add</span><span class=special>(</span><span class=identifier>sum</span><span class=special>)] - </span><span class=literal>'&quot;' </span><span class=special>&gt;&gt; </span><span class="identifier">while_p</span><span class=special>(~</span><span class=identifier>eps_p</span><span class=special>(</span><span class=literal>'&quot;'</span><span class=special>))[</span><span class=identifier>c_escape_ch_p</span><span class=special>[</span><span class=identifier>push_back_a</span><span class=special>(</span><span class=identifier>result</span><span class=special>)]] &gt;&gt; </span><span class=literal>'&quot;'</span> + while/do-parser.<br>只要条件匹配,由 <tt>while_p</tt>&nbsp;构造的动态分析 器将一直尝试匹配body-分析器。<tt>do_p</tt>&nbsp;<span style="font-family: Courier New;">则返回一个首先尝试匹配body-分析器,接着就干和<span style="font-family: Courier New;"></span></span> <tt>while_p</tt>&nbsp;<span style="font-family: Courier New;"><span style="font-family: Courier New;">一样的事情的分析器。body-分析器的匹配失败 将导致while/do-分析器报告一个失败。</span></span></p>
+<p>Example:<br>例如:</p>
+<pre><span class="special"> </span><span class="identifier">uint_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)] &gt;&gt; </span><span class="identifier">while_p</span><span class="special">(</span><span class="literal">'+'</span><span class="special">)[</span><span class="identifier">uint_p</span><span class="special">(</span><span class="identifier">add</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)]<br> </span><span class="literal">'"' </span><span class="special">&gt;&gt; </span><span class="identifier">while_p</span><span class="special">(~</span><span class="identifier">eps_p</span><span class="special">(</span><span class="literal">'"'</span><span class="special">))[</span><span class="identifier">c_escape_ch_p</span><span class="special">[</span><span class="identifier">push_back_a</span><span class="special">(</span><span class="identifier">result</span><span class="special">)]] &gt;&gt; </span><span class="literal">'"'</span>
 </pre>
 <h2>for_p</h2>
-<p><tt>for_p</tt> requires four arguments. The syntax is:</p>
-<pre> <span class=literal></span><span class=identifier>for_p</span><span class=special>(</span><span class=identifier>init</span><span class=special>, </span><span class=identifier>condition</span><span class=special>, </span><span class=identifier>step</span><span class=special>)[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre> +<p><tt>for_p</tt> requires four arguments. The syntax is:<br><tt>for_p</tt> 需要四个参数。其语法为:</p> +<pre> <span class="literal"></span><span class="identifier">for_p</span><span class="special">(</span><span class="identifier">init</span><span class="special">, </span><span class="identifier">condition</span><span class="special">, </span><span class="identifier">step</span><span class="special">)[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre> <p>init and step have to be 0-ary functions/functors. for_p returns a parser that
-  will:</p>
+  will:<br>init 和 step 必须是无参数函数/仿函数。for_p 返回的分析器将:</p>
 <ol>
-  <li> call init</li>
- <li>check the condition, if the condition isn't met then a match is returned. The match will cover everything that has been matched successfully up to this point.</li> - <li> tries to match the body-parser. A failure to match the body-parser will cause a failure to be reported by the for-parser</li>
-  <li> calls step</li>
-  <li> goes to 2.</li>
+  <li> call init<br>调用 init</li>
+  <li>check the condition, if the
+condition isn't met then a match is returned. The match will cover
+everything that has been matched successfully up to this point.<br>检查条 件,如果条件不符合则返回一个匹配,这个匹配覆盖着到目前为止所匹配的所有东 西。 </li> + <li> tries to match the body-parser. A failure to match the body-parser will cause a failure to be reported by the for-parser<br>尝试匹配body-分析 器,body-分析器匹配失败会使for-分析器报告失败。</li>
+  <li> calls step<br>调用 step</li>
+  <li> goes to 2.<br>转至步骤2。</li>
 </ol>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="closures.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="stored_rule.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2002-2003 Joel de Guzman<br>
-  Copyright &copy; 2002-2003 Martin Wille<br>
+<p class="copyright">Copyright © 2002-2003 Joel de Guzman<br>
+  Copyright © 2002-2003 Martin Wille<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/escape_char_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/escape_char_parser.html Sun Sep 20 23:13:57 2009
@@ -1,58 +1,57 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Escape Character Parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="theme/style.css" rel="stylesheet" type="text/css">
-</head>
+<html><head>
+
+<title>Escape Character Parser</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="theme/style.css" rel="stylesheet" type="text/css"></head>

 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
- <td width="10" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>&nbsp;</b></font></td> - <td width="85%" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Escape Character Parser</b></font></td> - <td width="112" height="49"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
+ <td height="49" width="10"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>&nbsp;</b></font></td> + <td height="49" width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Escape Character Parser 转义字符分析器 </b></font></td> + <td height="49" width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> <td width="30"><a href="loops.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<p><a name="escape_char_parser"></a>The Escape Character Parser is a utility
-  parser, which parses escaped character sequences used in C/C++,
- LEX or Perl regular expressions. Combined with the confix_p utility parser, it is useful for parsing C/C++ strings containing double quotes and other escaped
-  characters:</p>
+</tbody></table>
+<p><a name="escape_char_parser"></a>The Escape Character Parser is a
+utility parser, which parses escaped character sequences used in C/C++,
+LEX or Perl regular expressions. Combined with the confix_p utility
+parser, it is useful for parsing C/C++ strings containing double quotes
+and other escaped characters:<br>转义字符分析器属于工具分析器,用于分析 C/C++、LEX 或 Perl 正则表达式中的转义字符串。将之与 confix_p 工具分析器共同 使用,在分析 C/C++ 中由引号引起的字符串方面很有用。</p> <pre> confix_p<span class="special">(</span><em class="literal">'"'</em><span class="special">,</span> <span class="special">*</span>c_escape_ch_p<span class="special">,</span> <em><span class="literal">'"</span></em><span class="literal"><em>'</em></span><span class="special">)</span></pre>
 <p>There are two different types of the Escape Character Parser:
<tt>c_escape_ch_p</tt>, which parses C/C++ escaped character sequences and <tt>lex_escape_ch_p</tt>, which parses LEX style escaped character sequences. The following table shows the valid character sequences understood by these
-  utility parsers.</p>
-<table width="90%" border="0" align="center">
-  <tr>
+ utility parsers.<br>有两种不同的转义字符分析 器:<tt>c_escape_ch_p</tt><span style="font-family: Courier New;">,分析 C/C++ 转移字符串,和 </span><tt>lex_escape_ch_p</tt><span style="font-family: Courier New;">,分析 LEX 风格的转移字符串。下面的表格说 明了这些工具分析器所能有效识别的转移字符串。</span></p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
<td colspan="2" class="table_title"><b>Summary of valid escaped character
-      sequences</b></td>
+      sequences 有效转义字符序列概览</b></td>
   </tr>
   <tr>
- <td width="29%" height="27" class="table_cells"><b>c_escape_ch_p</b></td> - <td width="71%" class="table_cells"><p><code>\b, \t, \n, \f, \r, \\, \&quot;, + <td class="table_cells" height="27" width="29%"><b>c_escape_ch_p</b></td> + <td class="table_cells" width="71%"><p><code>\b, \t, \n, \f, \r, \\, \",
         \', \xHH, \OOO</code><br>
where: H is some hexadecimal digit (0..9, a..f, A..F) and O is some octal
-        digit (0..7)</p></td>
+ digit (0..7)</p><p>其中:H 是十六进制数字(0..9, a..f, A..F) 而 O 是 八进制数字(0..7)</p></td>
   </tr>
   <tr>
- <td height="27" class="table_cells"><strong>lex_escape_ch_p</strong></td> + <td class="table_cells" height="27"><strong>lex_escape_ch_p</strong></td>
     <td class="table_cells">
<p>all C/C++ escaped character sequences as described above and additionally
-        any other character, which follows a backslash</p>
+ any other character, which follows a backslash<br>上面的所有C/C++转 移字符串,以及紧随反斜线的任意字符</p>
     </td>
   </tr>
-</table>
+</tbody></table>
<p>If there is a semantic action attached directly to the Escape Character Parser,
   all valid escaped characters are converted to their character equivalent
   (i.e. a backslash followed by a 'r' is converted to '\r'), which is
@@ -61,28 +60,32 @@
   overflow will be detected and will generate a non-match.  lex_escape_ch_p
   will strip the leading backslash for all character
sequences which are not listed as valid C/C++ escape sequences when passing
-  the unescaped character to an attached action.</p>
+  the unescaped character to an attached action.<br>如
+果有语义动作挂接在转移字符分析器上,被传递给挂接的动作器的所有的有效转义字 符将被转换成与之等价的实际字符(比如一个反斜线后面跟着一个'r'将被转 +换为'\r')。所分析出的十六进制或者八进制数值的个数将取决于输入字符的尺寸。 而溢出将被检测到并且引发一个匹配失败。
+lex_escape_ch_p
+在分析尚未分析的字符并传递给语义动作时,对所有带反斜线但不是C/C++中有效的转 移字符串的字符串,将忽略开头的反斜
+线。</p>
 <p>Please note though, that if there is a semantic action attached to an
outermost parser (for instance as in <tt>(*c_escape_ch_p)[some_actor]</tt>, where the action is attached to the kleene star generated parser) no conversion takes place at the moment, but nevertheless the escaped characters are parsed - correctly. This limitation will be removed in a future version of the library.</p> + correctly. This limitation will be removed in a future version of the library.<br>请注意,如果语义动作挂接在最外围的分析器上(比如类似 <tt>(*c_escape_ch_p)[some_actor]</tt>,语义动作挂接在克林星分析器上)将不会 产生字符的转换,取而代之的是直接把字符串传递给语义动作。这个限制在以后的版本 中将被清除。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> <td width="30"><a href="loops.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>

 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2001-2002 Daniel C. Nuffer<br>
-Copyright &copy; 2003 Hartmut Kaiser <br>
+<p class="copyright">Copyright © 2001-2002 Daniel C. Nuffer<br>
+Copyright © 2003 Hartmut Kaiser <br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/functional.html      Sat Sep 12 00:52:19 2009
+++ /trunk/libs/spirit/classic/doc/functional.html      Sun Sep 20 23:13:57 2009
@@ -1,265 +1,242 @@
-<html>
-<head>
-<title>Functional</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><title>Functional</title>
+
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
-    <td width="10">
-    </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Functional</b></font>
-    </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
-  </tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+<tbody>
+<tr>
+<td width="10"> </td>
+<td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Functional
+函数式</b></font> </td>
+<td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
+</tr>
+</tbody>
 </table>
 <br>
 <table border="0">
-  <tr>
-    <td width="10"></td>
- <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> - <td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td>
-  </tr>
+<tbody>
+<tr>
+<td width="10"></td>
+<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> +<td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> +<td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td>
+</tr>
+</tbody>
 </table>
-<p>If you look more closely, you'll notice that Spirit is all about composition - of <i>parser functions</i>. A parser is just a function that accepts a scanner - and returns a match. Parser <i>functions</i> are composed to form increasingly - complex <i>higher order forms</i>. Notice too that the parser, albeit an object, - is immutable and constant. All primitive and composite parser objects are <tt>const</tt>.
-  The parse member function is even declared as <tt>const</tt>:</p>
-<pre>
- <code><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt; - </span><span class=keyword>typename </span><span class=identifier>parser_result</span><span class=special>&lt;</span><span class=identifier>self_t</span><span class=special>, </span><span class=identifier>ScannerT</span><span class=special>&gt;::</span><span class=identifier>type - </span><span class=identifier>parse</span><span class=special>(</span><span class=identifier>ScannerT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>scan</span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span></code></pre> -<p> In all accounts, this looks and feels a lot like <b>Functional Programming</b>. - And indeed it is. Spirit is by all means an application of Functional programming - in the imperative C++ domain. In Haskell, for example, there is what are called - <a href="references.html#combinators">parser combinators</a> which are strikingly - similar to the approach taken by Spirit- parser functions which are composed - using various operators to create higher order parser functions that model a - top-down recursive descent parser. Those smart Haskell folks have been doing
-  this way before Spirit.</p>
-<p> Functional style programming (or FP) libraries are gaining momentum in the - C++ community. Certainly, we'll see more of FP in Spirit now and in the future. - Actually, if one looks more closely, even the C++ standard library has an FP - flavor. Stealthily beneath the core of the standard C++ library, a closer look - into STL gives us a glimpse of a truly FP paradigm already in place. It is obvious
-  that the authors of STL know and practice FP.</p>
-
-<h2>Semantic Actions in the FP Perspective</h2>
-
-<h3>STL style FP</h3>
-<p> A more obvious application of STL-style FP in Spirit is the semantic action. - What is STL-style FP? It is primarily the use of functors that can be composed
-  to form higher order functors.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <img src="theme/note.gif" width="16" height="16"> <strong>Functors</strong><br>
-      <br>
- A Function Object, or Functor is simply any object that can be called as - if it is a function. An ordinary function is a function object, and so is - a function pointer; more generally, so is an object of a class that defines
-      operator(). </td>
-  </tr>
+<p>If you look more closely, you'll notice that Spirit is all
+about composition of <i>parser functions</i>. A parser is
+just a function that accepts a scanner and returns a match. Parser <i>functions</i>
+are composed to form increasingly complex <i>higher order forms</i>.
+Notice too that the parser, albeit an object, is immutable and
+constant. All primitive and composite parser objects are <tt>const</tt>.
+The parse member function is even declared as <tt>const</tt>:<br>
+如果凑近些看,你会发现Spirit全是<em>分析器函数的组合。</em>一个分析器不过是 一个接受扫描器并返回匹配的函 +数。分析器<em>函数</em>被组合起来以构成<em>更高层次的形式</em>。同时注 意,对分 +析器而言,任意一个对象都是常量或者不变量。所有的元素或合成分析器对象都是 <tt>const</tt>。甚至parse
+成员函数也同样被声明成 <tt>const</tt> 的:</p>
+<pre> <code><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">ScannerT</span><span class="special">&gt;<br> </span><span class="keyword">typename </span><span class="identifier">parser_result</span><span class="special">&lt;</span><span class="identifier">self_t</span><span class="special">, </span><span class="identifier">ScannerT</span><span class="special">&gt;::</span><span class="identifier">type<br> </span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">ScannerT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">scan</span><span class="special">) </span><span class="keyword">const</span><span class="special">;</span></code></pre>
+<p> In all accounts, this looks and feels a lot like <b>Functional
+Programming</b>. And indeed it is. Spirit is by all means an
+application of Functional programming in the imperative C++ domain. In
+Haskell, for example, there is what are called <a href="references.html#combinators">parser combinators</a>
+which are strikingly similar to the approach taken by Spirit- parser
+functions which are composed using various operators to create higher
+order parser functions that model a top-down recursive descent parser.
+Those smart Haskell folks have been doing this way before Spirit.<br>
+就方方面面而言,这看起来像,感觉也像<strong>函数式编程</strong>。而且的确就 是。Spirit就是一个想尽 +一切办法在命令式的C++领域里实现函数式编程的应用。比如,在Haskell里面,有一 个叫<a href="references.html#combinators">分析器连接器</a>的玩意,和 +Spirit里使用不同的操作符来组合分析器函数以构成更高层次的分析函数,从而形成 一个自顶向下递归下降分析器的方法非常相似。Haskell聪明的作
+者们在Spirit之前已经这么干了。</p>
+<p> Functional style programming (or FP) libraries are gaining
+momentum in the C++ community. Certainly, we'll see more of FP in
+Spirit now and in the future. Actually, if one looks more closely, even
+the C++ standard library has an FP flavor. Stealthily beneath the core
+of the standard C++ library, a closer look into STL gives us a glimpse
+of a truly FP paradigm already in place. It is obvious that the authors
+of STL know and practice FP.<br>
+函数式编程(FP)库正在C++社区中获得越来越多的能量。可以确定的是,从现在到将 来,我们将在Spirit里看到更多的FP。实际上,如果看得 +更仔细些,会发现甚至C++标准库都有某些FP的特征。在标准库隐秘的核心之下,更仔 细地观察,我们会看到一个真正的FP范式早已经在那儿了。很明
+显,STL的作者们了解并实践了FP。</p>
+<h2>Semantic Actions in the FP Perspective &nbsp;FP视角下的语义动作</h2>
+<h3>STL style FP &nbsp;STL风格的FP</h3>
+<p> A more obvious application of STL-style FP in Spirit is the
+semantic action. What is STL-style FP? It is primarily the use of
+functors that can be composed to form higher order functors.<br>
+Spirit中一个更明显的STL风格的FP应用即语义动作。什么是STL风格的FP?主要是指 使用仿函数来构成更高阶的仿函数。</p>
+<table align="center" border="0" width="80%">
+<tbody>
+<tr>
+<td class="note_box"> <img src="theme/note.gif" height="16" width="16"> <strong>Functors 仿函数</strong><br>
+<br>
+A Function Object, or Functor is simply any object that can be called
+as if it is a function. An ordinary function is a function object, and
+so is a function pointer; more generally, so is an object of a class
+that defines operator().
+<br>一个函数对象,或者说仿函数简单的说就是任意可以像函数那样被调用的对象。 一个普通函数是一个函数对象,函数指针也是,更
+广泛的说,一个定义了operator()的类的对象也是如此。<p></p>
+</td>
+</tr>
+</tbody>
 </table>
-<p> This STL-style FP can be seen everywhere these days. The following example - is taken from <a href="http://www.sgi.com/tech/stl/";>SGI's Standard Template
-  Library Programmer's Guide</a>:</p>
-<pre>
- <code><span class=comment>// Computes sin(x)/(x + DBL_MIN) for each element of a range.
-
- </span><span class=identifier>transform</span><span class=special>(</span><span class=identifier>first</span><span class=special>, </span><span class=identifier>last</span><span class=special>, </span><span class=identifier>first</span><span class=special>, - </span><span class=identifier>compose2</span><span class=special>(</span><span class=identifier>divides</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt;(), - </span><span class=identifier>ptr_fun</span><span class=special>(</span><span class=identifier>sin</span><span class=special>), - </span><span class=identifier>bind2nd</span><span class=special>(</span><span class=identifier>plus</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt;(), </span><span class=identifier>DBL_MIN</span><span class=special>)));</span></code></pre> -<p align="left"> Really, this is just <i>currying</i> in FP terminology.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <img src="theme/lens.gif" width="15" height="16"> <strong>Currying</strong><br>
-      <br>
-      What is &quot;currying&quot;, and where does it come from?<br>
-      <br>
- Currying has its origins in the mathematical study of functions. It was - observed by Frege in 1893 that it suffices to restrict attention to functions - of a single argument. For example, for any two parameter function <tt>f(x,y)</tt>, - there is a one parameter function <tt>f'</tt> such that <tt>f'(x)</tt> is - a function that can be applied to y to give <tt>(f'(x))(y) = f (x,y)</tt>. - This corresponds to the well known fact that the sets <tt>(AxB -&gt; C)</tt> - and <tt>(A -&gt; (B -&gt; C))</tt> are isomorphic, where <tt>&quot;x&quot;</tt> - is cartesian product and <tt>&quot;-&gt;&quot;</tt> is function space. In - functional programming, function application is denoted by juxtaposition, - and assumed to associate to the left, so that the equation above becomes
-      <tt>f' x y = f(x,y)</tt>. </td>
-  </tr>
+<p> This STL-style FP can be seen everywhere these days. The
+following example is taken from <a href="http://www.sgi.com/tech/stl/";>SGI's Standard Template +Library Programmer's Guide</a>:<br>这种STL风格的FP在今天已经随处可见。下面 的例子来自于<a href="http://www.sgi.com/tech/stl/";>SGI的标准模板库程序员指南 </a>:</p> +<pre> <code><span class="comment">// Computes sin(x)/(x + DBL_MIN) for each element of a range. 对一个区间内的各个元素计算 </span></code><code><span class="comment">sin(x)/(x + DBL_MIN)<br><br></span></code><code><span class="comment"> </span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">first</span><span class="special">, </span><span class="identifier">last</span><span class="special">, </span><span class="identifier">first</span><span class="special">,<br> </span><span class="identifier">compose2</span><span class="special">(</span><span class="identifier">divides</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(),<br> </span><span class="identifier">ptr_fun</span><span class="special">(</span><span class="identifier">sin</span><span class="special">),<br> </span><span class="identifier">bind2nd</span><span class="special">(</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(), </span><span class="identifier">DBL_MIN</span><span class="special">)));</span></code></pre>
+<p style="text-align: left;"> Really, this is just <i>currying</i>
+in FP terminology.<br>其实,这只是FP术语中所谓的 <em>currying</em> 罢了。 </p>
+<table align="center" border="0" width="80%">
+<tbody>
+<tr>
+<td class="note_box"> <img src="theme/lens.gif" height="16" width="15"> <strong>Currying</strong><br>
+<br>
+What is "currying", and where does it come from?<br>什么是"currying",它又 是从哪儿来的?<br>
+<br>
+Currying has its origins in the mathematical study of functions. It was
+observed by Frege in 1893 that it suffices to restrict attention to
+functions of a single argument. For example, for any two parameter
+function <tt>f(x,y)</tt>, there is a one parameter
+function <tt>f'</tt> such that <tt>f'(x)</tt>
+is a function that can be applied to y to give <tt>(f'(x))(y) =
+f (x,y)</tt>. This corresponds to the well known fact that the
+sets <tt>(AxB -&gt; C)</tt> and <tt>(A
+-&gt; (B -&gt; C))</tt> are isomorphic, where <tt>"x"</tt>
+is cartesian product and <tt>"-&gt;"</tt> is function
+space. In functional programming, function application is denoted by
+juxtaposition, and assumed to associate to the left, so that the
+equation above becomes <tt>f' x y = f(x,y)</tt>.<br>currying来自于对函数的 数学研究。1893年Frege发现可以把注意力严格集中到只有一个参数的函数上。比 如,对任意有两个参数的函数 <tt>f(x)</tt>,存在一个单参数函数 <tt>f'</tt>&nbsp;比如 <tt>f'(x)</tt>&nbsp;<span style="font-family: Courier New;">使得</span> <tt>(f'(x))(y) = +f (x,y)</tt><span style="font-family: Courier New;"> 成立。 这对应于众所周 知的事实:集合</span> <tt>(AxB -&gt; C)</tt> 和 <tt>(A +-&gt; (B -&gt; C))</tt> 等价。这里&nbsp;<span style="font-family: Courier New;"><tt>"x"</tt></span> 是笛卡尔乘积且&nbsp;<span style="font-family: Courier New;"><tt>"-&gt;"</tt></span> 是函数空间。在函数式编程中,函数的使用 写成并置的形式,并且认为是左关联的,因此上面的等式变成了 <span style="font-family: Courier New;"><tt>f' x y = f(x,y)</tt></span>。 </td>
+</tr>
+</tbody>
 </table>
-<p> In the context of Spirit, the same FP style functor composition may be applied - to semantic actions. <a href="../example/fundamental/full_calc.cpp">full_calc.cpp</a> is a good example. Here's a snippet from that sample:</p>
-<pre>
-    <code><span class=identifier>expression </span><span class=special>=
-        </span><span class=identifier>term
- </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>)[</span><span class=identifier>make_op</span><span class=special>(</span><span class=identifier>plus</span><span class=special>&lt;</span><span class=keyword>long</span><span class=special>&gt;(), </span><span class=identifier>self</span><span class=special>.</span><span class=identifier>eval</span><span class=special>)] - </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>)[</span><span class=identifier>make_op</span><span class=special>(</span><span class=identifier>minus</span><span class=special>&lt;</span><span class=keyword>long</span><span class=special>&gt;(), </span><span class=identifier>self</span><span class=special>.</span><span class=identifier>eval</span><span class=special>)]
-            </span><span class=special>)
-            </span><span class=special>;</span></code></pre>
-
-<p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/full_calc.cpp">viewed here</a>. This is part of the Spirit distribution.</p>
-<h3>Boost style FP</h3>
-<p> Boost takes the FP paradigm further. There are libraries in boost that focus
-  specifically on Function objects and higher-order programming.</p>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="14"> Boost FP libraries </td>
-  </tr>
-  <tr>
- <td class="table_cells"><a href="http://www.boost.org/libs/bind/bind.html";>bind</a> - and <a href="http://www.boost.org/libs/bind/mem_fn.html";>mem_fn</a></td> - <td class="table_cells">Generalized binders for function/object/pointers and
-      member functions, from Peter Dimov</td>
-  </tr>
- <td class="table_cells"><a href="http://www.boost.org/libs/function/index.html";>function</a></td> - <td class="table_cells">Function object wrappers for deferred calls or callbacks,
-    from Doug Gregor</td>
-  </tr>
- <td class="table_cells"><a href="http://www.boost.org/libs/functional/index.html";>functional</a></td> - <td class="table_cells">Enhanced function object adaptors, from Mark Rodgers</td>
-  </tr>
- <td class="table_cells"><a href="http://www.boost.org/libs/lambda/index.html";>lambda</a></td> - <td class="table_cells">Define small unnamed function objects at the actual
-    call site, and more, from Jaakko Järvi and Gary Powell</td>
-  </tr>
- <td class="table_cells"><a href="http://www.boost.org/libs/bind/ref.html";>ref</a></td> - <td class="table_cells">A utility library for passing references to generic - functions, from Jaako Järvi, Peter Dimov, Doug Gregor, and Dave Abrahams</td>
-  </tr>
+<p> In the context of Spirit, the same FP style functor
+composition may be applied to semantic actions. <a href="../example/fundamental/full_calc.cpp">full_calc.cpp</a> +is a good example. Here's a snippet from that sample:<br>在Spirit的语境 里,同样FP风格的仿函数可以应用于语义动作,<a href="../example/fundamental/full_calc.cpp">full_calc.cpp</a>是一个很好的例 子。这里是例子里的片段:</p> +<pre> <code><span class="identifier">expression </span><span class="special">=<br> </span><span class="identifier">term<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">)[</span><span class="identifier">make_op</span><span class="special">(</span><span class="identifier">plus</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(), </span><span class="identifier">self</span><span class="special">.</span><span class="identifier">eval</span><span class="special">)]<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">)[</span><span class="identifier">make_op</span><span class="special">(</span><span class="identifier">minus</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(), </span><span class="identifier">self</span><span class="special">.</span><span class="identifier">eval</span><span class="special">)]<br> </span><span class="special">)<br> </span><span class="special">;</span></code></pre> +<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/full_calc.cpp">viewed here</a>. +This is part of the Spirit distribution.</p><p><img src="theme/lens.gif" height="16" width="15">可以在 <a href="../example/fundamental/full_calc.cpp">这里</a> 查看完整代码,这是 Spirit发布包的一部分。</p>
+<h3>Boost style FP &nbsp;Boost风格的FP</h3>
+<p> Boost takes the FP paradigm further. There are libraries in
+boost that focus specifically on Function objects and higher-order
+programming.<br>Boost在FP范式上走得更远。在boost里有不少专注于仿函数和高阶 编程的库。</p>
+<table align="center" border="0" width="90%">
+<tbody>
+<tr>
+<td class="table_title" colspan="14"> Boost
+FP libraries &nbsp;Boost中的FP库 </td>
+</tr>
+<tr>
+<td class="table_cells"><a href="http://www.boost.org/libs/bind/bind.html";>bind</a>
+and <a href="http://www.boost.org/libs/bind/mem_fn.html";>mem_fn</a></td>
+<td class="table_cells">Generalized binders for
+function/object/pointers and member functions, from Peter Dimov<br>为函数 /对象/指针和成员函数生成绑定器。来自Peter Dimov</td>
+</tr>
+<tr>
+<td class="table_cells"><a href="http://www.boost.org/libs/function/index.html";>function</a></td>
+<td class="table_cells">Function object wrappers for
+deferred calls or callbacks, from Doug Gregor<br>函数对象封装器,针对解引用 调用或者回调,来自于Doug Gregor</td>
+</tr>
+<tr>
+<td class="table_cells"><a href="http://www.boost.org/libs/functional/index.html";>functional</a></td>
+<td class="table_cells">Enhanced function object
+adaptors, from Mark Rodgers<br>增强的函数对象适配器,来自于Mark Rodgers</td>
+</tr>
+<tr>
+<td class="table_cells"><a href="http://www.boost.org/libs/lambda/index.html";>lambda</a></td>
+<td class="table_cells">Define small unnamed
+function objects at the actual call site, and more, from Jaakko Järvi
+and Gary Powell<br>在调用点定义小型的匿名函数对象,以及更多,来自于Jaakko Järvi 和Gary Powell</td>
+</tr>
+<tr>
+<td class="table_cells"><a href="http://www.boost.org/libs/bind/ref.html";>ref</a></td>
+<td class="table_cells">A utility library for
+passing references to generic functions, from Jaako Järvi, Peter Dimov,
+Doug Gregor, and Dave Abrahams<br>把一个对象的引用传递给一般函数的工具 库,来自于Jaako Järvi, Peter Dimov, Doug Gregor, 以及 Dave Abrahams</td>
+</tr>
+</tbody>
 </table>
-<p> The following is an example that uses boost <strong>Bind</strong> to use a - member function as a Spirit semantic action. You can see this example in full
-  in the file<a href="../example/fundamental/bind.cpp"> bind.cpp</a>.</p>
-<pre>
- <code><span class=keyword>class </span><span class=identifier>list_parser
-    </span><span class=special>{
-    </span><span class=keyword>public</span><span class=special>:
-
- </span><span class=keyword>typedef </span><span class=identifier>list_parser </span><span class=identifier>self_t</span><span class=special>;
-
-        </span><span class=keyword>bool
- </span><span class=identifier>parse</span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>str</span><span class=special>)
-        </span><span class=special>{
- </span><span class=keyword>return </span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>parse</span><span class=special>(</span><span class=identifier>str</span><span class=special>,
-
-                </span><span class=comment>//  Begin grammar
-                </span><span class=special>(
-                    </span><span class=identifier>real_p
-                    </span><span class=special>[
- </span><span class=identifier>bind</span><span class=special>(&amp;</span><span class=identifier>self_t</span><span class=special>::</span><span class=identifier>add</span><span class=special>, </span><span class=keyword>this</span><span class=special>, </span><span class=identifier>_1</span><span class=special>)
-                    </span><span class=special>]
-
- </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=literal>',' - </span><span class=special>&gt;&gt; </span><span class=identifier>real_p
-                                </span><span class=special>[
- </span><span class=identifier>bind</span><span class=special>(&amp;</span><span class=identifier>self_t</span><span class=special>::</span><span class=identifier>add</span><span class=special>, </span><span class=keyword>this</span><span class=special>, </span><span class=identifier>_1</span><span class=special>)
-                                </span><span class=special>]
-                        </span><span class=special>)
-                </span><span class=special>)
-                </span><span class=special>,
-                </span><span class=comment>//  End grammar
-
- </span><span class=identifier>space_p</span><span class=special>).</span><span class=identifier>full</span><span class=special>;
-        </span><span class=special>}
-
-        </span><span class=keyword>void
- </span><span class=identifier>add</span><span class=special>(</span><span class=keyword>double </span><span class=identifier>n</span><span class=special>)
-        </span><span class=special>{
- </span><span class=identifier>v</span><span class=special>.</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>n</span><span class=special>);
-        </span><span class=special>}
-
- </span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt; </span><span class=identifier>v</span><span class=special>;
-    </span><span class=special>};
-</span></code></pre>
-<p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/bind.cpp">viewed here</a>. This is part of the Spirit distribution.</p> -<p>This parser parses a comma separated list of real numbers and stores them - in a vector&lt;double&gt;. Boost.bind creates a Spirit conforming semantic action
-  from the <tt>list_parser</tt>'s member function <tt>add</tt>.</p>
+<p> The following is an example that uses boost <strong>Bind</strong>
+to use a member function as a Spirit semantic action. You can see this
+example in full in the file<a href="../example/fundamental/bind.cpp">
+bind.cpp</a>.<br>下面是一个如何使用boost <strong>Bind</strong> 来把一个成员 函数变成语义动作的例子。可以在<a href="../example/fundamental/bind.cpp">bind.cpp</a>看到完整的例子。</p> +<pre> <code><span class="keyword">class </span><span class="identifier">list_parser<br> </span><span class="special">{<br> </span><span class="keyword">public</span><span class="special">:<br><br> </span><span class="keyword">typedef </span><span class="identifier">list_parser </span><span class="identifier">self_t</span><span class="special">;<br><br> </span><span class="keyword">bool<br> </span><span class="identifier">parse</span><span class="special">(</span><span class="keyword">char </span><span class="keyword">const</span><span class="special">* </span><span class="identifier">str</span><span class="special">)<br> </span><span class="special">{<br> </span><span class="keyword">return </span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">str</span><span class="special">,<br><br> </span><span class="comment">// Begin grammar<br> </span><span class="special">(<br> </span><span class="identifier">real_p<br> </span><span class="special">[<br> </span><span class="identifier">bind</span><span class="special">(&amp;</span><span class="identifier">self_t</span><span class="special">::</span><span class="identifier">add</span><span class="special">, </span><span class="keyword">this</span><span class="special">, </span><span class="identifier">_1</span><span class="special">)<br> </span><span class="special">]<br><br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="literal">','<br> </span><span class="special">&gt;&gt; </span><span class="identifier">real_p<br> </span><span class="special">[<br> </span><span class="identifier">bind</span><span class="special">(&amp;</span><span class="identifier">self_t</span><span class="special">::</span><span class="identifier">add</span><span class="special">, </span><span class="keyword">this</span><span class="special">, </span><span class="identifier">_1</span><span class="special">)<br> </span><span class="special">]<br> </span><span class="special">)<br> </span><span class="special">)<br> </span><span class="special">,<br> </span><span class="comment">// End grammar<br><br> </span><span class="identifier">space_p</span><span class="special">).</span><span class="identifier">full</span><span class="special">;<br> </span><span class="special">}<br><br> </span><span class="keyword">void<br> </span><span class="identifier">add</span><span class="special">(</span><span class="keyword">double </span><span class="identifier">n</span><span class="special">)<br> </span><span class="special">{<br> </span><span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">n</span><span class="special">);<br> </span><span class="special">}<br><br> </span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt; </span><span class="identifier">v</span><span class="special">;<br> </span><span class="special">};<br></span></code></pre> +<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/bind.cpp">viewed here</a>. +This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15">可以在 <a href="../example/fundamental/bind.cpp">这里 </a> 查看完整代码,这是Spirit发布包的一部分。</p>
+<p>This parser parses a comma separated list of real numbers and
+stores them in a vector&lt;double&gt;. Boost.bind creates a
+Spirit conforming semantic action from the <tt>list_parser</tt>'s
+member function <tt>add</tt>.<br>这个分析器分析一个由逗号分隔的实数列表并把 它们储存到一个 vector&lt;double&gt;。Boost.bind 从 <tt>list_parser</tt> 的成 员函数 <tt>add</tt> 创建了一个符合Spirt标准的语义动作。</p>
 <h3>Lambda and Phoenix</h3>
-<p> There's a library, authored by yours truly, named <a href="../phoenix/index.html">Phoenix</a>. - While this is not officially part of the Spirit distribution, this library has - been used extensively to experiment on advanced FP techniques in C++. This library - is highly influenced by <a href="http://www.cc.gatech.edu/%7Eyannis/fc%2B%2B/";>FC++</a> - and boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>).</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <b><img src="theme/lens.gif" width="15" height="16">
-      BLL</b><br>
-      <br>
- In as much as Phoenix is influenced by boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>), - Phoenix innovations such as local variables, local functions and adaptable - closures, in turn influenced BLL. Currently, BLL is very similar to Phoenix. - Most importantly, BLL incorporated Phoenix's adaptable closures. In the
-      future, Spirit will fully support BLL. </td>
-  </tr>
+<p> There's a library, authored by yours truly, named <a href="../phoenix/index.html">Phoenix</a>. While this
+is not officially part of the Spirit distribution, this library has
+been used extensively to experiment on advanced FP techniques in C++.
+This library is highly influenced by <a href="http://www.cc.gatech.edu/%7Eyannis/fc%2B%2B/";>FC++</a> +and boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>).<br>有一个库,由 诚挚的本人写成的,名叫<a href="http://www.boost.org/libs/spirit/phoenix/index.html";>Phoenix</a>。虽然 还不是Spirit发布版的正式组成部分,但这个库已经被广泛地用来实验C++中的高级 FP技术。这个库受到 <a href="http://www.cc.gatech.edu/%7Eyannis/fc%2B%2B/";>FC++</a>和boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>)的深刻影响。 </p>
+<table align="center" border="0" width="80%">
+<tbody>
+<tr>
+<td class="note_box"> <b><img src="theme/lens.gif" height="16" width="15">
+BLL</b><br>
+<br>
+In as much as Phoenix is influenced by boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>),
+Phoenix innovations such as local variables, local functions and
+adaptable closures, in turn influenced BLL. Currently, BLL is very
+similar to Phoenix. Most importantly, BLL incorporated Phoenix's
+adaptable closures. In the future, Spirit will fully support BLL.<br>由于 Phoenix受到boost Lambda(<a href="http://www.boost.org/libs/lambda/index.html";>BLL</a>)的影响,Phoenix变 革了诸如本地变量,本地函数和可适配闭包等受到BLL影响的概念。目前,BLL和 Phoenix非常详细。最重要的是,BLL能与Phoenix的可适配闭包配合。将来,Spirit将 对BLL提供完备的支持。 </td>
+</tr>
+</tbody>
 </table>
-<p> Phoenix allows one to write semantic actions inline in C++ through lambda - (an unnamed function) expressions. Here's a snippet from the <a href="../example/fundamental/phoenix_calc.cpp">phoenix_calc.cpp</a> example:</p>
-<pre>
-    <code><span class=identifier>expression
- </span><span class=special>= </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>+= </span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>-= </span><span class=identifier>arg1</span><span class=special>])
-                </span><span class=special>)
-        </span><span class=special>;
-
-    </span><span class=identifier>term
- </span><span class=special>= </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'*' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>*= </span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'/' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>/= </span><span class=identifier>arg1</span><span class=special>])
-                </span><span class=special>)
-        </span><span class=special>;
-
-    </span><span class=identifier>factor
- </span><span class=special>= </span><span class=identifier>ureal_p</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] - </span><span class=special>| </span><span class=literal>'(' </span><span class=special>&gt;&gt; </span><span class=identifier>expression</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=literal>')' - </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=special>-</span><span class=identifier>arg1</span><span class=special>]) - </span><span class=special>| </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>])
-        </span><span class=special>;</span></code></pre>
-<p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/phoenix_calc.cpp">viewed here</a>. This is part of the Spirit distribution.</p> -<p>You do not have to worry about the details for now. There is a lot going on here that needs to be explained. The succeeding chapters will be enlightening.</p>
-<p>Notice the use of lambda expressions such as:</p>
-<pre>
- <code><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>+= </span><span class=identifier>arg1</span></code></pre>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <b><img src="theme/lens.gif" width="15" height="16">
-        <a name="lambda"></a>Lambda Expressions?</b><br>
-        <br>
- Lambda expressions are actually unnamed partially applied functions where - placeholders (e.g. arg1, arg2) are provided in place of some of the arguments. - The reason this is called a lambda expression is that traditionally, such - placeholders are written using the Greek letter lambda <img src="theme/lambda.png" width="15" height="22">.</td>
-  </tr>
+<p> Phoenix allows one to write semantic actions inline in C++
+through lambda (an unnamed function) expressions. Here's a snippet from
+the <a href="../example/fundamental/phoenix_calc.cpp">phoenix_calc.cpp</a>
+example:<br>Phoenix允许在C++中通过λ(lambda,匿名函数)表达式写出内联的语义 动作。这里是取自 <a href="../example/fundamental/phoenix_calc.cpp">phoenix_calc.cpp</a> 中例子的 一个片段:
+</p>
+<pre> <code><span class="identifier">expression<br> </span><span class="special">= </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">+= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">term</span><span class="special">[</span><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">-= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">)<br> </span><span class="special">;<br><br> </span><span class="identifier">term<br> </span><span class="special">= </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="special">(</span><span class="literal">'*' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">*= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'/' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">term</span><span class="special">.</span><span class="identifier">val </span><span class="special">/= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">)<br> </span><span class="special">;<br><br> </span><span class="identifier">factor<br> </span><span class="special">= </span><span class="identifier">ureal_p</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">]<br> </span><span class="special">| </span><span class="literal">'(' </span><span class="special">&gt;&gt; </span><span class="identifier">expression</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">] </span><span class="special">&gt;&gt; </span><span class="literal">')'<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="special">-</span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">| </span><span class="special">(</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">factor</span><span class="special">[</span><span class="identifier">factor</span><span class="special">.</span><span class="identifier">val </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">])<br> </span><span class="special">;</span></code></pre> +<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/phoenix_calc.cpp">viewed here</a>. +This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15">完整的代码可<a href="../example/fundamental/phoenix_calc.cpp">在此查阅</a>。这是Spirit发布 包的一部分。</p>
+<p>You do not have to worry about the details for now. There is a
+lot going on here that needs to be explained. The succeeding chapters
+will be enlightening.<br>目前你不必为细节烦神。接下来还有很多东西要解释。紧 接着的章节将有详细的讨论。</p>
+<p>Notice the use of lambda expressions such as:<br>注意下面的λ表达式:</p>
+<pre> <code><span class="identifier">expression</span><span class="special">.</span><span class="identifier">val </span><span class="special">+= </span><span class="identifier">arg1</span></code></pre>
+<table align="center" border="0" width="80%">
+<tbody>
+<tr>
+<td class="note_box"> <b><img src="theme/lens.gif" height="16" width="15"> <a name="lambda"></a>Lambda Expressions? </b>λ<b>表达式?</b><br>
+<br>
+Lambda expressions are actually unnamed partially applied functions
+where placeholders (e.g. arg1, arg2) are provided in place of some of
+the arguments. The reason this is called a lambda expression is that
+traditionally, such placeholders are written using the Greek letter
+lambda <img src="theme/lambda.png" height="22" width="15">.<br>Lambda 表达 式实际上是匿名的部分已应用的函数,其中某些参数被占位符(如 arg1, arg2)替代。 之所以把它称为 lambda 表达式,是由于在传统上,这样的占位符被写为希腊字母
+lambda <img src="theme/lambda.png" height="22" width="15">.</td>
+</tr>
+</tbody>
 </table>
-<p>where <tt>expression.val</tt> is a closure variable of the expression rule - (see <a href="closures.html">Closures</a>). <code><span class=identifier><tt>arg1</tt></span></code> - is a placeholder for the first argument that the semantic action will receive - (see <a href="../phoenix/doc/place_holders.html">Phoenix Place-holders</a>).
-  In Boost.Lambda (BLL), this corresponds to <tt>_1</tt>. </p>
+<p>where <tt>expression.val</tt> is a closure
+variable of the expression rule (see <a href="closures.html">Closures</a>).
+<code><span class="identifier"><tt>arg1</tt></span></code>
+is a placeholder for the first argument that the semantic action will
+receive (see <a href="../phoenix/doc/place_holders.html">Phoenix
+Place-holders</a>). In Boost.Lambda (BLL), this corresponds to <tt>_1</tt>.<br> <tt>expression.val</tt>&nbsp;是表达式规则的一个闭包(见<a href="closures.html">闭包</a>)变量。<code><span class="identifier"><tt>arg1</tt></span></code> 是语义动作将要接收的第一个参 数的占位符(见<a href="../phoenix/doc/place_holders.html">Phoenix占位符 </a>)。在Boost.Lambda(BLL),对应的占位符为 <tt>_1</tt>。</p>
 <table border="0">
-  <tr>
-    <td width="10"></td>
- <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> - <td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td>
-  </tr>
+<tbody>
+<tr>
+<td width="10"></td>
+<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> +<td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> +<td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td>
+</tr>
+</tbody>
 </table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
-  <br>
-<font size="2">Use, modification and distribution is subject to the Boost Software
-    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-    http://www.boost.org/LICENSE_1_0.txt)</font></p>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
+<br>
+<font size="2">Use, modification and distribution is
+subject to the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/functor_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/functor_parser.html Sun Sep 20 23:13:57 2009
@@ -1,108 +1,63 @@
-<html>
-<head>
-<title>Functor Parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Functor Parser</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Functor
-      Parser</b></font> </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Functor
+      Parser 仿函数分析器</b></font> </td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="list_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="refactoring.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p>The simplest way to write your hand coded parser that works well with the rest
-  of the Spirit library is to simply write a functor parser.</p>
-<p> A functor parser is expected to have the interface:</p>
-<pre>
-    <code><span class=keyword>struct </span><span class=identifier>functor
-    </span><span class=special>{
- </span><span class=keyword>typedef </span><span class=identifier>T </span><span class=identifier>result_t</span><span class=special>;
-
- </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt;
-        </span><span class=keyword>std::ptrdiff_t
- </span><span class=keyword>operator</span><span class=special>()(</span><span class=identifier>ScannerT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>scan</span><span class=special>, </span><span class=identifier>result_t</span><span class=special>&amp; </span><span class=identifier>result</span><span class=special>) </span><span class=keyword>const</span><span class=special>;
-    </span><span class=special>};
-</span></code></pre>
+ of the Spirit library is to simply write a functor parser.<br>使得你所写 的代码能和Spirit其他部分合作愉快的最简单的方法就是简单地写一个仿函数分析器。 </p> +<p> A functor parser is expected to have the interface:<br>一个仿函数分析器 应该有如下接口:</p> +<pre> <code><span class="keyword">struct </span><span class="identifier">functor<br> </span><span class="special">{<br> </span><span class="keyword">typedef </span><span class="identifier">T </span><span class="identifier">result_t</span><span class="special">;<br><br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">ScannerT</span><span class="special">&gt;<br> </span><span class="keyword">std::ptrdiff_t<br> </span><span class="keyword">operator</span><span class="special">()(</span><span class="identifier">ScannerT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">scan</span><span class="special">, </span><span class="identifier">result_t</span><span class="special">&amp; </span><span class="identifier">result</span><span class="special">) </span><span class="keyword">const</span><span class="special">;<br> </span><span class="special">};<br></span></code></pre> <p> where typedef T result_t; is the attribute type of the parser that will be passed back to the match result (see <a href="indepth_the_parser.html">In-depth: The Parser</a>). If the parser does not need to return an attribute, this can - simply be nil_t. The <span class=keyword><tt>std::ptrdiff_t</tt></span> result + simply be nil_t. The <span class="keyword"><tt>std::ptrdiff_t</tt></span> result is the number of matching characters matched by your parser. A negative value
-  flags an unsucessful match.</p>
+ flags an unsucessful match.<br>这里 typedef T result_t; 是分析器的属性 类,将会传回给匹配结果(见<a href="indepth_the_parser.html">深入:分析器 </a>)。如果分析器不需要返回一个属性,这一类型可以是nil_t。<span class="keyword"><tt>std::ptrdiff_t</tt></span> 作为结果反映了你的分析器所匹 配的字符数量。负数表明匹配失败。<span class="keyword"></span></p> <p> A conforming functor parser can transformed into a well formed Spirit parser
-  by wrapping it in the functor_parser template:</p>
-<pre>
- <code><span class=identifier>functor_parser</span><span class=special>&lt;</span><span class=identifier>functor</span><span class=special>&gt; </span><span class=identifier>functor_p</span><span class=special>;
-</span></code></pre>
-
-<h2>Example</h2>
-<p> The following example puts the functor_parser into action:</p>
-<pre>
- <code><span class=keyword>struct </span><span class=identifier>number_parser
-    </span><span class=special>{
- </span><span class=keyword>typedef </span><span class=keyword>int </span><span class=identifier>result_t</span><span class=special>; - </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt;
-        </span><span class=keyword>std::ptrdiff_t</span>
- <span class=keyword>operator</span><span class=special>()(</span><span class=identifier>ScannerT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>scan</span><span class=special>, </span><span class=identifier>result_t</span><span class=special>&amp; </span><span class=identifier>result</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>scan</span><span class=special>.</span><span class=identifier>at_end</span><span class=special>()) - </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
-
- </span><span class=keyword>char </span><span class=identifier>ch </span><span class=special>= </span><span class=special>*</span><span class=identifier>scan</span><span class=special>; - </span><span class=keyword>if </span><span class=special>(</span><span class=identifier>ch </span><span class=special>&lt; </span><span class=literal>'0' </span><span class=special>|| </span><span class=identifier>ch </span><span class=special>&gt; </span><span class=literal>'9'</span><span class=special>) - </span><span class=keyword>return </span><span class=special>-</span><span class=number>1</span><span class=special>;
-
- </span><span class=identifier>result </span><span class=special>= </span><span class=number>0</span><span class=special>; - </span><span class=keyword>std::ptrdiff_t</span> <span class=identifier>len </span><span class=special>= </span><span class=number>0</span><span class=special>;
-
-            </span><span class=keyword>do
-            </span><span class=special>{
- </span><span class=identifier>result </span><span class=special>= </span><span class=identifier>result</span><span class=special>*</span><span class=number>10 </span><span class=special>+ </span><span class=keyword>int</span><span class=special>(</span><span class=identifier>ch </span><span class=special>- </span><span class=literal>'0'</span><span class=special>); - </span><span class=special>++</span><span class=identifier>len</span><span class=special>; - </span><span class=special>++</span><span class=identifier>scan</span><span class=special>; - </span><span class=special>} </span><span class=keyword>while </span><span class=special>(!</span><span class=identifier>scan</span><span class=special>.</span><span class=identifier>at_end</span><span class=special>() </span><span class=special>&amp;&amp; </span><span class=special>(</span><span class=identifier>ch </span><span class=special>= </span><span class=special>*</span><span class=identifier>scan</span><span class=special>, </span><span class=identifier>ch </span><span class=special>&gt;= </span><span class=literal>'0' </span><span class=special>&amp;&amp; </span><span class=identifier>ch </span><span class=special>&lt;= </span><span class=literal>'9'</span><span class=special>));
-
- </span><span class=keyword>return </span><span class=identifier>len</span><span class=special>;
-        </span><span class=special>}
-    </span><span class=special>};
-
- </span><span class=identifier>functor_parser</span><span class=special>&lt;</span><span class=identifier>number_parser</span><span class=special>&gt; </span><span class=identifier>number_parser_p</span><span class=special>;
-</span></code></pre>
-<p> <img src="theme/lens.gif" width="15" height="16"> The full source code can be <a href="../example/fundamental/functor_parser.cpp">viewed here</a>. This is part of the Spirit distribution. </p> + by wrapping it in the functor_parser template:<br>一个符合要求的仿函数分 析器可以转变为格式良好的Spirit分析器,通过把它封装在 functor_parser 模板 中:</p> +<pre> <code><span class="identifier">functor_parser</span><span class="special">&lt;</span><span class="identifier">functor</span><span class="special">&gt; </span><span class="identifier">functor_p</span><span class="special">;<br></span></code></pre>
+
+<h2>Example 例子</h2>
+<p> The following example puts the functor_parser into action:<br>下面的例 子用上了 functor_parser:</p> +<pre> <code><span class="keyword">struct </span><span class="identifier">number_parser<br> </span><span class="special">{<br> </span><span class="keyword">typedef </span><span class="keyword">int </span><span class="identifier">result_t</span><span class="special">;<br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">ScannerT</span><span class="special">&gt;<br> </span><span class="keyword">std::ptrdiff_t</span> + <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">ScannerT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">scan</span><span class="special">, </span><span class="identifier">result_t</span><span class="special">&amp; </span><span class="identifier">result</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="keyword">if </span><span class="special">(</span><span class="identifier">scan</span><span class="special">.</span><span class="identifier">at_end</span><span class="special">())<br> </span><span class="keyword">return </span><span class="special">-</span><span class="number">1</span><span class="special">;<br><br> </span><span class="keyword">char </span><span class="identifier">ch </span><span class="special">= </span><span class="special">*</span><span class="identifier">scan</span><span class="special">;<br> </span><span class="keyword">if </span><span class="special">(</span><span class="identifier">ch </span><span class="special">&lt; </span><span class="literal">'0' </span><span class="special">|| </span><span class="identifier">ch </span><span class="special">&gt; </span><span class="literal">'9'</span><span class="special">)<br> </span><span class="keyword">return </span><span class="special">-</span><span class="number">1</span><span class="special">;<br><br> </span><span class="identifier">result </span><span class="special">= </span><span class="number">0</span><span class="special">;<br> </span><span class="keyword">std::ptrdiff_t</span> <span class="identifier">len </span><span class="special">= </span><span class="number">0</span><span class="special">;<br><br> </span><span class="keyword">do<br> </span><span class="special">{<br> </span><span class="identifier">result </span><span class="special">= </span><span class="identifier">result</span><span class="special">*</span><span class="number">10 </span><span class="special">+ </span><span class="keyword">int</span><span class="special">(</span><span class="identifier">ch </span><span class="special">- </span><span class="literal">'0'</span><span class="special">);<br> </span><span class="special">++</span><span class="identifier">len</span><span class="special">;<br> </span><span class="special">++</span><span class="identifier">scan</span><span class="special">;<br> </span><span class="special">} </span><span class="keyword">while </span><span class="special">(!</span><span class="identifier">scan</span><span class="special">.</span><span class="identifier">at_end</span><span class="special">() </span><span class="special">&amp;&amp; </span><span class="special">(</span><span class="identifier">ch </span><span class="special">= </span><span class="special">*</span><span class="identifier">scan</span><span class="special">, </span><span class="identifier">ch </span><span class="special">&gt;= </span><span class="literal">'0' </span><span class="special">&amp;&amp; </span><span class="identifier">ch </span><span class="special">&lt;= </span><span class="literal">'9'</span><span class="special">));<br><br> </span><span class="keyword">return </span><span class="identifier">len</span><span class="special">;<br> </span><span class="special">}<br> </span><span class="special">};<br><br> </span><span class="identifier">functor_parser</span><span class="special">&lt;</span><span class="identifier">number_parser</span><span class="special">&gt; </span><span class="identifier">number_parser_p</span><span class="special">;<br></span></code></pre> +<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/functor_parser.cpp">viewed here</a>. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15">&nbsp;完整代码<a href="../example/fundamental/functor_parser.cpp">在此查阅</a>。这是Spirit发 布包的组成部分。</p> <p>To further understand the implementation, see <a href="indepth_the_scanner.html">In-depth: - The Scanner</a> for the scanner API details. We now have a parser <tt>number_parser_p</tt> that we can use just like any other Spirit parser. Example:</p>
-<pre>
- <code><span class=identifier>r </span><span class=special>= </span><span class=identifier>number_parser_p </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=literal>',' </span><span class=special>&gt;&gt; </span><span class=identifier>number_parser_p</span><span class=special>);
-</span></code></pre>
+ The Scanner</a> for the scanner API details. We now have a parser <tt>number_parser_p</tt> that we can use just like any other Spirit parser. Example:<br>要进一步了解实现,可参考<a href="indepth_the_scanner.html">深 入:扫描器</a>中扫描器API的细节。我们现在有了 <tt>number_parser_p</tt><span style="font-family: Courier New;">,可以像使用其他Spirit分析那样使用它。例 子:</span></p> +<pre> <code><span class="identifier">r </span><span class="special">= </span><span class="identifier">number_parser_p </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="literal">',' </span><span class="special">&gt;&gt; </span><span class="identifier">number_parser_p</span><span class="special">);<br></span></code></pre>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="list_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="refactoring.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/list_parsers.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/list_parsers.html Sun Sep 20 23:13:57 2009
@@ -1,187 +1,186 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>List Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="theme/style.css" rel="stylesheet" type="text/css">
-</head>
+<html><head>
+
+<title>List Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="theme/style.css" rel="stylesheet" type="text/css"></head>

 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
- <td width="10"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>&nbsp;</b></font></td> - <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>List Parsers</b></font></td> - <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
+ <td width="10"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>&nbsp;</b></font></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>List Parsers 列表分析器</b></font></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="confix.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="functor_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p>List Parsers are generated by the special predefined parser generator object
   <tt>list_p</tt>, which generates parsers recognizing list structures
-  of the type </p>
-<pre><span class=identifier> item </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=identifier>delimiter </span><span class=special>&gt;&gt; </span><span class=identifier>item</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>!</span><span class=identifier>end</span></pre>
+  of the type<br>列表分析器生成自特殊的预定义分析器生成器对象
+ <tt>list_p</tt><span style="font-family: Courier New;">,所生成的分析器识 别如下类型的列表</span> </p> +<pre><span class="identifier"> item </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="identifier">delimiter </span><span class="special">&gt;&gt; </span><span class="identifier">item</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">!</span><span class="identifier">end</span></pre> <p>where <tt>item</tt> is an expression, delimiter is a delimiter and end is an optional closing expression. As you can see, the <tt>list_p</tt> generated parser does not recognize empty lists, i.e. the parser must find at least one item in the input stream to return a successful match. If you wish to also match an empty list, you can make your list_p optional with operator! An example where this utility parser is helpful is parsing comma separated C/C++ strings, which
-  can be easily formulated as:</p>
-<pre><span class=special> </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>list_of_c_strings_rule - </span><span class=special>= </span><span class=identifier>list_p</span><span class=special>(</span><span class=identifier>confix_p</span><span class=special>(</span><span class=literal>'\"'</span><span class=special>, </span><span class=special>*</span><span class=identifier>c_escape_char_p</span><span class=special>, </span><span class=literal>'\"'</span><span class=special>), </span><span class=literal>','</span><span class=special>)
-        </span><span class=special>;</span></pre>
+ can be easily formulated as:<br>这里 <tt>item</tt> 是一个表达 式,delimiter 是一个分隔符而 end 是一个可选的结尾表达式。正如你所 见,<tt>list_p</tt>
+所
+生成的分析器并不识别空列表,比如,只有在输入中匹配了至少一项,分析器才会返 回成功匹配。如果希望能同时识别空列表,可以为 list_p +加上!(可选)操作符。下面的例子是这一工具分析器对分析逗号分隔的C/C++字符串 助益良多的例子,可以很轻易的列出这个表达式:</p> +<pre><span class="special"> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">list_of_c_strings_rule<br> </span><span class="special">= </span><span class="identifier">list_p</span><span class="special">(</span><span class="identifier">confix_p</span><span class="special">(</span><span class="literal">'\"'</span><span class="special">, </span><span class="special">*</span><span class="identifier">c_escape_char_p</span><span class="special">, </span><span class="literal">'\"'</span><span class="special">), </span><span class="literal">','</span><span class="special">)<br> </span><span class="special">;</span></pre>
 <p>The <tt>confix_p</tt> and <tt>c_escape_char_p</tt> parser generators
- are described <a href="confix.html">here</a> and <a href="escape_char_parser.html">here</a>.</p> + are described <a href="confix.html">here</a> and <a href="escape_char_parser.html">here</a>.<br><tt>confix_p</tt>&nbsp;和 <tt>c_escape_char_p</tt> 分析器可以在&nbsp; <a href="confix.html">这里</a> and <a href="escape_char_parser.html">这里</a> 查阅。</p> <p>The <tt>list_p</tt> parser generator object can be used to generate the following
-  different types of List Parsers:</p>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td colspan="2" class="table_title"><b>List Parsers</b></td>
+ different types of List Parsers:<br><tt>list_p</tt><span style="font-family: Courier New;">&nbsp;</span>分析器生成器对象可用于生成下 列类型的列表分析器:</p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+    <td colspan="2" class="table_title"><b>List Parsers 列表分析器</b></td>
   </tr>
   <tr>
-    <td width="29%" height="27" class="table_cells"><b>list_p</b></td>
- <td width="71%" class="table_cells"><p><tt>list_p</tt> used by itself parses
+    <td class="table_cells" height="27" width="29%"><b>list_p</b></td>
+ <td class="table_cells" width="71%"><p><tt>list_p</tt> used by itself parses comma separated lists without special item formatting, i.e. everything in between two commas is matched as an <tt>item</tt>, no <tt>end</tt>
-        of list token is matched</p></td>
+ of list token is matched</p><p><tt>list_p</tt><span style="font-family: Courier New;">&nbsp;</span>这一形式用于识别没有特殊格式 的列表项的逗号分隔列表,比如,两个逗号之间的所有东西都被匹配为一个 <tt>item</tt>,而列表标记的 <tt>end</tt>&nbsp;则不会匹配</p></td>
   </tr>
   <tr>
- <td height="27" class="table_cells"><strong>list_p(delimiter)</strong></td> + <td class="table_cells" height="27"><strong>list_p(delimiter)</strong></td> <td class="table_cells"><p>generates a list parser, which recognizes lists with the given <tt>delimiter</tt> and matches everything in between them - as an <tt>item</tt>, no <tt>end</tt> of list token is matched</p></td> + as an <tt>item</tt>, no <tt>end</tt> of list token is matched</p><p>生成一个列表分析器,它识别以给定的 <tt>delimiter</tt>&nbsp;作 为分隔符的列表,且把两个分隔符之间的任意内容识别为一个 <tt>item</tt>,而列表 标记的 <tt>end</tt>&nbsp;则不会匹配</p></td>
   </tr>
   <tr>
- <td height="27" class="table_cells"><strong>list_p(item, delimiter)</strong></td> + <td class="table_cells" height="27"><strong>list_p(item, delimiter)</strong></td> <td class="table_cells"><p>generates a list parser, which recognizes lists with the given <tt>delimiter</tt> and matches items based on the given
-        item parser, no <tt>end</tt> of list token is matched</p></td>
+ item parser, no <tt>end</tt> of list token is matched</p><p>生成一 个列表分析器,它识别拥有给定的 <tt>delimiter</tt>&nbsp;作为分隔符,且把给定 的item分析器的匹配作为列表项,而列表标记的 <tt>end</tt>&nbsp;则不会匹配。 </p></td>
   </tr>
   <tr>
- <td height="27" class="table_cells"><strong>list_p(item, delimiter, end)</strong></td> + <td class="table_cells" height="27"><strong>list_p(item, delimiter, end)</strong></td> <td class="table_cells"><p>generates a list parser, which recognizes lists with the given <tt>delimiter</tt> and matches items based on the given <tt>item</tt> parser and additionally recognizes an optional <tt>end</tt>
-        expression</p></td>
+ expression</p><p>生成一个列表分析器,它识别拥有给定的 <tt>delimiter</tt>&nbsp;作为分隔符,且把给定的 <tt>item</tt>&nbsp;分析器的匹 配作为列表项,最后,它还以一个可选的 <tt>end</tt>&nbsp;表达式作为列表的结尾 </p></td>
   </tr>
-</table>
+</tbody></table>
 <p>All of the parameters to list_p can be single characters, strings
or, if more complex parsing logic is required, auxiliary parsers, each of which is automatically converted to the corresponding parser type needed for successful
-  parsing.</p>
+ parsing.<br>list_p 的所有参数可以是单独的字符、字符串、或者,如果需要更复 杂的分析逻辑的话,任意的分析器,这些东西都被自动的转化为成功分析所需要的分析 器的类型。</p> <p>If the <tt>item</tt> parser is an <tt>action_parser_category</tt> type (parser with an attached semantic action) we have to do something special. This happens,
-  if the user wrote something like:</p>
-<pre><span class=special> </span><span class=identifier>list_p</span><span class=special>(</span><span class=identifier>item</span><span class=special>[</span><span class=identifier>func</span><span class=special>], </span><span class=identifier>delim</span><span class=special>)</span></pre> + if the user wrote something like:<br>如果 <tt>item</tt>&nbsp;分析器属于 <tt>action_parser_category</tt>&nbsp;类型(挂接语义动作的分析器),则需要特 殊处理。这发生在用户写出类似如下的代码:</p> +<pre><span class="special"> </span><span class="identifier">list_p</span><span class="special">(</span><span class="identifier">item</span><span class="special">[</span><span class="identifier">func</span><span class="special">], </span><span class="identifier">delim</span><span class="special">)</span></pre> <p> where <tt>item</tt> is the parser matching one item of the list sequence and <tt>func</tt> is a functor to be called after matching one item. If we would
-  do nothing, the resulting code would parse the sequence as follows:</p>
-<pre><span class=special> </span><span class=special>(</span><span class=identifier>item</span><span class=special>[</span><span class=identifier>func</span><span class=special>] </span><span class=special>- </span><span class=identifier>delim</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=identifier>delim </span><span class=special>&gt;&gt; </span><span class=special>(</span><span class=identifier>item</span><span class=special>[</span><span class=identifier>func</span><span class=special>] </span><span class=special>- </span><span class=identifier>delim</span><span class=special>))</span></pre> + do nothing, the resulting code would parse the sequence as follows:<br>这 里 <tt>item</tt>&nbsp;列表项分析器而 <tt>func</tt>&nbsp;是在匹配列表项之后被 调用的仿函数。如果我们什么都不做,所产生的代码就会以如下的方式进行分析:</p> +<pre><span class="special"> </span><span class="special">(</span><span class="identifier">item</span><span class="special">[</span><span class="identifier">func</span><span class="special">] </span><span class="special">- </span><span class="identifier">delim</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="identifier">delim </span><span class="special">&gt;&gt; </span><span class="special">(</span><span class="identifier">item</span><span class="special">[</span><span class="identifier">func</span><span class="special">] </span><span class="special">- </span><span class="identifier">delim</span><span class="special">))</span></pre> <p> what in most cases is not what the user expects. (If this <u>is</u> what you've
   expected, then please use one of the <tt>list_p</tt> generator
functions <tt>direct()</tt>, which will inhibit refactoring of the <tt>item</tt>
-  parser). To make the list parser behave as expected:</p>
-<pre><span class=special> </span><span class=special>(</span><span class=identifier>item </span><span class=special>- </span><span class=identifier>delim</span><span class=special>)[</span><span class=identifier>func</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=identifier>delim </span><span class=special>&gt;&gt; </span><span class=special>(</span><span class=identifier>item </span><span class=special>- </span><span class=identifier>delim</span><span class=special>)[</span><span class=identifier>func</span><span class=special>])</span></pre> + parser). To make the list parser behave as expected:<br>大多数情况下这并 未所期望的。(如果这的确是你想要的,那么请用 <tt>list_p</tt>&nbsp;生成器函 数 <tt>direct()</tt>,它会集成 <tt>item</tt>&nbsp;分析器的重构后的产物)。要 使列表分析器的行为如你所愿:</p> +<pre><span class="special"> </span><span class="special">(</span><span class="identifier">item </span><span class="special">- </span><span class="identifier">delim</span><span class="special">)[</span><span class="identifier">func</span><span class="special">] </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="identifier">delim </span><span class="special">&gt;&gt; </span><span class="special">(</span><span class="identifier">item </span><span class="special">- </span><span class="identifier">delim</span><span class="special">)[</span><span class="identifier">func</span><span class="special">])</span></pre> <p> the actor attached to the item parser has to be re-attached to the <tt>(item - delim)</tt> parser construct, which will make the resulting list parser 'do the right thing'. This refactoring is done by the help of the <a href="refactoring.html">Refactoring Parsers</a>. Additionally special care must be taken, if the item parser is
-  a <tt>unary_parser_category</tt> type parser as for instance:</p>
-<pre><span class=special> </span><span class=identifier>list_p</span><span class=special>(*</span><span class=identifier>anychar_p</span><span class=special>, </span><span class=literal>','</span><span class=special>)</span></pre>
-<p> which without any refactoring would result in </p>
-<pre><span class=special> </span><span class=special>(*</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)) - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>(*</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)) </span><span class=special>)</span></pre> + a <tt>unary_parser_category</tt> type parser as for instance:<br>挂接到 item 分析器上的动作器必须重新挂接到 <tt>(item + - delim)</tt>&nbsp;分析器结构上,才能使得所产生的分析器"行为正确"。这一重 构在<a href="refactoring.html">重构分析器</a>的帮助下完成。需要额外注意的 是,如果列表项分析器是一个 <tt>unary_parser_category</tt>&nbsp;<span style="font-family: Courier New;">类型的分析器,就像下面的:</span></p> +<pre><span class="special"> </span><span class="identifier">list_p</span><span class="special">(*</span><span class="identifier">anychar_p</span><span class="special">, </span><span class="literal">','</span><span class="special">)</span></pre> +<p> which without any refactoring would result in<br>这如果不重构就变成 </p> +<pre><span class="special"> </span><span class="special">(*</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">))<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">(*</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">)) </span><span class="special">)</span></pre> <p> and will not give the expected result (the first <tt>*anychar_p</tt> will eat up all the input up to the end of the input stream). So we have to refactor
-  this into:</p>
-<pre><span class=special> </span><span class=special>*(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)) - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)) </span><span class=special>)</span></pre>
-<p> what will give the correct result.</p>
+ this into:<br>而这将不会得到所期望的结果(第一个 <tt>*anychar_p</tt> <span style="font-family: Courier New;">将把输入流里的直到末尾的输入全部吃掉 </span>)。所以我们需要把它重构为:</p> +<pre><span class="special"> </span><span class="special">*(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">))<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">)) </span><span class="special">)</span></pre>
+<p> what will give the correct result.<br>这将得到正确的结果</p>
<p> The case, where the item parser is a combination of the two mentioned problems (i.e. the item parser is a unary parser with an attached action), is handled
-  accordingly too:</p>
-<pre><span class=special> </span><span class=identifier>list_p</span><span class=special>((*</span><span class=identifier>anychar_p</span><span class=special>)[</span><span class=identifier>func</span><span class=special>], </span><span class=literal>','</span><span class=special>)</span></pre>
-<p> will be parsed as expected:</p>
-<pre><span class=special> </span><span class=special>(*(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)))[</span><span class=identifier>func</span><span class=special>] - </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>(*(</span><span class=identifier>anychar_p </span><span class=special>- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>)))[</span><span class=identifier>func</span><span class=special>] </span><span class=special>)</span></pre> + accordingly too:<br>列表分析器混合了上面提到的两个问题的情况(比如列表分 析器是一个带着语义动作的一元分析器),也将以一致的方式被处理:</p> +<pre><span class="special"> </span><span class="identifier">list_p</span><span class="special">((*</span><span class="identifier">anychar_p</span><span class="special">)[</span><span class="identifier">func</span><span class="special">], </span><span class="literal">','</span><span class="special">)</span></pre>
+<p> will be parsed as expected:<br>将会被如所期望的那样变为:</p>
+<pre><span class="special"> </span><span class="special">(*(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">)))[</span><span class="identifier">func</span><span class="special">]<br> </span><span class="special">&gt;&gt; </span><span class="special">*( </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">(*(</span><span class="identifier">anychar_p </span><span class="special">- </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">)))[</span><span class="identifier">func</span><span class="special">] </span><span class="special">)</span></pre> <p>The required refactoring is implemented with the help of the <a href="refactoring.html">Refactoring
-  Parsers</a>.</p>
-<table width="90%" border="0" align="center">
-  <tr>
- <td colspan="2" class="table_title"><b>Summary of List Parser refactorings</b></td> + Parsers</a>.<br>所需要的重构都是借由<a href="refactoring.html">重构分析器 </a>的帮助来实现的。</p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td colspan="2" class="table_title"><b>Summary of List Parser refactorings 列表分析器重构概览</b></td>
   </tr>
   <tr class="table_title">
-    <td width="34%"><b>You write it as:</b></td>
+    <td width="34%"><b>You write it as: 源代码:</b></td>
<td width="66%"><code><font face="Verdana, Arial, Helvetica, sans-serif">It
-      is refactored to:</font></code></td>
+      is refactored to: 重构为:</font></code></td>
   </tr>
   <tr>
- <td width="34%" class="table_cells"><code><span class=identifier>list_p</span><span class=special>(</span><span class=identifier>item</span><span class=special>, - </span><span class=identifier>delimiter</span><span class=special>)</span></code></td> - <td width="66%" class="table_cells"> <code><span class=special> (</span><span class=identifier>item - </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>) + <td class="table_cells" width="34%"><code><span class="identifier">list_p</span><span class="special">(</span><span class="identifier">item</span><span class="special">, + </span><span class="identifier">delimiter</span><span class="special">)</span></code></td> + <td class="table_cells" width="66%"> <code><span class="special"> (</span><span class="identifier">item + </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">)
       <br>
- &gt;&gt; *(</span><span class=identifier>delimiter </span><span class=special> - &gt;&gt; (</span><span class=identifier>item </span><span class=special>- - </span><span class=identifier>delimiter</span><span class=special>))</span></code></td> + &gt;&gt; *(</span><span class="identifier">delimiter </span><span class="special"> + &gt;&gt; (</span><span class="identifier">item </span><span class="special">- + </span><span class="identifier">delimiter</span><span class="special">))</span></code></td>
   </tr>
   <tr>
- <td width="34%" class="table_cells"><code><span class=identifier>list_p</span><span class=special>(</span><span class=identifier>item</span><span class=special>[</span><span class=identifier>func</span><span class=special>], - </span><span class=identifier>delimiter</span><span class=special>)</span></code></td> - <td width="66%" class="table_cells"> <code><span class=special> (</span><span class=identifier>item - </span><span class=special> - </span><span class=identifier>delimiter</span><span class=special>)[</span><span class=identifier>func</span><span class=special>] + <td class="table_cells" width="34%"><code><span class="identifier">list_p</span><span class="special">(</span><span class="identifier">item</span><span class="special">[</span><span class="identifier">func</span><span class="special">], + </span><span class="identifier">delimiter</span><span class="special">)</span></code></td> + <td class="table_cells" width="66%"> <code><span class="special"> (</span><span class="identifier">item + </span><span class="special"> - </span><span class="identifier">delimiter</span><span class="special">)[</span><span class="identifier">func</span><span class="special">]
       <br>
- &gt;&gt; *(</span><span class=identifier>delimiter </span><span class=special>&gt;&gt; - (</span><span class=identifier>item </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>)[</span><span class=identifier>func</span><span class=special>])</span></code></td> + &gt;&gt; *(</span><span class="identifier">delimiter </span><span class="special">&gt;&gt; + (</span><span class="identifier">item </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">)[</span><span class="identifier">func</span><span class="special">])</span></code></td>
   </tr>
   <tr>
- <td width="34%" class="table_cells"><code><span class=identifier>list_p</span><span class=special>(*</span><span class=identifier>item</span><span class=special>, - </span><span class=identifier>delimiter</span><span class=special>)</span></code></td> - <td width="66%" class="table_cells"> <code><span class=special>*(</span><span class=identifier>item - </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>) + <td class="table_cells" width="34%"><code><span class="identifier">list_p</span><span class="special">(*</span><span class="identifier">item</span><span class="special">, + </span><span class="identifier">delimiter</span><span class="special">)</span></code></td> + <td class="table_cells" width="66%"> <code><span class="special">*(</span><span class="identifier">item + </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">)
       <br>
- &gt;&gt; *(</span><span class=identifier>delimiter </span><span class=special>&gt;&gt; - *(</span><span class=identifier>item </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>))</span></code></td> + &gt;&gt; *(</span><span class="identifier">delimiter </span><span class="special">&gt;&gt; + *(</span><span class="identifier">item </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">))</span></code></td>
   </tr>
   <tr>
- <td width="34%" class="table_cells"><code><span class=identifier>list_p</span><span class=special>((*</span><span class=identifier>item</span><span class=special>)[</span><span class=identifier>func</span><span class=special>], - </span><span class=identifier>delimiter</span><span class=special>)</span></code></td> - <td width="66%" class="table_cells"> <code><span class=special>(*(</span><span class=identifier>item - </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>))[</span><span class=identifier>func</span><span class=special>] + <td class="table_cells" width="34%"><code><span class="identifier">list_p</span><span class="special">((*</span><span class="identifier">item</span><span class="special">)[</span><span class="identifier">func</span><span class="special">], + </span><span class="identifier">delimiter</span><span class="special">)</span></code></td> + <td class="table_cells" width="66%"> <code><span class="special">(*(</span><span class="identifier">item + </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">))[</span><span class="identifier">func</span><span class="special">]
       <br>
- &gt;&gt; *(</span><span class=identifier>delimiter </span><span class=special>&gt;&gt; - (*(</span><span class=identifier>item </span><span class=special>- </span><span class=identifier>delimiter</span><span class=special>))[</span><span class=identifier>func</span><span class=special>])</span></code></td> + &gt;&gt; *(</span><span class="identifier">delimiter </span><span class="special">&gt;&gt; + (*(</span><span class="identifier">item </span><span class="special">- </span><span class="identifier">delimiter</span><span class="special">))[</span><span class="identifier">func</span><span class="special">])</span></code></td>
   </tr>
-</table>
-<p> <img height="16" width="15" src="theme/lens.gif"> <a href="../example/fundamental/list_parser.cpp">list_parser.cpp </a> sample shows the usage of the list_p utility parser:</p>
+</tbody></table>
+<p> <img src="theme/lens.gif" height="16" width="15"> <a href="../example/fundamental/list_parser.cpp">list_parser.cpp </a> sample shows the usage of the list_p utility parser:<br><img src="theme/lens.gif" height="16" width="15"> <a href="../example/fundamental/list_parser.cpp">list_parser.cpp&nbsp;</a>里的 例子展示了list_p工具分析器的使用方法:</p>
 <ol>
-  <li>parsing a simple ',' delimited list w/o item formatting</li>
- <li> parsing a CSV list (comma separated values - strings, integers or reals)</li> - <li>parsing a token list (token separated values - strings, integers or reals) <br> - with an action parser directly attached to the item part of the list_p generated parser</li> + <li>parsing a simple ',' delimited list w/o item formatting<br>分析一个简 单的","分隔列表,带/不带列表项格式化</li> + <li> parsing a CSV list (comma separated values - strings, integers or reals)<br>分析一个CVS列表(逗号分隔值表--字符串、整数或者实数)</li>
+  <li>parsing
+a token list (token separated values - strings, integers or reals) with
+an action parser directly attached to the item part of the list_p
+generated parser<br>分析一个标记表(标记分隔列表--字符串、整数或者实数)并 且把一个动作分析器直接挂接到 list_p 所生成的分析器的列表项部分上</li>
 </ol>
-<p>This is part of the Spirit distribution.</p>
+<p>This is part of the Spirit distribution.<br>这是Spirit发布包的组成部分。 </p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="confix.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="functor_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2001-2003 Hartmut Kaiser<br>
+<p class="copyright">Copyright © 2001-2003 Hartmut Kaiser<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/loops.html   Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/loops.html   Sun Sep 20 23:13:57 2009
@@ -1,99 +1,92 @@
-<html>
-<head>
-<title> Loops</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Loops</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
     <td width="85%">
- <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b> Loops</b></font> + <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b> Loops 循环</b></font>
     </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="escape_char_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="character_sets.html"><img src="theme/r_arr.gif" border="0"></a></td>
    </tr>
-</table>
+</tbody></table>
<p>So far we have introduced a couple of EBNF operators that deal with looping. We have the <tt>+</tt> positive operator, which matches the preceding symbol one (1) or more times, as well as the Kleene star <tt>*</tt> which matches the
-  preceding symbol zero (0) or more times.</p>
+ preceding symbol zero (0) or more times.<br>到目前为止我们已经介绍了一些 针对循环的EBNF操作符。我们有 <tt>+</tt> 加号,匹配(1)到任意多次,我们也有 克林星 <tt>*</tt>,匹配零到任意多次。</p> <p>Taking this further, we may want to have a generalized loop operator. To some this may seem to be a case of overkill. Yet there are grammars that are impractical and cumbersome, if not impossible, for the basic EBNF iteration syntax to specify.
-  Examples:</p>
+ Examples:<br>更进一步,我们可能想要一个通用的循环操作符。某些人可能认为这 是得不偿失的。但如果不悖离EBNF基本规范,某些语法可能会显得不切实际而笨拙。例 子:</p>
 <blockquote>
- <p><img src="theme/bullet.gif" width="12" height="12"> A file name may have
-    a maximum of 255 characters only.<br>
- <img src="theme/bullet.gif" width="12" height="12"> A specific bitmap file
-    format has exactly 4096 RGB color information. <br>
- <img src="theme/bullet.gif" width="12" height="12"> A 32 bit binary string
-    (1..32 1s or 0s).</p>
+ <p><img src="theme/bullet.gif" height="12" width="12"> A file name may have
+    a maximum of 255 characters only.<br>一个最大长度是255的文件名。<br>
+ <img src="theme/bullet.gif" height="12" width="12"> A specific bitmap file + format has exactly 4096 RGB color information. <br>一种固定包含有4096 RGB点信息的特定位图格式。<br> + <img src="theme/bullet.gif" height="12" width="12"> A 32 bit binary string
+    (1..32 1s or 0s).<br>一个32位二进制串(1..32 个1或0)。</p>
 </blockquote>
<p>Other than the Kleene star <tt>*</tt>, the Positive closure <tt>+</tt>, and the optional <tt>!</tt>, a more flexible mechanism for looping is provided for
-  by the framework. <br>
+ by the framework.&nbsp;<br>除了克林星 <tt>*</tt>、加号 <tt>+</tt> 和可选 的 <tt>!</tt>,框架还提供了更有弹性的循环机制:
 </p>
-<table width="80%" border="0" align="center">
-  <tr>
-    <td colspan="2" class="table_title">Loop Constructs</td>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+    <td colspan="2" class="table_title">Loop Constructs 循环结构</td>
   </tr>
   <tr>
     <td class="table_cells" width="26%"><b>repeat_p (n) [p]</b></td>
- <td class="table_cells" width="74%">Repeat <b>p</b> exactly <b>n</b> times</td> + <td class="table_cells" width="74%">Repeat <b>p</b> exactly <b>n</b> times<br>重复执行<strong>n</strong>次<strong>p</strong></td>
   </tr>
   <tr>
     <td class="table_cells" width="26%"><b>repeat_p (n1, n2) [p]</b></td>
<td class="table_cells" width="74%">Repeat <b>p</b> at least <b>n1</b> times
-      and at most <b>n2</b> times</td>
+ and at most <b>n2</b> times<br>重复执行<strong>p</strong>至少 <strong>n1</strong>至多<strong>n2</strong>次</td>
   </tr>
   <tr>
     <td class="table_cells" width="26%"><b>repeat_p (n, more) [p] </b></td>
<td class="table_cells" width="74%">Repeat <b>p</b> at least <b>n</b> times,
-      continuing until <b>p</b> fails or the input is consumed</td>
+ continuing until <b>p</b> fails or the input is consumed<br>重复执行 <strong>p</strong>至少<strong>n</strong>次,并一直持续到<strong>p</strong>不 匹配或者输入被完全耗尽。</td>
   </tr>
-</table>
-<p>Using the <tt>repeat_p</tt> parser, we can now write our examples above:</p>
-<p>A file name with a maximum of 255 characters:<br>
+</tbody></table>
+<p>Using the <tt>repeat_p</tt> parser, we can now write our examples above:<br>使用 <tt>repeat_p</tt>&nbsp;分析器,现在我们可以把上面的例子写 成:</p> +<p>A file name with a maximum of 255 characters:<br>一个最大有255个字符的文 件名:
 </p>
-<pre> <span class=identifier>valid_fname_chars </span><span class=special>= </span><span class=comment>/*..*/</span><span class=special>; - </span><span class=identifier>filename </span><span class=special>= </span><span class=identifier>repeat_p</span><span class=special>(</span><span class=number>1</span><span class=special>, </span><span class=number>255</span><span class=special>)[</span><span class=identifier>valid_fname_chars</span><span class=special>];</span></pre> -<p>A specific bitmap file format which has exactly 4096 RGB color information:<span class=special><br>
-  </span></p>
-<pre> <span class=identifier>uint_parser</span><span class=special>&lt;</span><span class=keyword>unsigned</span><span class=special>, </span><span class=number>16</span><span class=special>, </span><span class=number>6</span><span class=special>, </span><span class=number>6</span><span class=special>&gt; </span><span class=identifier>rgb_p</span><span class=special>; - </span><span class=identifier>bitmap </span><span class=special>= </span><span class=identifier>repeat_p</span><span class=special>(</span><span class=number>4096</span><span class=special>)[</span><span class=identifier>rgb_p</span><span class=special>];</span></pre> +<pre> <span class="identifier">valid_fname_chars </span><span class="special">= </span><span class="comment">/*..*/</span><span class="special">;<br> </span><span class="identifier">filename </span><span class="special">= </span><span class="identifier">repeat_p</span><span class="special">(</span><span class="number">1</span><span class="special">, </span><span class="number">255</span><span class="special">)[</span><span class="identifier">valid_fname_chars</span><span class="special">];</span></pre> +<p>A specific bitmap file format which has exactly 4096 RGB color information:<br>一种包含4096 RBG点的文件格式:<span class="special"></span></p> +<pre> <span class="identifier">uint_parser</span><span class="special">&lt;</span><span class="keyword">unsigned</span><span class="special">, </span><span class="number">16</span><span class="special">, </span><span class="number">6</span><span class="special">, </span><span class="number">6</span><span class="special">&gt; </span><span class="identifier">rgb_p</span><span class="special">;<br> </span><span class="identifier">bitmap </span><span class="special">= </span><span class="identifier">repeat_p</span><span class="special">(</span><span class="number">4096</span><span class="special">)[</span><span class="identifier">rgb_p</span><span class="special">];</span></pre> <p>As for the 32 bit binary string (1..32 1s or 0s), of course we could have easily used the <tt>bin_p</tt> numeric parser instead. For the sake of demonstration
-  however:<span class=special><br>
-  </span></p>
-<pre> <span class=identifier>bin</span><span class=number>32</span> <span class=special>= </span><span class=identifier>lexeme_d</span><span class=special>[</span><span class=identifier>repeat_p</span><span class=special>(</span>1, <span class=number>32</span><span class=special>)[</span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'1'</span><span class=special>) </span><span class=special>| </span><span class=literal>'0'</span><span class=special>]];</span></pre>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><img src="theme/note.gif" width="16" height="16"> Loop - parsers are run-time <a href="parametric_parsers.html">parametric</a>.</td> + however:<br>虽然针对32位的二进制串(1...32个1或0),我们可以轻松地使用 <tt>bin_p</tt>&nbsp;数值分析器,但出于示范的目的:<span class="special"></span></p> +<pre> <span class="identifier">bin</span><span class="number">32</span> <span class="special">= </span><span class="identifier">lexeme_d</span><span class="special">[</span><span class="identifier">repeat_p</span><span class="special">(</span>1, <span class="number">32</span><span class="special">)[</span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'1'</span><span class="special">) </span><span class="special">| </span><span class="literal">'0'</span><span class="special">]];</span></pre>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><img src="theme/note.gif" height="16" width="16"> Loop + parsers are run-time <a href="parametric_parsers.html">parametric</a>.<br><img src="theme/note.gif" height="16" width="16"> 循环分析器可以在运行时<a href="parametric_parsers.html">参数化</a>。</td>
   </tr>
-</table>
+</tbody></table>
<p>The Loop parsers can be dynamic. Consider the parsing of a binary file of Pascal-style length prefixed string, where the first byte determines the length of the incoming
-  string. Here's a sample input:
-<blockquote>
-  <table width="363" border="0" cellspacing="0" cellpadding="0">
-    <tr>
+ string. Here's a sample input:<br>循环分析器可以是动态的。考虑分析一个 Pascal风格的字符串的二进制文件,第一个字节表明了接下来的字符串的长度。这里是 输入样本:</p><blockquote>
+  <table border="0" cellpadding="0" cellspacing="0" width="363">
+    <tbody><tr>
       <td class="dk_grey_bkd">
-        <table width="100%" border="0" cellspacing="2" cellpadding="2">
-          <tr>
-            <td class="white_bkd" width=8%">
+        <table border="0" cellpadding="2" cellspacing="2" width="100%">
+          <tbody><tr>
+            <td class="white_bkd" width="8%">
               <div align="center">11</div>
             </td>
             <td class="white_bkd" width="8%">
@@ -130,10 +123,10 @@
               <div align="center">d</div>
             </td>
           </tr>
-        </table>
+        </tbody></table>
       </td>
     </tr>
-  </table>
+  </tbody></table>

 </blockquote>
<p>This trivial example cannot be practically defined in traditional EBNF. Although
@@ -141,34 +134,32 @@
star, we are still limited to parsing fixed strings. The nature of EBNF forces the repetition factor to be a constant. On the other hand, Spirit allows the repetition factor to be variable at run time. We could write a grammar that
-  accepts the input string above:</p>
-<pre><span class=identifier> </span><span class=keyword>int </span><span class=identifier>c</span><span class=special>; - </span><span class=identifier>r </span><span class=special>= </span><span class=identifier>anychar_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>c</span><span class=special>)] </span><span class=special>&gt;&gt; </span><span class=identifier>repeat_p</span><span class=special>(</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>c</span><span class=special>))[</span><span class=identifier>anychar_p</span><span class=special>];</span></pre>
-<p>The expression</p>
-<pre> <span class=identifier>anychar_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>c</span><span class=special>)]</span></pre> + accepts the input string above:<br>这个微不足道的例子实际上不能用传统的 EBNF定义。虽然某些EBNF语法允许比克林星更强大的循环构造,我们仍然只能分析定长 串。EBNF的习性要求循环的因数是一个常量。而在另一边,Spirit允许循环因数是一个 运行时变量。我们可以写出能接受上面的字符串的语法:</p> +<pre><span class="identifier"> </span><span class="keyword">int </span><span class="identifier">c</span><span class="special">;<br> </span><span class="identifier">r </span><span class="special">= </span><span class="identifier">anychar_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">c</span><span class="special">)] </span><span class="special">&gt;&gt; </span><span class="identifier">repeat_p</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">))[</span><span class="identifier">anychar_p</span><span class="special">];</span></pre>
+<p>The expression<br>表达式</p>
+<pre> <span class="identifier">anychar_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span></pre> <p>extracts the first character from the input and puts it in <tt>c</tt>. What is interesting is that in addition to constants, we can also use variables as
-  parameters to <tt>repeat_p</tt>, as demonstrated in </p>
-<pre> <span class=identifier>repeat_p</span><span class=special>(</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>c</span><span class=special>)</span><span class=special>)</span><span class=special>[</span><span class=identifier>anychar_p</span><span class=special>]</span></pre> + parameters to <tt>repeat_p</tt>, as demonstrated in<br>从输入中抽取第一个 字符并且赋值给 <tt>c</tt>。有趣的是除了常量,我们也可以把变量作为<span style="font-family: Courier New;"> </span><tt>repeat_p</tt><span style="font-family: Courier New;">&nbsp;</span>的参数,正如下面所示范 的:</p> +<pre> <span class="identifier">repeat_p</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span><span class="special">)</span><span class="special">[</span><span class="identifier">anychar_p</span><span class="special">]</span></pre> <p>Notice that <tt>boost::ref</tt> is used to reference the integer <tt>c</tt>. This usage of <tt>repeat_p</tt> makes the parser defer the evaluation of the repetition factor until it is actually needed. Continuing our example, since the value 11 is already extracted from the input, <tt>repeat_p</tt> is is now
-  expected to loop exactly 11 times.</p>
+ expected to loop exactly 11 times.<br>注意 <tt>boost::ref</tt>&nbsp;被用 来引用整数c。这种用法使得 <tt>repeat_p</tt>&nbsp;把循环因数的推演推迟到了真 正需要时。继续我们的例子,由于值11已经被从输入中抽取, <tt>repeat_p</tt>&nbsp;现在知道该循环11次了。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="escape_char_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="character_sets.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/parametric_parsers.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/parametric_parsers.html Sun Sep 20 23:13:57 2009
@@ -1,149 +1,117 @@
-<html>
-<head>
-<title>Parametric Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Parametric Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Parametric
-      Parsers</b></font> </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Parametric
+      Parsers 参数化分析器</b></font> </td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="predefined_actors.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="functional.html"><img src="theme/r_arr.gif" border="0"></a></td>
    </tr>
-</table>
+</tbody></table>
<p>We already have a hint of the dynamic nature of the Spirit framework. This capability is fundamental to Spirit. Dynamic parsing is a very powerful concept. We shall take this concept further through run-time parametric parsers. We are able to handle parsing tasks that are impossible to do with any EBNF syntax
-  alone.</p>
-<h2>A Little Secret</h2>
+ alone.<br>对于Spirit框架的动态特性,我们已经有了初步的印象。这种动态的能 力是Spirit的基础。动态分析是非常强大的概念。我们将通过运行时参数化分析器来进 一步了解这个概念。这样我们将可以解析那些仅仅借助EBNF语法无法完成的目标。</p>
+<h2>A Little Secret 一个小秘密</h2>
<p> A little critter called <tt>boost::ref</tt> lurking in the boost distribution is quite powerful beast when used with Spirit's primitive parsers. We are used to seeing the Spirit primitive parsers created with string or character literals
-  such as:</p>
-<pre>
- <code><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'A'</span><span class=special>) - </span><span class=identifier>range_p</span><span class=special>(</span><span class=literal>'A'</span><span class=special>, </span><span class=literal>'Z'</span><span class=special>) - </span><span class=identifier>str_p</span><span class=special>(</span><span class=string>&quot;Hello World&quot;</span><span class=special>)</span></code></pre>
-<p> str_p has a second form that accepts two iterators over the string:</p>
-<pre>
- <code><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>first </span><span class=special>= </span><span class=string>&quot;My oh my&quot;</span><span class=special>; - </span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>last </span><span class=special>= </span><span class=identifier>first </span><span class=special>+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>strlen</span><span class=special>(</span><span class=identifier>first</span><span class=special>);
-
- </span><span class=identifier>str_p</span><span class=special>(</span><span class=identifier>first</span><span class=special>, </span><span class=identifier>last</span><span class=special>)</span></code></pre>
-<p> What is not obvious is that we can use <tt>boost::ref</tt> as well:</p>
-<pre>
- <code><span class=keyword>char </span><span class=identifier>ch </span><span class=special>= </span><span class=literal>'A'</span><span class=special>; - </span><span class=keyword>char </span><span class=identifier>from </span><span class=special>= </span><span class=literal>'A'</span><span class=special>; - </span><span class=keyword>char </span><span class=identifier>to </span><span class=special>= </span><span class=literal>'Z'</span><span class=special>;
-
- </span><span class=identifier>ch_p</span><span class=special>(</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>ch</span><span class=special>)) - </span><span class=identifier>range_p</span><span class=special>(</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>from</span><span class=special>), </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>to</span><span class=special>))</span></code></pre> + such as:<br>一个小东西,名为 <tt>boost::ref</tt>,潜伏于 boost 的分发包 中,在与 Spirit 的元素分析器一起使用时,却是相当强大的野兽。我们已经见过类似 如下形式以字符或者字符串创建的 Spirit 基本分析器:</p> +<pre> <code><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'A'</span><span class="special">)<br> </span><span class="identifier">range_p</span><span class="special">(</span><span class="literal">'A'</span><span class="special">, </span><span class="literal">'Z'</span><span class="special">)<br> </span><span class="identifier">str_p</span><span class="special">(</span><span class="string">"Hello World"</span><span class="special">)</span></code></pre> +<p> str_p has a second form that accepts two iterators over the string:<br>str_p有第二种形态,接受一个string之上的两个迭代器:</p> +<pre> <code><span class="keyword">char </span><span class="keyword">const</span><span class="special">* </span><span class="identifier">first </span><span class="special">= </span><span class="string">"My oh my"</span><span class="special">;<br> </span><span class="keyword">char </span><span class="keyword">const</span><span class="special">* </span><span class="identifier">last </span><span class="special">= </span><span class="identifier">first </span><span class="special">+ </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">strlen</span><span class="special">(</span><span class="identifier">first</span><span class="special">);<br><br> </span><span class="identifier">str_p</span><span class="special">(</span><span class="identifier">first</span><span class="special">, </span><span class="identifier">last</span><span class="special">)</span></code></pre> +<p> What is not obvious is that we can use <tt>boost::ref</tt> as well:<br>但不显眼的是,我们也可以使用 <tt>boost::ref</tt>:</p> +<pre> <code><span class="keyword">char </span><span class="identifier">ch </span><span class="special">= </span><span class="literal">'A'</span><span class="special">;<br> </span><span class="keyword">char </span><span class="identifier">from </span><span class="special">= </span><span class="literal">'A'</span><span class="special">;<br> </span><span class="keyword">char </span><span class="identifier">to </span><span class="special">= </span><span class="literal">'Z'</span><span class="special">;<br><br> </span><span class="identifier">ch_p</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">ch</span><span class="special">))<br> </span><span class="identifier">range_p</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">from</span><span class="special">), </span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">to</span><span class="special">))</span></code></pre> <p> When <tt>boost::ref</tt> is used, the actual parameters to <tt>ch_p</tt> and <tt>range_p</tt> are held by reference. This means that we can change the values of <tt>ch</tt>, <tt>from</tt> and <tt>to</tt> anytime and the corresponding <tt>ch_p</tt> and <tt>range_p</tt> parser will follow their dynamic values. Of course, since they are held by reference, you must make sure that the referenced
-  object is not destructed while parsing.</p>
-<p> What about <tt>str_p</tt>?</p>
+ object is not destructed while parsing.<br>当使用 <tt>boost::ref</tt> 时,传递给 <tt>ch_p</tt> 和 <tt>range_p</tt>&nbsp;的参数实际上是引用。这意味 着我们可以在任何时候改变 <tt>ch</tt>, <tt>from</tt> 和 <tt>to</tt> 的值,而
+相应的
+ <tt>ch_p</tt> 和 <tt>range_p</tt>&nbsp;分析器也将追随这些动态的赋值。当 然,因为这些参数是对象的引用,所以你必须确保在分析时被引用的对象不会被析构。 </p>
+<p> What about <tt>str_p</tt>?<br>那么 <tt>str_p</tt> 呢?</p>
<p> While the first form of <tt>str_p</tt> (the single argument form) is reserved for null terminated string constants, the second form (the two argument first/last
-  iterator form) may be used:</p>
-<pre>
- <code><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>first </span><span class=special>= </span><span class=string>&quot;My oh my&quot;</span><span class=special>; - </span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>last </span><span class=special>= </span><span class=identifier>first </span><span class=special>+ </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>strlen</span><span class=special>(</span><span class=identifier>first</span><span class=special>);
-
- </span><span class=identifier>str_p</span><span class=special>(</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>first</span><span class=special>), </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>last</span><span class=special>))</span></code></pre>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <img src="theme/note.gif" width="16" height="16"> Hey, + iterator form) may be used:<br>虽然 <tt>str_p</tt>&nbsp;的第一种形式(单 参数的形式)是为null结尾的常量字符串保留的,但第二种形式(两个参数为 first/last迭代器的形式)可以这么用:</p> +<pre> <code><span class="keyword">char </span><span class="keyword">const</span><span class="special">* </span><span class="identifier">first </span><span class="special">= </span><span class="string">"My oh my"</span><span class="special">;<br> </span><span class="keyword">char </span><span class="keyword">const</span><span class="special">* </span><span class="identifier">last </span><span class="special">= </span><span class="identifier">first </span><span class="special">+ </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">strlen</span><span class="special">(</span><span class="identifier">first</span><span class="special">);<br><br> </span><span class="identifier">str_p</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">first</span><span class="special">), </span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">last</span><span class="special">))</span></code></pre>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"> <img src="theme/note.gif" height="16" width="16"> Hey, don't forget <tt>chseq_p</tt>. All these apply to this seldom used primitive
-      as well. </td>
+ as well. <br><img src="theme/note.gif" height="16" width="16">嘿,别 忘了 <tt>chseq_p</tt>。以上这些同样适用于这个很少被使用的元素。 </td>
   </tr>
-</table>
-<h2>Functional Parametric Primitives</h2>
+</tbody></table>
+<h2>Functional Parametric Primitives 函数式参数化元素</h2>
<pre> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>attribute<span class="special">/</span><span class="identifier">parametric</span><span class="special">.</span>hpp<span class="special">&gt;</span></pre> <p> Taking this further, Spirit includes functional versions of the primitives. Rather than taking in characters, strings or references to characters and strings - (using boost::ref), the functional versions take in functions or functors.</p> + (using boost::ref), the functional versions take in functions or functors.<br>更进一步,Spirit包含了函数式版本的元素。不是使用字符、字符串或 者字符和字符串的引用(通过boost::ref),函数式版使用的是函数或者仿函数。</p>
 <h3>f_chlit and f_ch_p</h3>
<p> The functional version of <tt>chlit</tt>. This parser takes in a function or functor (function object). The function is expected to have an interface
-  compatible with:</p>
-<pre>
- <code><span class=identifier>CharT </span><span class=identifier>func</span><span class=special>()</span></code></pre> -<p> where CharT is the character type (e.g. <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>).</p>
-<p> The functor is expected to have an interface compatible with:</p>
-<pre>
-    <code><span class=keyword>struct </span><span class=identifier>functor
-    </span><span class=special>{
- </span><span class=identifier>CharT </span><span class=keyword>operator</span><span class=special>()() </span><span class=keyword>const</span><span class=special>;
-    </span><span class=special>};</span></code></pre>
-<p> where CharT is the character type (e.g. <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>).</p>
-<p> Here's a contrived example:</p>
-<pre>
-    <code><span class=keyword>struct </span><span class=identifier>X
-    </span><span class=special>{
- </span><span class=keyword>char </span><span class=keyword>operator</span><span class=special>()() </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=keyword>return </span><span class=literal>'X'</span><span class=special>; </span><span class=special>
-        }
-    </span><span class=special>};</span></code></pre>
-<p> Now we can use X to create our f_chlit parser:</p>
-<pre>
- <code><span class=identifier>f_ch_p</span><span class=special>(</span><span class=identifier>X</span><span class=special>())</span></code></pre> + compatible with:<br><tt>chlit</tt> 的函数式版本。这个分析器使用函数或者仿 函数(函数对象)。所使用的函数需要兼容如下的接口:</p> +<pre> <code><span class="identifier">CharT </span><span class="identifier">func</span><span class="special">()</span></code></pre> +<p> where CharT is the character type (e.g. <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>).<br>其中 CharT 为字符类型(如 <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>)。</p> +<p> The functor is expected to have an interface compatible with:<br>仿函数 则要兼容如下接口:</p> +<pre> <code><span class="keyword">struct </span><span class="identifier">functor<br> </span><span class="special">{<br> </span><span class="identifier">CharT </span><span class="keyword">operator</span><span class="special">()() </span><span class="keyword">const</span><span class="special">;<br> </span><span class="special">};</span></code></pre> +<p> where CharT is the character type (e.g. <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>).<br>其中 CharT 为字符类型(如 <tt>char</tt>, <tt>int</tt>, <tt>wchar_t</tt>)。</p>
+<p> Here's a contrived example:<br>以下是一个简单的例子:</p>
+<pre> <code><span class="keyword">struct </span><span class="identifier">X<br> </span><span class="special">{<br> </span><span class="keyword">char </span><span class="keyword">operator</span><span class="special">()() </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="keyword">return </span><span class="literal">'X'</span><span class="special">; </span><span class="special">
+        }
+    </span><span class="special">};</span></code></pre>
+<p> Now we can use X to create our f_chlit parser:<br>现在我们可以使用 X 来 创建我们的 f_chlit 分析器:</p> +<pre> <code><span class="identifier">f_ch_p</span><span class="special">(</span><span class="identifier">X</span><span class="special">())</span></code></pre>
 <h3>f_range and f_range_p</h3>
<p> The functional version of <tt>range</tt>. This parser takes in a function or functor compatible with the interfaces above. The difference is that <tt>f_range</tt> (and <tt>f_range_p</tt>) expects two functors. One for the start and one for
-  the end of the range.</p>
+ the end of the range.<br><tt>range</tt> 的函数式版。分析器使用的函数或仿 函数需有兼容于上面的接口。不同的是,<tt>f_range</tt>(以及 <tt>f_range_p</tt>)需要两个仿函数。一个对应范围的起点另一个对应终点。</p>
 <h3>f_chseq and f_chseq_p</h3>
<p> The functional version of <tt>chseq</tt>. This parser takes in two functions or functors. One for the begin iterator and one for the end iterator. The function
-  is expected to have an interface compatible with:</p>
-<pre>
- <code><span class=identifier>IteratorT </span><span class=identifier>func</span><span class=special>()</span></code></pre> + is expected to have an interface compatible with:<br>函数式版的 <tt>chseq</tt>。分析器使用两个函数或仿函数。一个对应begin迭代器另一个对应 end迭代器。所使用的函数要求与如下接口兼容:</p> +<pre> <code><span class="identifier">IteratorT </span><span class="identifier">func</span><span class="special">()</span></code></pre> <p> where <tt>IteratorT</tt> is the iterator type (e.g. <tt>char const*</tt>,
-  <tt>wchar_t const*</tt>).</p>
-<p> The functor is expected to have an interface compatible with:</p>
-<pre>
-    <code><span class=keyword>struct </span><span class=identifier>functor
-    </span><span class=special>{
- </span><span class=identifier>IteratorT </span><span class=keyword>operator</span><span class=special>()() </span><span class=keyword>const</span><span class=special>;
-    </span><span class=special>};</span></code></pre>
+ <tt>wchar_t const*</tt>).<br>其中&nbsp;<tt>IteratorT</tt> 为迭代器类型 (如 <tt>char const*</tt>,
+  <tt>wchar_t const*</tt>)。</p>
+<p> The functor is expected to have an interface compatible with:<br>仿函数 要求与如下接口兼容:</p> +<pre> <code><span class="keyword">struct </span><span class="identifier">functor<br> </span><span class="special">{<br> </span><span class="identifier">IteratorT </span><span class="keyword">operator</span><span class="special">()() </span><span class="keyword">const</span><span class="special">;<br> </span><span class="special">};</span></code></pre> <p> where <tt>IteratorT</tt> is the iterator type (e.g. <tt>char const*</tt>,
-  <tt>wchar_t const*</tt>).</p>
+ <tt>wchar_t const*</tt>).<br>其中&nbsp;<tt>IteratorT</tt> 为迭代器类型 (如 <tt>char const*</tt>,
+  <tt>wchar_t const*</tt>)。</p>
 <h3>f_strlit and f_str_p</h3>
<p> The functional version of <tt>strlit</tt>. This parser takes in two functions - or functors compatible with the interfaces that <tt>f_chseq</tt> expects.</p> + or functors compatible with the interfaces that <tt>f_chseq</tt> expects.<br>函数式版的 <tt>strlit</tt>。分析器使用与 <tt>f_chseq</tt> 所要求 的接口兼容的函数或仿函数。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="predefined_actors.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="functional.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/phoenix.html Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/phoenix.html Sun Sep 20 23:13:57 2009
@@ -1,184 +1,193 @@
-<html>
-<head>
-<title>Phoenix</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Phoenix</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Phoenix</b></font> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Phoenix</b></font>
     </td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="functional.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="closures.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<p>The preceding chapter introduced Phoenix as a means to implementing your semantic actions. We shall look a little bit more into this important library with focus on how you can use it handily with Spirit. This chapter is by no means a thorough discourse of the library. For more information on Phoenix, please take some time to read the <a href="../phoenix/index.html">Phoenix User's Guide</a>. If you just want to use it quickly, this chapter will probably suffice. Rather than taking you to the theories and details of the library, we shall try to provide you with annotated exemplars instead. Hopefully, this will get you into high gear quickly. </p> -<p>Semantic actions in Spirit can be just about any function or function object (functor) as long as it can satisfy the required signature. For example, <tt>uint_p</tt> requires a signature of <tt>void F(T)</tt>, where <tt>T</tt> is the type of the integer (typically <tt>unsigned int</tt>). Plain vanilla actions are of the <tt>void F(IterT, IterT)</tt> variety. You can code your actions in plain C++. Calls to C++ functions or functors will thus be of the form <tt>P[&amp;F]</tt> or <tt>P[F()]</tt> etc. (see <a href="semantic_actions.html">Semantic Actions</a>). Phoenix on the other hand, attempts to mimic C++ such that you can define the function body inlined in the code. </p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <img src="theme/lens.gif" width="15" height="16"> <strong>C++ in C++? </strong><br>
+</tbody></table>
+<p>The preceding chapter introduced Phoenix as a means to implementing
+your semantic actions. We shall look a little bit more into this
+important library with focus on how you can use it handily with Spirit.
+This chapter is by no means a thorough discourse of the library. For
+more information on Phoenix, please take some time to read the <a href="../phoenix/index.html">Phoenix User's Guide</a>.
+If you just want to use it quickly, this chapter will probably suffice.
+Rather than taking you to the theories and details of the library, we
+shall try to provide you with annotated exemplars instead. Hopefully,
+this will get you into high gear quickly.<br>前一章节把Phoenix作为实现语义 动作的一种方法来介绍。下面我们将稍微深入了解这个重要的库,并把焦点集中于如何 在Spirit中便利地使用它。但这一章节绝非对这个库的完整讨论。想了解Phoenix的更 多信息,需要拿出点时间来阅读<a href="../phoenix/index.html">Phoenix用户指南 </a>。如果只是想尽快学会使用它,这一章将可以满足。比起告诉你这个库的理论和细 节,我们倾向于把带有评注的例子提供给你。希望这样能使你的水平迅速提高。 </p>
+<p>Semantic actions in Spirit can be just about any function or
+function object (functor) as long as it can satisfy the required
+signature. For example, <tt>uint_p</tt> requires a signature of <tt>void F(T)</tt>, where <tt>T</tt> is the type of the integer (typically <tt>unsigned int</tt>). Plain vanilla actions are of the <tt>void F(IterT, IterT)</tt> variety. You can code your actions in plain C++. Calls to C++ functions or functors will thus be of the form <tt>P[&amp;F]</tt> or <tt>P[F()]</tt> etc. (see <a href="semantic_actions.html">Semantic Actions</a>). Phoenix on the other hand, attempts to mimic C++ such that you can define the function body inlined in the code.<br>Spirit的语义动作可 以是任意的函数和函数对象(仿函数),只要他们符合所需的签名。比如,uint_p需要 void
+F(T)这样的签名,这里T是整数的类型(一般为unsigned int)。一般的动作为void
+F(IterT,IterT)的变形。你可以只用C++来编写你的动作。对这些函数和仿函数的调用 将有诸如 <tt>P[&amp;F]</tt> 或 <tt>P[F()]</tt> 这样的形式(见 <a href="semantic_actions.html">语义动作</a>)。另一方面,Phoenix 试图模仿C++以 使你能在代码中直接插入函数体。 </p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"> <img src="theme/lens.gif" height="16" width="15"> <strong>C++ in C++? </strong><br>
         <br>
- In as much as Spirit attempts to mimic EBNF in C++, Phoenix attempts to mimic C++ in C++!!!</td> + In as much as Spirit attempts to mimic EBNF in C++, Phoenix attempts to mimic C++ in C++!!!<br>就像Spirit试图在C++里模仿EBNF,Phoenix试图在C++里 模仿C++!!!</td>
   </tr>
-</table>
+</tbody></table>
 <h2>var</h2>
-<p>Remember the <tt>boost::ref</tt>? We discussed that in the <a href="parametric_parsers.html">Parametric Parsers chapter</a>. Phoenix has a similar, but more flexible, counterpart. It's called <tt>var</tt>. The usage is similar to <tt>boost::ref</tt> and you can use it as a direct replacement. However, unlike <tt>boost::ref</tt>, you can use it to form more complex expressions. Here are some examples:</p> -<pre> <span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) += </span><span class=number>3 - </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>y</span><span class=special>) + </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>z</span><span class=special>) -</span><span class=number> </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>y</span><span class=special>) + </span><span class=identifier><span class=special>(</span>3 * var</span><span class=special>(</span><span class=identifier>z</span><span class=special>)) -</span><span class=number> </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>y</span><span class=special>)[</span>var<span class="special">(</span>i<span class="special">)] </span><span class="comment">// assuming y is indexable and i is an index</span></pre> -<p>Let's start with a simple example. We'll want to parse a comma separated list of numbers and report the sum of all the numbers. Using phoenix's var, we do not have to write external semantic actions. We simply inline the code inside the semantic action slots. Here's the complete grammar with our phoenix actions (see <a href="../example/fundamental/sum.cpp">sum.cpp</a> in the examples):</p> -<pre><span class=number> </span><span class=identifier>real_p</span><span class=special>[</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>n</span><span class=special>) </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=literal>',' </span><span class=special>&gt;&gt; </span><span class=identifier>real_p</span><span class=special>[</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>n</span><span class=special>) </span><span class=special>+= </span><span class=identifier>arg1</span><span class=special>])</span> </pre> -<p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/sum.cpp">viewed here</a>.
-This is part of the Spirit distribution.</p>
+<p>Remember the <tt>boost::ref</tt>? We discussed that in the <a href="parametric_parsers.html">Parametric Parsers chapter</a>. Phoenix has a similar, but more flexible, counterpart. It's called <tt>var</tt>. The usage is similar to <tt>boost::ref</tt> and you can use it as a direct replacement. However, unlike <tt>boost::ref</tt>, you can use it to form more complex expressions. Here are some examples:<br>记得 <tt>boost::ref</tt> 吗?我们在<a href="parametric_parsers.html">参数化分析器 </a>一章中讨论过它。Phoenix有一个类似的,但更有弹性的摹本。它叫 <tt>var</tt>。使用起来类似于 <tt>boost::ref</tt>,你可以直接把他当成占位符。 然而,与 <tt>boost::ref</tt> 不同,你可以用它来组成更复杂的表达式。下面是一 些例子:</p> +<pre> <span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) += </span><span class="number">3<br> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">y</span><span class="special">) + </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">z</span><span class="special">)<br></span><span class="number"> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">y</span><span class="special">) + </span><span class="identifier"><span class="special">(</span>3 * var</span><span class="special">(</span><span class="identifier">z</span><span class="special">))<br></span><span class="number"> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">y</span><span class="special">)[</span>var<span class="special">(</span>i<span class="special">)] </span><span class="comment">// assuming y is indexable and i is an index</span></pre>
+<p>Let's start with a simple example. We'll want to parse a comma
+separated list of numbers and report the sum of all the numbers. Using
+phoenix's var, we do not have to write external semantic actions. We
+simply inline the code inside the semantic action slots. Here's the
+complete grammar with our phoenix actions (see <a href="../example/fundamental/sum.cpp">sum.cpp</a> in the examples):<br>我们 以简单的例子开始。比方我们想分析一个由逗号分隔的数字列表并报告所有数字之和。 使用phoenix的var,我们不需要写额外的语义动作。而只需要简单地把代码内联在语义 动作槽内。下面是完整的使用phoenix语义动作的语法(例子见<a href="../example/fundamental/sum.cpp">sum.cpp</a>):</p> +<pre><span class="number"> </span><span class="identifier">real_p</span><span class="special">[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">n</span><span class="special">) </span><span class="special">= </span><span class="identifier">arg1</span><span class="special">] </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="literal">',' </span><span class="special">&gt;&gt; </span><span class="identifier">real_p</span><span class="special">[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">n</span><span class="special">) </span><span class="special">+= </span><span class="identifier">arg1</span><span class="special">])</span> </pre> +<p> <img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/sum.cpp">viewed here</a>. +This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15">完整的源码在<a href="../example/fundamental/sum.cpp">这里</a>。这是Spirit发布包的组成部分。 </p>
 <h3>argN</h3>
-<p>Notice the expression: <span class=identifier><tt>var(n) = arg1 </tt></span>. What is <tt>arg1</tt> and what is it doing there? <tt>arg1</tt> is an argument placeholder. Remember that <tt>real_p</tt> (see <a href="numerics.html">Numerics</a>) reports the parsed number to its attached semantic action. <tt>arg1</tt> is a placeholder for the first argument passed to the semantic action by the parser. If there are more than one arguments passed in, these arguments can be referred to using <tt>arg1</tt>..<tt>argN</tt>. For instance, generic semantic actions (transduction interface; see <a href="semantic_actions.html">Semantic Actions</a>) are passed 2 arguments: the iterators (<tt>first</tt>/<tt>last</tt>) to the matching portion of the input stream. You can refer to <tt>first</tt> and <tt>last</tt> through <tt>arg1</tt> and <tt>arg2</tt>, respectively. </p>
-<p>Like var, argN is also composable. Here are some examples:</p>
-<pre> <span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) += </span><span class=number>arg1 - </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>arg1</span><span class=special> + </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>z</span><span class=special>) -</span><span class=number> </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>arg1</span><span class=special> + </span><span class=identifier><span class=special>(</span>3 * arg2</span><span class=special>) -</span><span class=number> </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) = </span><span class=identifier>arg1</span><span class=special>[</span>arg2<span class="special">] </span><span class="comment">// assuming arg1 is indexable and arg2 is an index</span></pre>
+
+<p>Notice the expression: <span class="identifier"><tt>var(n) = arg1 </tt></span>. What is <tt>arg1</tt> and what is it doing there? <tt>arg1</tt> is an argument placeholder. Remember that <tt>real_p</tt> (see <a href="numerics.html">Numerics</a>) reports the parsed number to its attached semantic action. <tt>arg1</tt>
+is a placeholder for the first argument passed to the semantic action
+by the parser. If there are more than one arguments passed in, these
+arguments can be referred to using <tt>arg1</tt>..<tt>argN</tt>. For instance, generic semantic actions (transduction interface; see <a href="semantic_actions.html">Semantic Actions</a>) are passed 2 arguments: the iterators (<tt>first</tt>/<tt>last</tt>) to the matching portion of the input stream. You can refer to <tt>first</tt> and <tt>last</tt> through <tt>arg1</tt> and <tt>arg2</tt>, respectively.<br>注意表达式<span class="identifier"><tt>var(n) = arg1</tt></span>。<tt>arg1</tt> 是什么,干什 么?<tt>arg1</tt><span style="font-family: Courier New;"></span> 是一个参数 的占位符。记得 <tt>real_p</tt> (see <a href="numerics.html">数值</a>)要把分 析出的数值报告给挂接着它的语义动作。<tt>arg1</tt> 就是对应由分析器传给语义动 作的第一个参数的占位符。如果传入的参数超过一个,则这些参数用 <tt>arg1</tt>..<tt>argN</tt> 来引用。举例来说,一般的语义动作(转换接口;见 <a href="http://www.boost.org/libs/spirit/doc/semantic_actions.html";>语义动 作</a>)接受两个参数:对应输入流中匹配位置的一对迭代器 (<tt>first</tt>/<tt>ast</tt>)。你可以分别通过 <tt>arg1</tt> 和 <tt>arg2</tt> 来引用 <tt>first</tt> 和 <tt>last</tt>。<tt></tt></p><p>Like var, argN is also composable. Here are some examples:<br>类似于 var,argN 也 是可复合的。这里是一些例子:</p> +<pre> <span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) += </span><span class="number">arg1<br> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">arg1</span><span class="special"> + </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">z</span><span class="special">)<br></span><span class="number"> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">arg1</span><span class="special"> + </span><span class="identifier"><span class="special">(</span>3 * arg2</span><span class="special">)<br></span><span class="number"> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) = </span><span class="identifier">arg1</span><span class="special">[</span>arg2<span class="special">] </span><span class="comment">// assuming arg1 is indexable and arg2 is an index</span></pre>
 <h3>val</h3>
-<p>Note the expression: <tt>3 * arg2.</tt> This expression is actually a short-hand equivalent to: <tt>val(3) * arg2</tt>. We shall see later why, in some cases, we need to explicitly wrap constants and literals inside the val. Again, like var and argN, val is also composable.</p>
-<h3>Functions </h3>
-<p>Remember our very first example? In the <a href="quick_start.html">Quick Start</a> chapter, we presented a parser that parses a comma separated list and stuffs the parsed numbers in a vector (see <a href="../example/fundamental/number_list.cpp"> number_list.cpp</a>) . For simplicity, we used Spirit's pre-defined actors (see <a href="predefined_actors.html">Predefined Actors</a>). In the example, we used <tt>push_back_a</tt>:</p> -<pre><code><font color="#000000"> </font><font color="#000000"><span class="identifier">real_p</span><span class=
-"special">[</span><span class="identifier">push_back_a</span><span class=
-"special">(</span><span class="identifier">v</span><span class=
-"special">)]</span> <span class="special">&gt;&gt;</span> <span class=
-"special">*(</span><span class="literal">','</span> <span class=
-"special">&gt;&gt;</span> <span class=
-      "identifier">real_p</span><span class="special">[</span><span class=
- "identifier">push_back_a</span><span class="special">(</span><span class= - "identifier">v</span><span class="special">)])</span></font></code></pre> -<p>Phoenix allows you to write more powerful polymorphic functions, similar to <tt>push_back_a</tt>, easily. See <a href="../example/fundamental/stuff_vector.cpp">stuff_vector.cpp</a>. The example is similar to <a href="../example/fundamental/number_list.cpp">number_list.cpp</a> in functionality, but this time, using phoenix a function to actually implement the <tt>push_back</tt> function:</p> -<pre><span class=identifier> </span><span class=keyword>struct </span><span class=identifier>push_back_impl
-    </span><span class=special>{
- </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Container</span><span class=special>, </span><span class=keyword>typename </span><span class=identifier>Item</span><span class=special>&gt; - </span><span class=keyword>struct </span><span class=identifier>result
-        </span><span class=special>{
- </span><span class=keyword>typedef </span><span class=keyword>void </span><span class=identifier>type</span><span class=special>;
-        </span><span class=special>};
-
- </span><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>Container</span><span class=special>, </span><span class=keyword>typename </span><span class=identifier>Item</span><span class=special>&gt; - </span><span class=keyword>void </span><span class=keyword>operator</span><span class=special>()(</span><span class=identifier>Container</span><span class=special>&amp; </span><span class=identifier>c</span><span class=special>, </span><span class=identifier>Item </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>item</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=identifier>c</span><span class=special>.</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>item</span><span class=special>);
-        </span><span class=special>}
-    </span><span class=special>};</span>
-
- <span class=identifier>function</span><span class=special>&lt;</span><span class=identifier>push_back_impl</span><span class=special>&gt; </span><span class=keyword>const </span><span class=identifier>push_back </span><span class=special>= </span><span class=identifier>push_back_impl</span><span class=special>();</span></pre> -<p><img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/stuff_vector.cpp">viewed here</a>. This is part of the Spirit distribution.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <img src="theme/lens.gif" width="15" height="16"> <strong>Predefined Phoenix Functions</strong><br> +<p>Note the expression: <tt>3 * arg2.</tt> This expression is actually a short-hand equivalent to: <tt>val(3) * arg2</tt>.
+We shall see later why, in some cases, we need to explicitly wrap
+constants and literals inside the val. Again, like var and argN, val is
+also composable.<br>注意表达式 <tt>3 * arg2</tt><span style="font-family: Courier New;"></span>。这个表达式实际上是 <tt>val(3) * arg2</tt> 的简写。后 面我们将见到为什么在某些情况下,我们需要显式地封装常量和变量于 val 中。再 次,类似于 var 和 argN,val 也是可复合的。</p>
+<h3>Functions 函数 </h3>
+<p>Remember our very first example? In the <a href="quick_start.html">Quick Start</a> chapter, we presented a parser that parses a comma separated list and stuffs the parsed numbers in a vector (see <a href="../example/fundamental/number_list.cpp"> number_list.cpp</a>) . For simplicity, we used Spirit's pre-defined actors (see <a href="predefined_actors.html">Predefined Actors</a>). In the example, we used <tt>push_back_a</tt>:<br>记得我们很早的例子么?在<a href="quick_start.html">快速开始</a>一章中,我们展示了一个分析逗号分隔的数值 表并把数值推入一个vector的分析器(见 <a href="../example/fundamental/number_list.cpp">number_list.cpp</a>)。简单起 见,我们用了Spirit预定义的动作器。(见<a href="predefined_actors.html">预定 义动作器</a>)。在那个例子中,我们使用了 <tt>push_back_a</tt>:</p> +<pre><code><font color="#000000"> </font><font color="#000000"><span class="identifier">real_p</span><span class="special">[</span><span class="identifier">push_back_a</span><span class="special">(</span><span class="identifier">v</span><span class="special">)]</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span><span class="literal">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">real_p</span><span class="special">[</span><span class="identifier">push_back_a</span><span class="special">(</span><span class="identifier">v</span><span class="special">)])</span></font></code></pre> +<p>Phoenix allows you to write more powerful polymorphic functions, similar to <tt>push_back_a</tt>, easily. See <a href="../example/fundamental/stuff_vector.cpp">stuff_vector.cpp</a>. The example is similar to <a href="../example/fundamental/number_list.cpp">number_list.cpp</a> in functionality, but this time, using phoenix a function to actually implement the <tt>push_back</tt> function:<br>Phoenix允许你写更强大的多态函 数,类似于 <tt>push_back_a</tt>,但更简单。见 <a href="../example/fundamental/stuff_vector.cpp">stuff_vector.cpp</a>。下面的 例子功能类似于 <a href="../example/fundamental/number_list.cpp">number_list.cpp</a>,但这 次,用phoenix写一个函数来实现 <tt>push_back</tt>&nbsp;函数:</p> +<pre><span class="identifier"> </span><span class="keyword">struct </span><span class="identifier">push_back_impl<br> </span><span class="special">{<br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">Container</span><span class="special">, </span><span class="keyword">typename </span><span class="identifier">Item</span><span class="special">&gt;<br> </span><span class="keyword">struct </span><span class="identifier">result<br> </span><span class="special">{<br> </span><span class="keyword">typedef </span><span class="keyword">void </span><span class="identifier">type</span><span class="special">;<br> </span><span class="special">};<br><br> </span><span class="keyword">template </span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">Container</span><span class="special">, </span><span class="keyword">typename </span><span class="identifier">Item</span><span class="special">&gt;<br> </span><span class="keyword">void </span><span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Container</span><span class="special">&amp; </span><span class="identifier">c</span><span class="special">, </span><span class="identifier">Item </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">item</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="identifier">c</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">item</span><span class="special">);<br> </span><span class="special">}<br> </span><span class="special">};</span>
+
+ <span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">push_back_impl</span><span class="special">&gt; </span><span class="keyword">const </span><span class="identifier">push_back </span><span class="special">= </span><span class="identifier">push_back_impl</span><span class="special">();</span></pre> +<p><img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/stuff_vector.cpp">viewed here</a>. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15"> 完整的源码参见<a href="../example/fundamental/stuff_vector.cpp">这里</a>。这是Spirit分发包的 组成部分。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"> <img src="theme/lens.gif" height="16" width="15"> <strong>Predefined Phoenix Functions 预定义的Phoenix函数 </strong><br>
       <br>
- A future version of Phoenix will include an extensive set of predefined functions covering the whole of STL containers, iterators and algorithms. push_back, will be part of this suite. </td>
+A future version of Phoenix will include an extensive set of predefined
+functions covering the whole of STL containers, iterators and
+algorithms. push_back, will be part of this suite.<br>Phoenix将来的版本将包 含一个巨大的预定义函数集,涵盖整个STL容器、迭代器和算法。push_back,将是这个 套装的一部分。 </td>
   </tr>
-</table>
-<p><span class=identifier><tt>push_back_impl</tt></span> is a simple wrapper over the <tt>push_back</tt> member function of STL containers. The extra scaffolding is there to provide phoenix with additional information that otherwise cannot be directly deduced. <tt>result</tt> relays to phoenix the return type of the functor (<tt>operator()</tt>) given its argument types (<tt>Container</tt> and <tt>Item</tt>) . In this case, the return type is always, simply <tt>void</tt>. </p> -<p><span class=identifier><tt>push_back</tt></span> is a phoenix function object. This is the actual function object that we shall use. The beauty behind phoenix function objects is that the actual use is strikingly similar to a normal C++ function call. Here's the number list parser rewritten using our phoenix function object:</p> -<pre><span class=special> </span><span class=identifier>real_p</span><span class=special>[</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>arg1</span><span class=special>)] </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=literal>',' </span><span class=special>&gt;&gt; </span><span class=identifier>real_p</span><span class=special>[</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>arg1</span><span class=special>)])</span></pre> -<p>And, unlike predefined actors, they can be composed. See the pattern? Here are some examples:</p> -<pre> <span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>arg1 + 2</span><span class=special>)</span> - <span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>var<span class=special>(</span>x<span class=special>)</span></span><span class=special> + </span><span class="identifier">arg1</span><span class=special>)</span> -<span class=identifier> push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>)[</span>arg1<span class=special>], </span><span class=identifier>arg2</span><span class=special>)<span class="comment"> // assuming v is a vector of vectors and arg1 is an index</span></span></pre> -<p>push_back does not have a return type. Say, for example, we wrote another phoenix function <tt>sin</tt>, we can use it in expressions as well: </p> -<pre> <span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class="identifier">sin</span><span class=special>(</span><span class=identifier>arg1<span class=special>)</span> </span><span class="special">*</span><span class=identifier> 2</span><span class=special>)</span>
+</tbody></table>
+<p><span class="identifier"><tt>push_back_impl</tt></span> is a simple wrapper over the <tt>push_back</tt>
+member function of STL containers. The extra scaffolding is there to
+provide phoenix with additional information that otherwise cannot be
+directly deduced. <tt>result</tt> relays to phoenix the return type of the functor (<tt>operator()</tt>) given its argument types (<tt>Container</tt> and <tt>Item</tt>) . In this case, the return type is always, simply <tt>void</tt>.<br><span class="identifier"><tt>push_back_impl</tt></span>&nbsp;是一个针对STL容器的 <span class="identifier"><tt>push_back</tt></span>&nbsp;成员函数的简单封装。 其他的多出来的代码用来给Phoenix提供附加的信息,否则它将无法直接推演。 <tt>result</tt> 把给定了参数(<tt>Container</tt> 和 <tt>Item</tt>)的仿函数 (<tt>operator()</tt>)的返回类型传递给Phoenix。在这个例子里,返回类型总是单 纯的 <tt>void</tt>。</p>
+<p><span class="identifier"><tt>push_back</tt></span> is a phoenix
+function object. This is the actual function object that we shall use.
+The beauty behind phoenix function objects is that the actual use is
+strikingly similar to a normal C++ function call. Here's the number
+list parser rewritten using our phoenix function object:<br><span class="identifier"><tt>push_back</tt></span>&nbsp;是一个phoenix函数对象。这 是我们将实际使用的函数对象。phoenix函数对象幕后的美丽在于它的实际调用非常类 似于一个C++的普通函数。下面是用我们的phoenix函数对象重写的数值列表分析 器:</p> +<pre><span class="special"> </span><span class="identifier">real_p</span><span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">arg1</span><span class="special">)] </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="literal">',' </span><span class="special">&gt;&gt; </span><span class="identifier">real_p</span><span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">arg1</span><span class="special">)])</span></pre> +<p>And, unlike predefined actors, they can be composed. See the pattern? Here are some examples:<br>并且,与预定义动作器不同,他们可以复合。看到这个 模式了么?这里是一些例子:</p> +<pre> <span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">arg1 + 2</span><span class="special">)</span> + <span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">var<span class="special">(</span>x<span class="special">)</span></span><span class="special"> + </span><span class="identifier">arg1</span><span class="special">)</span> +<span class="identifier"> push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">)[</span>arg1<span class="special">], </span><span class="identifier">arg2</span><span class="special">)<span class="comment"> // assuming v is a vector of vectors and arg1 is an index</span></span></pre> +<p>push_back does not have a return type. Say, for example, we wrote another phoenix function <tt>sin</tt>, we can use it in expressions as well:<br>push_back 并没有返回类型。假如,举例来说,我们写了另一个phoenix函 数 <tt>sin</tt>,我们也可以把它用于表达式中:</p> +<pre> <span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">sin</span><span class="special">(</span><span class="identifier">arg1<span class="special">)</span> </span><span class="special">*</span><span class="identifier"> 2</span><span class="special">)</span>
 </pre>
-<h3>Construct</h3>
-<p>Sometimes, we wish to construct an object. For instance, we might want to create a <tt>std::string</tt> given the first/last iterators. For instance, say we want to parse a list of identifiers instead. Our grammar, without the actions, is: </p> -<pre><span class=number> </span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>*(</span><span class=literal>',' </span><span class=special>&gt;&gt; </span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>)</span><span class=special>)</span></pre> -<p><strong><tt>construct_</tt></strong> is a predefined phoenix function that, you guessed it, constructs an object, from the arguments passed in. The usage is:</p> -<pre><span class=number> </span><span class=identifier>construct_</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>,... </span><span class=identifier>argN</span><span class=special>)</span></pre> -<p>where T is the desired type and arg1..argN are the constructor arguments. For example, we can construct a <tt>std::string</tt> from the first/last iterator pair this way:</p> -<pre><span class=identifier> construct_</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>)</span></pre>
-<p>Now, we attach the actions to our grammar:</p>
-<pre><span class=number> </span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>)
-    </span><span class=special>[
- </span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>construct_</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>))
-    </span><span class=special>]
-    </span><span class=special>&gt;&gt;
- </span><span class=special>*(</span><span class=literal>',' </span><span class=special>&gt;&gt; - </span><span class=special>(+</span><span class=identifier>alpha_p</span><span class=special>)
-        </span><span class=special>[
- </span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>v</span><span class=special>), </span><span class=identifier>construct_</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>))
-        </span><span class=special>]
-    </span><span class=special>)</span></pre>
-<p><img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/stuff_vector2.cpp">viewed here</a>. This is part of the Spirit distribution.<span class=special></span></p>
-<h3><a name="lambda"></a>Lambda expressions</h3>
-<p>All these phoenix expressions we see above are lambda expressions. The important thing to note is that these expressions are not evaluated immediately. At grammar construction time, when the actions are attached to the productions, a lambda expression actually generates an unnamed function object that is evaluated later, at parse time. In other words, lambda expressions are <strong>lazily evaluated</strong>.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"> <b><img src="theme/lens.gif" width="15" height="16"> Lambda Expressions?</b><br>
+<h3>Construct 构造</h3>
+<p>Sometimes, we wish to construct an object. For instance, we might want to create a <tt>std::string</tt>
+given the first/last iterators. For instance, say we want to parse a
+list of identifiers instead. Our grammar, without the actions, is:<br>有 时,我们希望构造一个对象。例如,我们可能像用给定的 first/last 迭代器创建一 个 <tt>std::string</tt>&nbsp;对象。比如,假设我们想分析一个标识符列表。我们 的语法,没有语义动作,是这样的:</p> +<pre><span class="number"> </span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">*(</span><span class="literal">',' </span><span class="special">&gt;&gt; </span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">)</span><span class="special">)</span></pre> +<p><strong><tt>construct_</tt></strong> is a predefined phoenix function that, you guessed it, constructs an object, from the arguments passed in. The usage is:<br><strong><tt>construct_</tt></strong> 是一个预定义的 phoenix函数,正如你猜到的,构造一个对象,使用给定的参数。使用方法是:</p> +<pre><span class="number"> </span><span class="identifier">construct_</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;(</span><span class="identifier">arg1</span><span class="special">, </span><span class="identifier">arg2</span><span class="special">,... </span><span class="identifier">argN</span><span class="special">)</span></pre> +<p>where T is the desired type and arg1..argN are the constructor arguments. For example, we can construct a <tt>std::string</tt> from the first/last iterator pair this way:<br>这里T是想构造的类型而 arg1...argN 是构 造函数的参数。例如,我们可以这样从 first/last 迭代器对创建 <tt>std::string</tt>:</p> +<pre><span class="identifier"> construct_</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">arg1</span><span class="special">, </span><span class="identifier">arg2</span><span class="special">)</span></pre> +<p>Now, we attach the actions to our grammar:<br>现在,我们把语义动作挂接到 语法上:</p> +<pre><span class="number"> </span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">)<br> </span><span class="special">[<br> </span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">construct_</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">arg1</span><span class="special">, </span><span class="identifier">arg2</span><span class="special">))<br> </span><span class="special">]<br> </span><span class="special">&gt;&gt;<br> </span><span class="special">*(</span><span class="literal">',' </span><span class="special">&gt;&gt;<br> </span><span class="special">(+</span><span class="identifier">alpha_p</span><span class="special">)<br> </span><span class="special">[<br> </span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">v</span><span class="special">), </span><span class="identifier">construct_</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">arg1</span><span class="special">, </span><span class="identifier">arg2</span><span class="special">))<br> </span><span class="special">]<br> </span><span class="special">)</span></pre> +<p><img src="theme/lens.gif" height="16" width="15"> The full source code can be <a href="../example/fundamental/stuff_vector2.cpp">viewed here</a>. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15"> 完整的代码参见<a href="../example/fundamental/stuff_vector2.cpp">这里</a>。这是Spirit分发包的 组成部分。<span class="special"></span></p>
+<h3><a name="lambda"></a>Lambda expressions &nbsp;Lambda表达式</h3>
+<p>All these phoenix expressions we see above are lambda expressions.
+The important thing to note is that these expressions are not evaluated
+immediately. At grammar construction time, when the actions are
+attached to the productions, a lambda expression actually generates an
+unnamed function object that is evaluated later, at parse time. In
+other words, lambda expressions are <strong>lazily evaluated</strong>.<br>所有这些我们在上面见到的Phoenix表达式都是所谓的 lambda表达式。值得注意的是这些表达式并不是立即推算的。在语法创建的时 +候,当语义动作挂接到所生成的对象上时,一个lambda表达式是延迟计算的的,只是 在分析时才实际产生一个匿名函数对象。换言之,lambda表达式是<strong>惰性推算 </strong>的。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"> <b><img src="theme/lens.gif" height="16" width="15"> Lambda Expressions? </b>λ<b>表达式?</b><br>
         <br>
- Lambda expressions are actually unnamed partially applied functions where placeholders (e.g. arg1, arg2) are provided in place of some of the arguments. The reason this is called a lambda expression is that traditionally, such placeholders are written using the Greek letter lambda <img src="theme/lambda.png" width="15" height="22">.</td>
+Lambda expressions are actually unnamed partially applied functions
+where placeholders (e.g. arg1, arg2) are provided in place of some of
+the arguments. The reason this is called a lambda expression is that
+traditionally, such placeholders are written using the Greek letter
+lambda <img src="theme/lambda.png" height="22" width="15">.<br>Lambda 表达 式实际上是匿名的部分已应用的函数,其中某些参数被占位符(如 arg1, arg2)替代。 之所以把它称为 lambda 表达式,是由于在传统上,这样的占位符被写为希腊字母
+lambda <img src="theme/lambda.png" height="22" width="15">.</td>
   </tr>
-</table>
-<p>Phoenix uses tricks not unlike those used by Spirit to mimic C++ such that you can define the function body inlined in the code. It's weird, but as mentioned, Phoenix actually mimicks C++ in C++ using expression templates. Surely, there are limitations...</p> -<p>All components in a Phoenix expression must be an <strong>actor</strong> (in phoenix parlance) in the same way that components in Spirit should be a <tt>parser</tt>. In Spirit, you can write:</p> -<pre><span class=number> </span><span class=identifier>r </span><span class=special>= </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'x'</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=literal>'y'</span><span class=special>;</span></pre>
-<p>But not:</p>
-<pre><span class=special> </span><span class=identifier>r </span><span class=special>= </span><span class=literal>'x' </span><span class=special>&gt;&gt; </span><span class=literal>'y'</span><span class=special>;</span></pre> -<p>In essence, <tt>parser &gt;&gt; char</tt> is a parser, but <tt>char &gt;&gt; char</tt> is a char (the char shift-right by another char).</p>
-<p>The same restrictions apply to Phoenix. For instance:</p>
-<pre><span class=special> </span><span class=keyword>int </span><span class=identifier>x </span><span class=special>= </span><span class=number>1</span><span class=special>; - </span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=special>&lt;&lt; </span><span class=string>&quot;pizza&quot;</span></pre>
-<p>is a well formed Phoenix expression that's lazily evaluated. But:</p>
-<pre><span class=string> </span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>x </span><span class=special>&lt;&lt; </span><span class=string>&quot;pizza&quot;</span></pre> -<p>is not. Such expressions are immediately executed. C++ syntax dictates that at least <strong>one</strong> of the operands must be a Phoenix actor type. This also applies to compound expressions. For example:</p> -<pre><span class=string> </span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=special>&lt;&lt; </span><span class=string>&quot;pizza&quot; </span><span class=special>&lt;&lt; </span><span class=string>&quot;man&quot;</span></pre>
-<p>This is evaluated as:</p>
-<pre><span class=string> </span><span class=special>(((</span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>)) </span><span class=special>&lt;&lt; </span><span class=string>&quot;pizza&quot;</span><span class=special>) </span><span class=special>&lt;&lt; </span><span class=string>&quot;man&quot;</span><span class=special>)</span></pre> -<p>Since <tt>(cout &lt;&lt; var(x))</tt> is an actor, at least <strong>one</strong> of the operands is a phoenix actor, <tt>((cout &lt;&lt; var(x)) &lt;&lt; &quot;pizza&quot;)</tt> is also a Phoenix actor, and the whole expression is thus also an actor.</p>
-<p>Sometimes, it is safe to write:</p>
-<pre><span class=special> </span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=special>&lt;&lt; </span><span class=identifier>val</span><span class=special>(</span><span class=string>&quot;pizza&quot;</span><span class=special>) </span><span class=special>&lt;&lt; </span><span class=identifier>val</span><span class=special>(</span><span class=string>&quot;man&quot;</span><span class=special>)</span></pre> -<p>just to make it explicitly clear what we are dealing with, especially with complex expressions, in the same way as we explicitly wrap literal strings in <tt>str_p(&quot;lit&quot;)</tt> in Spirit. </p> -<p>Phoenix (and Spirit) also deals with unary operators. In such cases, we have no choice. The operand must be a Phoenix actor (or Spirit parser). Examples:</p>
+</tbody></table>
+<p>Phoenix uses tricks not unlike those used by Spirit to mimic C++
+such that you can define the function body inlined in the code. It's
+weird, but as mentioned, Phoenix actually mimicks C++ in C++ using
+expression templates. Surely, there are limitations...<br>Phoenix使用类似于 Spirit里用的技巧来模仿C++使得你可以在代码中内联地定义函数体。这很奇怪,但正 如所提到的,Phoenix实际上是用表达式模板来在C++里模仿C++。当然,这也是有限制 的……</p> +<p>All components in a Phoenix expression must be an <strong>actor</strong> (in phoenix parlance) in the same way that components in Spirit should be a <tt>parser</tt>. In Spirit, you can write:<br>Phoenix表达式里所有的元件都必须是<strong>动作器</strong>(以 phoenix的行话)而Spirit里这些元件必须是 <tt>parser</tt>。在Spirit中,我们可 以写:</p> +<pre><span class="number"> </span><span class="identifier">r </span><span class="special">= </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'x'</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="literal">'y'</span><span class="special">;</span></pre>
+<p>But not:<br>但不能:</p>
+<pre><span class="special"> </span><span class="identifier">r </span><span class="special">= </span><span class="literal">'x' </span><span class="special">&gt;&gt; </span><span class="literal">'y'</span><span class="special">;</span></pre> +<p>In essence, <tt>parser &gt;&gt; char</tt> is a parser, but <tt>char &gt;&gt; char</tt> is a char (the char shift-right by another char).<br>本质 上,<tt>parser &gt;&gt; char</tt>&nbsp;是一个分析器,但 <tt>char &gt;&gt; char</tt>&nbsp;是一个char(由一个char右移位而来的另一个char)。</p> +<p>The same restrictions apply to Phoenix. For instance:<br>Phoenix中同样存 在这样的限制。例如:</p> +<pre><span class="special"> </span><span class="keyword">int </span><span class="identifier">x </span><span class="special">= </span><span class="number">1</span><span class="special">;<br> </span><span class="identifier">cout </span><span class="special">&lt;&lt; </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) </span><span class="special">&lt;&lt; </span><span class="string">"pizza"</span></pre> +<p>is a well formed Phoenix expression that's lazily evaluated. But:<br>是 一个形态良好、惰性推算的Phoenix表达式。但:</p> +<pre><span class="string"> </span><span class="identifier">cout </span><span class="special">&lt;&lt; </span><span class="identifier">x </span><span class="special">&lt;&lt; </span><span class="string">"pizza"</span></pre> +<p>is not. Such expressions are immediately executed. C++ syntax dictates that at least <strong>one</strong> of the operands must be a Phoenix actor type. This also applies to compound expressions. For example:<br>不是。这样 的表达式是立即计算的。C++句法要求只要有<strong>一个</strong>算子是Phoenix动 作器类。这对复合表达式同样成立。比如:</p> +<pre><span class="string"> </span><span class="identifier">cout </span><span class="special">&lt;&lt; </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) </span><span class="special">&lt;&lt; </span><span class="string">"pizza" </span><span class="special">&lt;&lt; </span><span class="string">"man"</span></pre>
+<p>This is evaluated as:<br>这个被推算为:</p>
+<pre><span class="string"> </span><span class="special">(((</span><span class="identifier">cout </span><span class="special">&lt;&lt; </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">)) </span><span class="special">&lt;&lt; </span><span class="string">"pizza"</span><span class="special">) </span><span class="special">&lt;&lt; </span><span class="string">"man"</span><span class="special">)</span></pre> +<p>Since <tt>(cout &lt;&lt; var(x))</tt> is an actor, at least <strong>one</strong> of the operands is a phoenix actor, <tt>((cout &lt;&lt; var(x)) &lt;&lt; "pizza")</tt> is also a Phoenix actor, and the whole expression is thus also an actor.<br>由于 <tt>(cout &lt;&lt; var(x))</tt>&nbsp;<span style="font-family: Courier New;">是一个动作器,至少 <strong>一个</strong>算子是phoenix动作器, <tt>((cout &lt;&lt; var(x)) &lt;&lt; "pizza")</tt> 也是一个Phoenix动作器,而整个表达式也因此是一个动作 器。</span></p>
+<p>Sometimes, it is safe to write:<br>有时,这么写是安全的:</p>
+<pre><span class="special"> </span><span class="identifier">cout </span><span class="special">&lt;&lt; </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) </span><span class="special">&lt;&lt; </span><span class="identifier">val</span><span class="special">(</span><span class="string">"pizza"</span><span class="special">) </span><span class="special">&lt;&lt; </span><span class="identifier">val</span><span class="special">(</span><span class="string">"man"</span><span class="special">)</span></pre>
+<p>just to make it explicitly clear what we are dealing with,
+especially with complex expressions, in the same way as we explicitly
+wrap literal strings in <tt>str_p("lit")</tt> in Spirit.<br>只要用与 Spirit里显式地用 <tt>str_p("lit")</tt>&nbsp;封装字符串相同的方法显式地表明我 们在和什么打交道,在复杂表达式中这点尤为重要。</p>
+<p>Phoenix (and Spirit) also deals with unary operators. In such cases,
+we have no choice. The operand must be a Phoenix actor (or Spirit
+parser). Examples:<br>Phoenix(以及Spirit)也处理一元操作符。在这样的情况 下,我们没选择。算子必须是Phoenix动作器(或者Spirit分析器)。例子:</p>
 <p>Spirit:</p>
-<pre><span class=special> </span><span class=special>*</span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'z'</span><span class=special>) </span><span class=comment>// good - </span><span class=special>*(</span><span class=literal>'z'</span><span class=special>) </span><span class=comment>// bad</span></pre> +<pre><span class="special"> </span><span class="special">*</span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'z'</span><span class="special">) </span><span class="comment">// good<br> </span><span class="special">*(</span><span class="literal">'z'</span><span class="special">) </span><span class="comment">// bad</span></pre>
 <p> Phoenix:</p>
-<pre><span class=comment> </span><span class=special>*</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=comment>// good (lazy) - </span><span class=special>*</span><span class=identifier>x </span><span class=comment>// bad (immediate)</span></pre> -<p>Also, in Phoenix, for assignments and indexing to be lazily evaluated, the object acted upon should be a Phoenix actor. Examples:</p> -<pre><span class=comment> </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=special>= </span><span class=number>123 </span><span class=comment>// good (lazy) - </span><span class=identifier>x </span><span class=special>= </span><span class=number>123 </span><span class=comment>// bad (immediate) - </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>)[</span><span class=number>0</span><span class=special>] </span><span class=comment>// good (lazy) - </span><span class=identifier>x</span><span class=special>[</span><span class=number>0</span><span class=special>] </span><span class=comment>// bad, immediate - </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>)[</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>i</span><span class=special>)] </span><span class=comment>// good (lazy) - </span><span class=identifier>x</span><span class=special>[</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>i</span><span class=special>)] </span><span class=comment>// bad and illegal (x is not an actor) - </span><span class=identifier>var</span><span class=special>(</span><span class=identifier>x</span><span class=special>[</span><span class=identifier>var</span><span class=special>(</span><span class=identifier>i</span><span class=special>)]) </span><span class=comment>// bad and illegal (x is not an actor)</span></pre>
-<h3>Wrapping up </h3>
-<p>Well, there you have it. I hope with this jump-start chapter, you may be able to harness the power of lambda expressions. By all means, please read the <a href="../phoenix/index.html">phoenix manual</a> to learn more about the nitty gritty details. Surely, you'll get to know a lot more than just by reading this chapter. There are a lot of things still to be touched. There won't be enough space here to cover all the features of Phoenix even in brief. </p> -<p>The next chapter, <a href="closures.html">Closures</a>, we'll see more of phoenix. Stay tuned. </p> +<pre><span class="comment"> </span><span class="special">*</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) </span><span class="comment">// good (lazy)<br> </span><span class="special">*</span><span class="identifier">x </span><span class="comment">// bad (immediate)</span></pre>
+<p>Also, in Phoenix, for assignments and indexing to be lazily
+evaluated, the object acted upon should be a Phoenix actor. Examples:<br>同 样,在Phoenix里,要使等号和下标被惰性推算,其上的动作对象必须是Phoenix动作 器。例子:</p> +<pre><span class="comment"> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">) </span><span class="special">= </span><span class="number">123 </span><span class="comment">// good (lazy)<br> </span><span class="identifier">x </span><span class="special">= </span><span class="number">123 </span><span class="comment">// bad (immediate)<br> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">)[</span><span class="number">0</span><span class="special">] </span><span class="comment">// good (lazy)<br> </span><span class="identifier">x</span><span class="special">[</span><span class="number">0</span><span class="special">] </span><span class="comment">// bad, immediate<br> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">)[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">i</span><span class="special">)] </span><span class="comment">// good (lazy)<br> </span><span class="identifier">x</span><span class="special">[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">i</span><span class="special">)] </span><span class="comment">// bad and illegal (x is not an actor)<br> </span><span class="identifier">var</span><span class="special">(</span><span class="identifier">x</span><span class="special">[</span><span class="identifier">var</span><span class="special">(</span><span class="identifier">i</span><span class="special">)]) </span><span class="comment">// bad and illegal (x is not an actor)</span></pre>
+<h3>Wrapping up 封装 </h3>
+<p>Well, there you have it. I hope with this jump-start chapter, you
+may be able to harness the power of lambda expressions. By all means,
+please read the <a href="../phoenix/index.html">phoenix manual</a> to
+learn more about the nitty gritty details. Surely, you'll get to know a
+lot more than just by reading this chapter. There are a lot of things
+still to be touched. There won't be enough space here to cover all the
+features of Phoenix even in brief.<br>好了,就到这儿了。我希望这个入门章节 能够让你驾驭lambda表达式的力量。请一定要阅读<a href="../phoenix/index.html">phoneix手册</a>以了解更多的实质细节。当然,你将 获得比阅读这章更多的知识。还有很多事情要了解。这里没有足够的空间来涵盖即使是 简明的Phoenix功能介绍。</p> +<p>The next chapter, <a href="closures.html">Closures</a>, we'll see more of phoenix. Stay tuned.<br>下一章,<a href="closures.html">闭包</a>,我们将 看到更多的phoenix,请不要走开,我们马上回来。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="functional.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="closures.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/predefined_actors.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/predefined_actors.html Sun Sep 20 23:13:57 2009
@@ -1,115 +1,113 @@
-<html>
-<head>
-<!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
-<title>predefined_actors</title>
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
+
+
+<title>predefined_actors</title><link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" height="48" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" height="48" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Predefined
-      Actors</b></font></td>
+ <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Predefined
+      Actors 预定义动作器</b></font></td>
<td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="indepth_the_parser_context.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> - <td width="20"><a href="parametric_parsers.html"><img src="theme/r_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="indepth_the_parser_context.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> + <td width="20"><a href="parametric_parsers.html"><img src="theme/r_arr.gif" border="0" height="19" width="20"></a></td>
   </tr>
-</table>
-<h2>Actors</h2><p>
+</tbody></table>
+<h2>Actors 动作器</h2><p>
 The framework has a number of predefined semantic action functors.
Experience shows that these functors are so often used that they were included
 as part of the core framework to spare the user from having to reinvent the
-same functionality over and over again.</p>
-<h2>Quick example: <tt>assign_a</tt> actor</h2>
+same functionality over and over again.<br>本框架包含了一系列预定义的语义动 作仿函数。经验表明这些仿函数的使用是如此频繁,因此在库中包含这些仿函数可以把 用户从反复实现相同的功能中解放出来。</p> +<h2>Quick example: <tt>assign_a</tt> actor 快速例子:<tt>assign_a</tt> 动作 器</h2>
 <code>
-<pre> <span class=keyword>int </span><span class=identifier>i</span><span class=special>,</span><span class=identifier> j</span><span class=special>; - </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>s</span><span class=special>; - </span><span class=identifier>r </span><span class=special>= </span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>i</span><span class=special>)] &gt;&gt; (+</span><span class=identifier>alpha_p</span><span class=special>)[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>s</span><span class=special>)] &gt;&gt; </span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>j</span><span class=special>,</span><span class=identifier>i</span><span class=special>)];</span></pre>
-</code>
+</code><pre> <span class="keyword">int </span><span class="identifier">i</span><span class="special">,</span><span class="identifier"> j</span><span class="special">;<br> </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string </span><span class="identifier">s</span><span class="special">;<br> </span><span class="identifier">r </span><span class="special">= </span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">i</span><span class="special">)] &gt;&gt; (+</span><span class="identifier">alpha_p</span><span class="special">)[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">s</span><span class="special">)] &gt;&gt; </span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">j</span><span class="special">,</span><span class="identifier">i</span><span class="special">)];</span></pre>
+
 <p>
-Given an input <tt>123456 Hello 789</tt>, </p>
-<ol><li><tt>assign_a(i)</tt> will extract the number <tt>123456</tt> and assign it to <tt>i</tt>, </li><li><tt>assign_a(s)</tt> will extract the string <tt>&quot;Hello&quot;</tt> and assign it to <tt>s</tt>,</li><li><tt>assign_a(j,i)</tt> will assign i to j, j=i, without using the parse result.</li></ol> +Given an input <tt>123456 Hello 789</tt>,<br>给定一个输入 <tt>123456 Hello 789</tt>, </p> +<ol><li><tt>assign_a(i)</tt> will extract the number <tt>123456</tt> and assign it to <tt>i</tt>,<br><tt>assign_a(i)</tt> 将取出数字 <tt>123456</tt> 并将其赋值给 <tt>i</tt>, </li><li><tt>assign_a(s)</tt> will extract the string <tt>"Hello"</tt> and assign it to <tt>s</tt>,<br><tt>assign_a(s)</tt> 将取出字符串 <tt>"Hello"</tt> 并将其赋值 给 <tt>s</tt>,</li><li><tt>assign_a(j,i)</tt> will assign i to j, j=i, without using the parse result.<br><tt>assign_a(j,i)</tt> 将 i 赋值给 j, j=i, 不使用分析的结果。</li></ol> <p> Technically, the expression <tt>assign_a(v)</tt> is a template function that generates a semantic action. In fact, actor instances are not created directly since they usually involve a number of template parameters. Instead generator - functions (&quot;helper functions&quot;) are provided to generate actors from - their arguments. All helper functions have the &quot;_a&quot; suffix. For example, - <tt>append_actor</tt> is created using the <tt>append_a</tt> function. </p>
+  functions ("helper functions") are provided to generate actors from
+  their arguments. All helper functions have the "_a" suffix. For example,
+ <tt>append_actor</tt> is created using the <tt>append_a</tt> function.<br>技术上,表达式 <tt>assign_a(v)</tt> 是一个生成语义动作的模板函 数。事实上,动作器实例都不是直接创建的,因为它们通常需要多个模板参数。取而代 之的是一些生成器函数("辅助函数"),用于从它们的参数生成动作器。所有辅助函数都 带有"_a"后缀。例如,<tt>append_actor</tt> 就是用 <tt>append_a</tt> 函数生成 的。 </p>
 <p>
 The semantic action generated is polymorphic and should work with any
type as long as it is compatible with the arguments received from the parser. It might not be obvious, but a string can accept the iterator first and last arguments that are passed into a generic semantic action (see above). In fact, any STL container that has an <tt>assign(first, last)</tt> member function can be
-used.</p>
-<h2>Actors summary</h2><p>
-Below are tables summarizing the &quot;built-in&quot; actors with the
-conventions given below.</p>
+used.<br>所生成的语意动作是多态的,并且应能够处理任何兼容于传递自分析器的参 数类型的类型。这可能很绕口,但比如一个 string 可以接受一个传入所产生的语义动 作的 first, last 迭代器对(见上)。实际上,任何有 <tt>assign(first, last)</tt> 成员函数的标准库容器都可以使用。<tt></tt></p>
+<h2>Actors summary 动作器概要</h2><p>
+Below are tables summarizing the "built-in" actors with the
+conventions given below.<br>后面的表格概括了符合下述约定的“内建”动作器。 </p>
 <ul>
<li><tt>ref</tt> is a <b>reference</b> to an object stored in a policy holder
-    actor</li>
+ actor<br><tt>ref</tt>&nbsp;是一个对对象的<span style="font-weight: bold;">引用</span>,储存于策略持有者动作器</li> <li><tt>value_ref</tt> and <tt>key_ref</tt> are <b>const reference</b>s stored
-    in a policy holder actor</li>
+ in a policy holder actor<br><tt>value_ref</tt> 和 <tt>key_ref</tt> 是 <b>常量引用</b>,储存于策略持有者动作器</li> <li><tt>value</tt> is the <b>parse result</b>. This could be the result for
-    the single argument () operator or the two argument () operator</li>
+ the single argument () operator or the two argument () operator<br><tt>value</tt> 是<b>分析结果</b>。这可以是适用于单参数或双参数的 ()操作符</li> <li><tt>vt</tt> stands for the <tt>value_type</tt> type: <tt>type&amp; ref; + // vt is type::value_type</tt>.<br><tt>vt</tt> 即 <tt>value_type</tt> 类型:<tt>type&amp; ref;
     // vt is type::value_type</tt>.</li>
 </ul>
-<p> Note that examples are provided after the tables.</p>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="8"> Unary operator actors</td>
+<p> Note that examples are provided after the tables.<br>留意表格后面的例 子。</p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td class="table_title" colspan="8"> Unary operator actors 单参动作器 </td>
   </tr>
- <td width="30%" class="table_cells">++ref</td> <td width="70%" class="table_cells"><b>increment_a</b>(ref)</td> + <tr><td class="table_cells" width="30%">++ref</td> <td class="table_cells" width="70%"><b>increment_a</b>(ref)</td>
   </tr>
- <td class="table_cells">--ref</td> <td class="table_cells"><b>decrement_a</b>(ref)</td> + <tr><td class="table_cells">--ref</td> <td class="table_cells"><b>decrement_a</b>(ref)</td>
   </tr>
-</table>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="26"> Assign actors</td>
+</tbody></table>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+    <td class="table_title" colspan="26"> Assign actors 赋值动作器</td>
   </tr>
   <tr>
     <td class="table_cells">ref = value</td>
     <td class="table_cells"><b>assign_a</b>(ref)</td>
   </tr>
-    <td width="30%" class="table_cells">ref = value_ref</td>
- <td width="70%" class="table_cells"><b>assign_a</b>(ref, value_ref)</td>
+    <tr><td class="table_cells" width="30%">ref = value_ref</td>
+ <td class="table_cells" width="70%"><b>assign_a</b>(ref, value_ref)</td>
   </tr>
-</table>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="30"> Container actors </td>
+</tbody></table>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+    <td class="table_title" colspan="30"> Container actors 容器动作器 </td>
   </tr>
   <tr>
-    <td width="30%" class="table_cells">ref.push_back(value)</td>
-    <td width="70%" class="table_cells"><b>push_back_a</b>(ref)</td>
+    <td class="table_cells" width="30%">ref.push_back(value)</td>
+    <td class="table_cells" width="70%"><b>push_back_a</b>(ref)</td>
   </tr>
-  <td class="table_cells">ref.push_back(value_ref)</td>
+  <tr><td class="table_cells">ref.push_back(value_ref)</td>
   <td class="table_cells"><b>push_back_a</b>(ref, value_ref)</td>
   </tr>
-  <td class="table_cells">ref.push_front(value)</td>
+  <tr><td class="table_cells">ref.push_front(value)</td>
   <td class="table_cells"><b>push_front_a</b>(ref)</td>
   </tr>
-  <td class="table_cells">ref.push_front(value_ref)</td>
+  <tr><td class="table_cells">ref.push_front(value_ref)</td>
   <td class="table_cells"><b>push_front_a</b>(ref, value_ref)</td>
   </tr>
-  <td class="table_cells">ref.clear()</td>
+  <tr><td class="table_cells">ref.clear()</td>
   <td class="table_cells"><b>clear_a</b>(ref)</td>
   </tr>
-</table>
-<table width="90%" border="0" align="center">
-  <tr>
- <td class="table_title" colspan="14"> Associative container actors </td>
+</tbody></table>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td class="table_title" colspan="14"> Associative container actors 关联 容器动作器 </td>
   </tr>
- <td width="30%" class="table_cells">ref.insert(vt(value, value_ref))</td> <td width="70%" class="table_cells"><b>insert_key_a</b>(ref, value_ref)</td> + <tr><td class="table_cells" width="30%">ref.insert(vt(value, value_ref))</td> <td class="table_cells" width="70%"><b>insert_key_a</b>(ref, value_ref)</td>
   </tr>  <tr>
       <td class="table_cells"> ref.insert(vt(key_ref,value_ref)) </td>
<td class="table_cells"> <strong>insert_at_a</strong>(ref, key_ref_, value_ref)</td>
@@ -118,30 +116,30 @@
       <td class="table_cells"> ref.insert(vt(key_ref,value)) </td>
<td class="table_cells"> <strong>insert_at_a</strong>(ref, key_ref) </td>
     </tr>
-    <td class="table_cells">ref[value] = value_ref</td>
+    <tr><td class="table_cells">ref[value] = value_ref</td>
     <td class="table_cells"><b>assign_key_a</b>(ref, value_ref)</td>
   </tr>
-  <td class="table_cells">ref.erase(ref,value)</td>
+  <tr><td class="table_cells">ref.erase(ref,value)</td>
   <td class="table_cells"><b>erase_a</b>(ref)</td>
   </tr>
-  <td class="table_cells">ref.erase(ref,key_ref)</td>
+  <tr><td class="table_cells">ref.erase(ref,key_ref)</td>
     <td class="table_cells"><b>erase_a</b>(ref, key_ref)</td>
   </tr>
-</table>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="8"> Miscellanous actors </td>
+</tbody></table>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+ <td class="table_title" colspan="8"> Miscellanous actors 杂项动作器 </td>
   </tr>
   <tr>
-    <td width="30%" class="table_cells">swaps aref and bref</td>
- <td width="70%" class="table_cells"><strong>swap_a</strong>(aref, bref)</td> + <td class="table_cells" width="30%">swaps aref and bref<br>交换 &nbsp;aref 和 bref</td> + <td class="table_cells" width="70%"><strong>swap_a</strong>(aref, bref)</td>
   </tr>
-</table>
-<h3>Include Files</h3>
+</tbody></table>
+<h3>Include Files 包含文件</h3>
<p>The header files for the predefined actors are located in <tt>boost/spirit/actor</tt>. The file <tt>actors.hpp</tt> contains all the includes for all the actors. You may include just the specific header files that you need. The list below enumerates
-  the header files.</p>
+ the header files.<br>预定义动作器的头文件位于<tt>boost/spirit/actor。 </tt>文件&nbsp;<tt>actors.hpp</tt> 包含了所有动作器的头文件。你也可以仅仅包 含你所需要的特定头文件。下面列出这些头文件。</p> <pre> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">assign_actor</span><span class="special">.</span>hpp<span class="special">&gt;<br></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>assign_key_actor<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">clear_actor</span><span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">decrement_actor</span><span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span>
@@ -150,197 +148,125 @@
<span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">push_back_actor</span><span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">push_front_actor</span><span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span><span class="identifier">swap_actor</span><span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span></pre>
-<h3>Examples</h3>
-<h4>Increment a value</h4>
+<h3>Examples 例子</h3>
+<h4>Increment a value 递增某个值</h4>
 <p>
-Suppose that your input string is </p>
+Suppose that your input string is<br>假设你的输入串为 </p>
 <code>
-<pre>    1,2,-3,4,...
-</pre>
-</code><p>
-and we want to count the number of ints. The actor <tt>increment_a</tt> applies <tt>++</tt> to its reference:</p>
+</code><pre>    1,2,-3,4,...<br></pre>
+<p>
+and we want to count the number of ints. The actor <tt>increment_a</tt> applies <tt>++</tt> to its reference:<br>而你想统计整数的个数。动作器 <tt>increment_a</tt> 对其引用的对象使用 <tt>++:</tt></p>
 <code>
-<pre> <span class=keyword>int </span><span class=identifier>count </span><span class=special>= </span><span class=number>0</span><span class=special>; - </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>r </span><span class=special>= </span><span class=identifier>list_p</span><span class=special>.</span><span class=identifier>direct</span><span class=special>(</span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>increment_a</span><span class=special>(</span><span class=identifier>count</span><span class=special>)], </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>));</span></pre>
-</code>
-<h4>Append values to a vector (or other container)</h4>
+</code><pre> <span class="keyword">int </span><span class="identifier">count </span><span class="special">= </span><span class="number">0</span><span class="special">; <br> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">r </span><span class="special">= </span><span class="identifier">list_p</span><span class="special">.</span><span class="identifier">direct</span><span class="special">(</span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">increment_a</span><span class="special">(</span><span class="identifier">count</span><span class="special">)], </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">));</span></pre>
+
+<h4>Append values to a vector (or other container) 将某些值添加到vector(或 其它容器)</h4> <p> Here, you want to fill a <tt>vector&lt;int&gt;</tt> with the numbers. The actor <tt>push_back_a</tt> can be used to insert the integers at the back of
-  the vector:</p>
+ the vector:<br>这里,你想向一个 <tt>vector&lt;int&gt;</tt>&nbsp;填充数 值。那么动作器 <tt>push_back_a</tt> 可以用来向&nbsp;<tt>vector</tt> 的后端插 入整数:</p>
 <code>
-<pre> <span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt; </span><span class=identifier>v</span><span class=special>; - </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>r </span><span class=special>= </span><span class=identifier>list_p</span><span class=special>.</span><span class=identifier>direct</span><span class=special>(</span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>push_back_a</span><span class=special>(</span><span class=identifier>v</span><span class=special>)], </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>','</span><span class=special>));</span></pre>
-</code>
-<h4>insert key-value pairs into a map</h4><p>
-Suppose that your input string is </p>
+</code><pre> <span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt; </span><span class="identifier">v</span><span class="special">;<br> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">r </span><span class="special">= </span><span class="identifier">list_p</span><span class="special">.</span><span class="identifier">direct</span><span class="special">(</span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">push_back_a</span><span class="special">(</span><span class="identifier">v</span><span class="special">)], </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">','</span><span class="special">));</span></pre>
+
+<h4>insert key-value pairs into a map 将键-值对插入到一个map</h4><p>
+Suppose that your input string is<br>假设你输入的字符串为 </p>
 <code>
-<pre>    (1,2) (3,4) ...
-</pre>
-</code>
+</code><pre>    (1,2) (3,4) ... <br></pre>
+
<p> and you want to parse the pair into a <tt>map&lt;int,int&gt;</tt>. <tt>assign_a</tt> can be used to store key and values in a temporary key variable, while <tt>insert_a</tt>
-  is used to insert it into the map:</p>
-<pre> <code><span class=identifier>map</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>, </span><span class=keyword>int</span><span class="special">&gt;::</span>value_type<span class=keyword> </span>k<span class=special>; - </span><span class=identifier>map</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>, </span><span class=keyword>int</span><span class=special>&gt; </span><span class=identifier>m</span><span class=special>;
-
- </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>pair </span><span class=special>= </span><span class=identifier>
-        confix_p</span><span class=special>(
-            </span><span class=literal>'('</span><span class=special>
- , </span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span>k.first<span class=special>)] &gt;&gt; </span><span class=literal>','</span><span class=special> &gt;&gt; </span><span class=identifier>int_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span>k.second<span class=special>)]
-          ,</span><span class=literal> ')'
- </span><span class=special>)<br> [</span><span class=identifier>insert_at_a</span><span class=special>(</span><span class=identifier>m</span><span class=special>, </span><span class=identifier>k</span><span class=identifier></span><span class=special>)]
-        ;</span></code></pre>
-<h2>Policy holder actors and policy actions</h2>
+ is used to insert it into the map:<br>且你想分析这些数值并成对插入一个 <tt>map&lt;int,int&gt;</tt>。这里 <tt>assign_a</tt> 可以用来将键-值对保存在 一个临时变量中,同时&nbsp;<tt>insert_a</tt> 可以用来把它插入到 map:<tt></tt></p> +<pre> <code><span class="identifier">map</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">, </span><span class="keyword">int</span><span class="special">&gt;::</span>value_type<span class="keyword"> </span>k<span class="special">;<br> </span><span class="identifier">map</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">, </span><span class="keyword">int</span><span class="special">&gt; </span><span class="identifier">m</span><span class="special">;<br> <br> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">pair </span><span class="special">= </span><span class="identifier"> + confix_p</span><span class="special">(<br> </span><span class="literal">'('</span><span class="special"> + , </span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span>k.first<span class="special">)] &gt;&gt; </span><span class="literal">','</span><span class="special"> &gt;&gt; </span><span class="identifier">int_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span>k.second<span class="special">)]<br> ,</span><span class="literal"> ')'<br> </span><span class="special">)<br> [</span><span class="identifier">insert_at_a</span><span class="special">(</span><span class="identifier">m</span><span class="special">, </span><span class="identifier">k</span><span class="identifier"></span><span class="special">)]<br> ;</span></code></pre>
+<h2>Policy holder actors and policy actions 策略持有者动作器和策略动作</h2>
<p> The action takes place through a call to the <tt>()</tt> operator: single argument <tt>()</tt> operator call for character parsers and two argument (first, last) call for phrase parsers. Actors should implement at least one of the two
-  <tt>()</tt> operator.</p>
+ <tt>()</tt> operator.<br>语意动作通过对<tt>()</tt>操作符的调用被激活:单 参数的<tt>()</tt>操作符适用于字符分析器而双参数(first,last)的适用于句子分析 器。</p>
 <p>
 A lot of actors need to store reference to one or more objects. For
-example, actions on container need to store a reference to the container.</p> +example, actions on container need to store a reference to the container.<br>很多动作器需要储存一个或者更多的对象引用。比如,作用于容器的动 作需要储存这个容器的引用。</p> <p> Therefore, this kind of actor have been broken down into <strong>a)</strong> an action policy that does the action (act member function), <strong>b)</strong> - policy holder actor that stores the references and feeds the act member function.</p>
-<h3>Policy holder actors</h3>
-<p> The available policy holders are enumerated below.</p>
-<table width="90%" border="0" align="center">
-  <tr>
-    <td class="table_title" colspan="24"> Policy holders </td>
+ policy holder actor that stores the references and feeds the act member function.<br>因此,这类动作器被分割成<strong>a)</strong>一个实际执行动作 (act成员函数)的动作策略,<strong>b)</strong>持有传递给act成员函数的对象引用 的策略持有者动作器。</p>
+<h3>Policy holder actors 策略持有者动作器</h3>
+<p> The available policy holders are enumerated below.<br>可用的策略持有者 动作器列于下表:</p>
+<table align="center" border="0" width="90%">
+  <tbody><tr>
+    <td class="table_title" colspan="24"> Policy holders 策略持有者 </td>
   </tr>
   <tr>
-    <td class="table_cells">Name</td>
-    <td class="table_cells">Stored variables</td>
-    <td class="table_cells">Act signature</td>
+    <td class="table_cells">Name 名字</td>
+    <td class="table_cells">Stored variables 保存的变量</td>
+    <td class="table_cells">Act signature &nbsp;Act函数签名</td>
   </tr>
-  <td class="table_cells">ref_actor</td>
+  <tr><td class="table_cells">ref_actor</td>
   <td class="table_cells">1 reference</td>
   <td class="table_cells"><tt>act(ref)</tt></td>
   </tr>
-  <td class="table_cells">ref_value_actor</td>
+  <tr><td class="table_cells">ref_value_actor</td>
   <td class="table_cells">1 ref</td>
<td class="table_cells"> <tt>act(ref, value)</tt> or <tt>act(ref, first, last)</tt></td>
   </tr>
-    <td class="table_cells">ref_const_ref_actor</td>
+    <tr><td class="table_cells">ref_const_ref_actor</td>
   <td class="table_cells">1 ref and 1 const ref</td>
   <td class="table_cells"><tt>act(ref, const_ref)</tt></td>
   </tr>
-    <td class="table_cells">ref_const_ref_value_actor</td>
+    <tr><td class="table_cells">ref_const_ref_value_actor</td>
   <td class="table_cells">1 ref</td>
<td class="table_cells"><tt>act(ref, value)</tt> or <tt>act(ref, first, last)</tt></td>
   </tr>
-    <td class="table_cells">ref_const_ref_const_ref_actor</td>
+    <tr><td class="table_cells">ref_const_ref_const_ref_actor</td>
   <td class="table_cells">1 ref, 2 const ref</td>
   <td class="table_cells"><tt>act(ref, const_ref1, const_ref2)</tt></td>
   </tr>
-</table>
-<h3>Include Files</h3>
-<p>The predefined policy header files are located in <tt>boost/spirit/actor</tt>:</p>
+</tbody></table>
+<h3>Include Files 包含文件</h3>
+<p>The predefined policy header files are located in <tt>boost/spirit/actor</tt>:<br>预定义的策略持有者动作器的头文件位于 <tt>boost/spirit/actor:</tt></p> <pre> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_actor<span class="special">.</span>hpp<span class="special">&gt;<br></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_value_actor<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_const_ref<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_const_ref_value<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_const_ref_value<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span> <span class="preprocessor">#include</span> <span class="special">&lt;</span>boost<span class="special">/</span>spirit<span class="special">/</span>actor<span class="special">/</span>ref_const_ref_const_ref<span class="special">.</span>hpp<span class="special">&gt;</span><span class="special"></span></pre>
-<h3>Holder naming convention</h3>
-<p> Policy holder have the following naming convention:</p>
+<h3>Holder naming convention 持有者命名约定</h3>
+<p> Policy holder have the following naming convention:<br>策略持有者有如下 的命名约定:</p> <pre> <code>&lt;member&gt;_ &gt;&gt; *&lt;member&gt; &gt;&gt; !value &gt;&gt; actor</code></pre> -<p> where <tt>member</tt> is the action policy member which can be of type:</p> +<p> where <tt>member</tt> is the action policy member which can be of type:<br>这里 <tt>member</tt> 是动作策略成员,它的类型可以是:</p>
 <ul>
-  <li>ref, a reference</li>
-  <li>const_ref, a const reference</li>
-  <li>value, by value</li>
-  <li>empty, no stored members</li>
+  <li>ref, a reference<br>ref, 一个引用</li>
+  <li>const_ref, a const reference<br>const_ref, 一个常量引用</li>
+  <li>value, by value<br>value, 传值方式</li>
+  <li>empty, no stored members<br>empty,无存储成员</li>
 </ul>
-<p> and <tt>value</tt> states if the policy uses the parse result or not.</p>
-<h3>Holder example: <tt>ref_actor</tt> class</h3>
-<pre><code> <span class=comment>// this is the building block for action that
-    // take a reference and the parse result
-
-    </span><span class=keyword>template</span><span class=special>&lt;
- </span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>,</span><span class="comment"> // reference type</span><span class=identifier> - </span><span class=keyword>typename </span><span class=identifier>ActionT </span><span class=comment>// action policy
-    </span><span class=special>&gt;
- </span><span class=keyword>class </span><span class=identifier>ref_value_actor </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>ActionT
-    </span><span class=special>{
-</span>    <span class=keyword>public</span><span class=special>:
-
- </span><span class=keyword>explicit </span><span class=identifier>ref_value_actor</span><span class=special>(</span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>ref_</span><span class=special>) - : </span><span class=identifier>ref</span><span class=special>(</span><span class=identifier>ref_</span><span class=special>){}
-
- </span><span class=keyword>template</span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T2</span><span class=special>&gt; - </span><span class=keyword>void operator</span><span class=special>()(</span><span class=identifier>T2 </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>val</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=identifier>act</span><span class=special>(</span><span class=identifier>ref</span><span class=special>, </span><span class=identifier>val</span><span class=special>);</span><span class="comment"> // defined in ActionT</span><span class=identifier>
-        </span><span class=special>}
-
- </span><span class=keyword>template</span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>IteratorT</span><span class=special>&gt; - </span><span class=keyword>void operator</span><span class=special>()( - </span><span class=identifier>IteratorT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>first</span><span class=special>, - </span><span class=identifier>IteratorT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>last</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=identifier>act</span><span class=special>(</span><span class=identifier>ref</span><span class=special>,</span><span class=identifier>first</span><span class=special>,</span><span class=identifier>last</span><span class=special>);</span><span class="comment"> // defined in ActionT</span><span class=identifier>
-        </span><span class=special>}
-
-    </span><span class=keyword>private</span><span class=special>:
-
-</span><span class=identifier> T</span><span class=special>&amp; </span><span class=identifier>ref</span><span class=special>;
-    };</span></code></pre>
-<h3>Actor example: <tt>assign_actor</tt></h3>
+<p> and <tt>value</tt> states if the policy uses the parse result or not.<br>而 <tt>value</tt>&nbsp;标明策略是否使用分析结果。</p> +<h3>Holder example: <tt>ref_actor</tt> class 持有者例 子:<tt>ref_actor</tt> 类</h3> +<pre><code> <span class="comment">// this is the building block for action that <br> // take a reference and the parse result<br><br> </span><span class="keyword">template</span><span class="special">&lt;<br> </span><span class="keyword">typename </span><span class="identifier">T</span><span class="special">,</span><span class="comment"> // reference type</span><span class="identifier"> + </span><span class="keyword">typename </span><span class="identifier">ActionT </span><span class="comment">// action policy<br> </span><span class="special">&gt;<br> </span><span class="keyword">class </span><span class="identifier">ref_value_actor </span><span class="special">: </span><span class="keyword">public </span><span class="identifier">ActionT<br> </span><span class="special">{<br></span> <span class="keyword">public</span><span class="special">:<br><br> </span><span class="keyword">explicit </span><span class="identifier">ref_value_actor</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp; </span><span class="identifier">ref_</span><span class="special">)<br> : </span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">ref_</span><span class="special">){}<br><br> </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">T2</span><span class="special">&gt;<br> </span><span class="keyword">void operator</span><span class="special">()(</span><span class="identifier">T2 </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">val</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="identifier">act</span><span class="special">(</span><span class="identifier">ref</span><span class="special">, </span><span class="identifier">val</span><span class="special">);</span><span class="comment"> // defined in ActionT</span><span class="identifier"> + </span><span class="special">}<br><br> </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">IteratorT</span><span class="special">&gt;<br> </span><span class="keyword">void operator</span><span class="special">()(<br> </span><span class="identifier">IteratorT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">first</span><span class="special">,<br> </span><span class="identifier">IteratorT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">last</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="identifier">act</span><span class="special">(</span><span class="identifier">ref</span><span class="special">,</span><span class="identifier">first</span><span class="special">,</span><span class="identifier">last</span><span class="special">);</span><span class="comment"> // defined in ActionT</span><span class="identifier"> + </span><span class="special">}<br><br> </span><span class="keyword">private</span><span class="special">: <br><br></span><span class="identifier"> T</span><span class="special">&amp; </span><span class="identifier">ref</span><span class="special">;<br> };</span></code></pre> +<h3>Actor example: <tt>assign_actor</tt> &nbsp;动作器例 子:<tt>assign_actor</tt></h3>
 <code>
-<pre> <span class=comment>// assign_action assigns the parse result to the reference
-
- </span><span class=keyword>struct </span><span class=identifier>assign_action
-    </span><span class=special>{
-        </span><span class=keyword>template</span><span class=special>&lt;
- </span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>, - </span><span class=keyword>typename </span><span class=identifier>ValueT
-        </span><span class=special>&gt;
- </span><span class=keyword>void </span><span class=identifier>act</span><span class=special>(</span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>ref</span><span class=special>, </span><span class=identifier>ValueT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>value</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=identifier>ref</span><span class=special> = </span><span class=special></span><span class=identifier>value</span><span class=special>;
-        }
-
-        </span><span class=keyword>template</span><span class=special>&lt;
- </span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>, - </span><span class=keyword>typename </span><span class=identifier>IteratorT
-        </span><span class=special>&gt;
- </span><span class=keyword>void </span><span class=identifier>act</span><span class=special>( - </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>ref</span><span class=special>, - </span><span class=identifier>IteratorT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>first</span><span class=special>, - </span><span class=identifier>IteratorT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>last</span><span class=special>) </span><span class=keyword>const
-        </span><span class=special>{
- </span><span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>::</span><span class=identifier>value_type </span><span class=identifier>value_type</span><span class=special>; - </span><span class=identifier>value_type </span><span class=identifier>vt</span><span class=special>(</span><span class=identifier>first</span><span class=special>,</span><span class=identifier> last</span><span class=special>); - </span><span class=identifier>ref</span><span class=special> = </span><span class=special></span><span class=identifier>vt</span><span class=special>;
-        }
-    };</span></pre>
-</code>
-<h3>Helper function example: <tt>assign_a</tt> function</h3>
+</code><pre> <span class="comment">// assign_action assigns the parse result to the reference<br><br> </span><span class="keyword">struct </span><span class="identifier">assign_action<br> </span><span class="special">{<br> </span><span class="keyword">template</span><span class="special">&lt;<br> </span><span class="keyword">typename </span><span class="identifier">T</span><span class="special">,<br> </span><span class="keyword">typename </span><span class="identifier">ValueT<br> </span><span class="special">&gt;<br> </span><span class="keyword">void </span><span class="identifier">act</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp; </span><span class="identifier">ref</span><span class="special">, </span><span class="identifier">ValueT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">value</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="identifier">ref</span><span class="special"> = </span><span class="special"></span><span class="identifier">value</span><span class="special">;<br> }<br> <br> </span><span class="keyword">template</span><span class="special">&lt;<br> </span><span class="keyword">typename </span><span class="identifier">T</span><span class="special">,<br> </span><span class="keyword">typename </span><span class="identifier">IteratorT<br> </span><span class="special">&gt;<br> </span><span class="keyword">void </span><span class="identifier">act</span><span class="special">(<br> </span><span class="identifier">T</span><span class="special">&amp; </span><span class="identifier">ref</span><span class="special">, <br> </span><span class="identifier">IteratorT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">first</span><span class="special">, <br> </span><span class="identifier">IteratorT </span><span class="keyword">const</span><span class="special">&amp; </span><span class="identifier">last</span><span class="special">) </span><span class="keyword">const<br> </span><span class="special">{<br> </span><span class="keyword">typedef </span><span class="keyword">typename </span><span class="identifier">T</span><span class="special">::</span><span class="identifier">value_type </span><span class="identifier">value_type</span><span class="special">;<br> </span><span class="identifier">value_type </span><span class="identifier">vt</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span><span class="identifier"> last</span><span class="special">);<br> </span><span class="identifier">ref</span><span class="special"> = </span><span class="special"></span><span class="identifier">vt</span><span class="special">;<br> }<br> };</span></pre>
+
+<h3>Helper function example: <tt>assign_a</tt> function &nbsp;辅助函数例 子:<tt>assign_a</tt> 函数</h3>
 <code>
-<pre>
- <span class=comment>// assign_a is a polymorphic helper function that generators an
-    // assign_actor based on ref_value_actor, assign_action and the
-    // type of its argument.
-
- </span><span class=keyword>template</span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>T</span><span class=special>&gt; - </span><span class=keyword>inline </span><span class=identifier>ref_value_actor</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>, </span>assign<span class=identifier>_action</span><span class=special>&gt;</span><span class=identifier> - assign_a</span><span class=special>(</span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>ref</span><span class=special>)
-    {
- </span><span class=keyword>return </span><span class=identifier>ref_value_actor</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>,</span><span class=identifier> assign_action</span><span class=special>&gt;(</span><span class=identifier>ref</span><span class=special>);
-    }</span></pre>
-</code>
+</code><pre> <span class="comment">// assign_a is a polymorphic helper function that generators an<br> // assign_actor based on ref_value_actor, assign_action and the <br> // type of its argument.<br><br> </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename </span><span class="identifier">T</span><span class="special">&gt;<br> </span><span class="keyword">inline </span><span class="identifier">ref_value_actor</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">, </span>assign<span class="identifier">_action</span><span class="special">&gt;</span><span class="identifier"> + assign_a</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp; </span><span class="identifier">ref</span><span class="special">)<br> {<br> </span><span class="keyword">return </span><span class="identifier">ref_value_actor</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span><span class="identifier"> assign_action</span><span class="special">&gt;(</span><span class="identifier">ref</span><span class="special">);<br> }</span></pre>
+
 <table border="0">
-  <tr>
+  <tbody><tr>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="indepth_the_parser_context.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> - <td width="20"><a href="parametric_parsers.html"><img src="theme/r_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="indepth_the_parser_context.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> + <td width="20"><a href="parametric_parsers.html"><img src="theme/r_arr.gif" border="0" height="19" width="20"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003 <font color="#666666">Jonathan de Halleux</font><font size="2"><font size="2"><font color="#666666"> +<p class="copyright">Copyright © 2003 <font color="#666666">Jonathan de Halleux</font><font size="2"><font size="2"><font color="#666666">
   </font></font> </font><br>
-  Copyright &copy; 2003 Joel de Guzman<br>
+  Copyright © 2003 Joel de Guzman<br>
   <br>
- <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+  <font size="2">Use,
+modification and distribution is subject to the Boost Software License,
+Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt) </font>  </p>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/refactoring.html     Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/refactoring.html     Sun Sep 20 23:13:57 2009
@@ -1,28 +1,26 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Refactoring Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="theme/style.css" rel="stylesheet" type="text/css">
-</head>
+<html><head>
+
+<title>Refactoring Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="theme/style.css" rel="stylesheet" type="text/css"></head>

 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
- <td width="10"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>&nbsp;</b></font></td> - <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Refactoring Parsers</b></font></td> - <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
+ <td width="10"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>&nbsp;</b></font></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Refactoring Parsers 重构分析器</b></font></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="functor_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="regular_expression_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p><a name="refactoring_parsers"></a>There are three types of Refactoring Parsers implemented right now, which help to abstract common parser refactoring tasks. Parser refactoring means, that a concrete parser construct is replaced (refactored)
@@ -32,49 +30,49 @@
Parsers</a> and <a href="list_parsers.html">List Parsers</a>. The third Refactoring Parser (<tt>attach_action_parser</tt>) is implemented to abstract some functionality
   required for the Grouping Parser. Nevertheless
- these Refactoring Parsers may help in solving other complex parsing tasks too.</p>
-<h3>Refactoring unary parsers</h3>
+ these Refactoring Parsers may help in solving other complex parsing tasks too.<br>目前已经实现了三种重构分析器,它们有助于抽象分析器的一般重构方 法。分析器重构意味着,一个特定的分析器构造被一个非常相像的分析器构造所替代。 这节所描述的两种重构分析器(<tt>refactor_unary_parser</tt> 和 <tt>refactor_action_parser</tt><tt></tt>)的作用是在使用<a href="confix.html">片段分析器</a>和<a href="list_parsers.html">列表分析器 </a>时,能够使用简单乃至更加复杂的符号。第三个所实现的抽象分析器 (<tt>attach_action_parser</tt>) 用于抽象在为分析器编组时所需的某些功能。然而 以上这些重构分析器在应对其他复杂的分析上仍有帮助。</p>
+<h3>Refactoring unary parsers 重构一元分析器</h3>
<p>The <tt>refactor_unary_d</tt> parser generator, which should be used to generate - a unary refactoring parser, transforms a construct of the following type</p> -<pre><code> <span class=identifier>refactor_unary_d</span><span class=special>[*</span><span class=identifier>some_parser </span><span class=special>- </span><span class=identifier>another_parser</span><span class=special>]</span></code></pre>
-<p>to </p>
-<pre><code> <span class=special>*(</span><span class=identifier>some_parser</span> <span class=special>- </span><span class=identifier>another_parser</span><span class=special>)</span></code></pre> + a unary refactoring parser, transforms a construct of the following type<br><tt>refactor_unary_d</tt><span style="font-family: Courier New;">&nbsp;分析器生成器,用于生成一元重构分析器,转换下面类型的构造 </span></p> +<pre><code> <span class="identifier">refactor_unary_d</span><span class="special">[*</span><span class="identifier">some_parser </span><span class="special">- </span><span class="identifier">another_parser</span><span class="special">]</span></code></pre>
+<p>to<br>为 </p>
+<pre><code> <span class="special">*(</span><span class="identifier">some_parser</span> <span class="special">- </span><span class="identifier">another_parser</span><span class="special">)</span></code></pre>
 <blockquote>
<p>where <tt>refactor_unary_d</tt> is a predefined object of the parser generator
-    struct <tt>refactor_unary_gen&lt;&gt;</tt></p>
+ struct <tt>refactor_unary_gen&lt;&gt;</tt><br>其中 <tt>refactor_unary_d</tt> 是分析器生成器结构 <tt>refactor_unary_gen&lt;&gt;</tt> 的一个预定义对象<tt></tt></p>
 </blockquote>
<p>The <tt>refactor_unary_d</tt> parser generator generates a new parser as shown above, only if the original construct is an auxilliary binary parser (here the difference parser) and the left operand of this binary parser is an auxilliary unary parser (here the kleene star operator). If the original parser isn't a binary parser the compilation will fail. If the left operand isn't an unary
-  parser, no refactoring will take place.</p>
-<h3>Refactoring action parsers</h3>
+ parser, no refactoring will take place.<br><tt>refactor_unary_d</tt><span style="font-family: Courier New;">&nbsp;</span>分析器生成器只在原始的构造为辅助的二元分析器(这里为减号 )且这个二元分析器左边的算子为辅助的一元分析器(这里是克林星操作符)时,才生 成如上所示的新的分析器。如果原始的分析器不是二元分析器则产生编译失败。如果左 边的算子不是一元分析器,则重构不会发生。</p>
+<h3>Refactoring action parsers&nbsp;重构动作分析器</h3>
<p>The <tt>refactor_action_d</tt> parser generator, which should be used to generate - an action refactoring parser, transforms a construct of the following type</p> -<pre><code> <span class=identifier>refactor_action_d</span><span class=special>[</span><span class=identifier>some_parser</span><span class=special>[</span><span class=identifier>some_actor</span><span class=special>] </span><span class=special>- </span><span class=identifier>another_parser</span><span class=special>]</span></code></pre>
-<p>to </p>
-<pre><code> <span class=special>(</span><span class=identifier>some_parser </span><span class=special>- </span><span class=identifier>another_parser</span><span class=special>)[</span><span class=identifier>some_actor</span><span class=special>]</span></code></pre> + an action refactoring parser, transforms a construct of the following type<br> <tt>refactor_action_d</tt><span style="font-family: Courier New;"> </span>分析器生成器用于生成动作重构分析器,转换如下类型的结构</p> +<pre><code> <span class="identifier">refactor_action_d</span><span class="special">[</span><span class="identifier">some_parser</span><span class="special">[</span><span class="identifier">some_actor</span><span class="special">] </span><span class="special">- </span><span class="identifier">another_parser</span><span class="special">]</span></code></pre>
+<p>to<br>为 </p>
+<pre><code> <span class="special">(</span><span class="identifier">some_parser </span><span class="special">- </span><span class="identifier">another_parser</span><span class="special">)[</span><span class="identifier">some_actor</span><span class="special">]</span></code></pre>
 <blockquote>
<p>where <tt>refactor_action_d</tt> is a predefined object of the parser generator
-    struct <tt>refactor_action_gen&lt;&gt;</tt></p>
+ struct <tt>refactor_action_gen&lt;&gt;</tt><br>其中 <tt>refactor_</tt><tt>action</tt><tt>_d</tt> 是分析器生成器结构 <tt>refactor_</tt><tt>action</tt><tt>_gen&lt;&gt;</tt> 的一个预定义对象</p>
 </blockquote>
<p>The <tt>refactor_action_d</tt> parser generator generates a new parser as shown above, only if the original construct is an auxilliary binary parser (here the difference parser) and the left operand of this binary parser is an auxilliary parser generated by an attached semantic action. If the original parser isn't a binary parser the compilation will fail. If the left operand isn't an action
-  parser, no refactoring will take place.</p>
-<h3>Attach action refactoring</h3>
+ parser, no refactoring will take place.<br><tt>refactor_action_d</tt><span style="font-family: Courier New;">&nbsp;</span>分析器生成器仅当原始的构造为辅助的二元分析器(这里为减号 )且这个二元分析器左边的算子为生成自所挂接的语义动作的辅助分析器时,才生成如 上所示的新的分析器。如果原始的分析器不是二元分析器则产生编译失败。如果左边的 算子不是动作分析器,则重构不会发生。</p>
+<h3>Attach action refactoring&nbsp;挂接动作重构</h3>
<p>The <tt>attach_action_d</tt> parser generator, which should be used to generate an attach action refactoring parser, transforms a construct of the following
-  type</p>
-<pre><code> <span class=identifier>attach_action_d</span><span class=special>[</span><span class=identifier>(some_parser</span> <span class=special>&gt;&gt; </span><span class=identifier>another_parser</span>)<span class=special>[</span><span class=identifier>some_actor</span><span class=special>]</span><span class=special>]</span></code></pre>
-<p>to </p>
-<pre><code> <span class=identifier>some_parser</span><span class=special>[</span><span class=identifier>some_actor</span><span class=special>]</span><span class=identifier> </span><span class=special>&gt;&gt; </span><span class=identifier>another_parser</span><span class=special>[</span><span class=identifier>some_actor</span><span class=special>]</span></code></pre> + type<br><tt>attach_action_d</tt><span style="font-family: Courier New;">&nbsp;</span>分析器生成器,用于生成挂接动作重构分析器,转换如下类型的 结构</p> +<pre><code> <span class="identifier">attach_action_d</span><span class="special">[</span><span class="identifier">(some_parser</span> <span class="special">&gt;&gt; </span><span class="identifier">another_parser</span>)<span class="special">[</span><span class="identifier">some_actor</span><span class="special">]</span><span class="special">]</span></code></pre>
+<p>to<br>为 </p>
+<pre><code> <span class="identifier">some_parser</span><span class="special">[</span><span class="identifier">some_actor</span><span class="special">]</span><span class="identifier"> </span><span class="special">&gt;&gt; </span><span class="identifier">another_parser</span><span class="special">[</span><span class="identifier">some_actor</span><span class="special">]</span></code></pre>
 <blockquote>
<p>where <tt>attach_action_d</tt> is a predefined object of the parser generator
-    struct <tt>attach_action_gen&lt;&gt;</tt></p>
+ struct <tt>attach_action_gen&lt;&gt;</tt><br>其中 &nbsp;<tt>attach</tt><tt>_</tt><tt>action</tt><tt>_d</tt> 是分析器生成器结构 &nbsp;<tt>attach</tt><tt>_</tt><tt>action</tt><tt>_gen&lt;&gt;</tt> 的一个预 定义对象</p>
 </blockquote>

<p>The <tt>attach_action_d</tt> parser generator generates a new parser as shown
@@ -82,44 +80,42 @@
parser to it this action is attached is an auxilliary binary parser (here the sequence parser). If the original parser isn't a action parser the compilation will fail. If the parser to which the action is attached isn't an binary parser,
-  no refactoring will take place.</p>
-<h3>Nested refactoring</h3>
+ no refactoring will take place.<br><tt>attach_action_d</tt> 分析器生成器 仅当原始构造是一个动作分析器且这个动作所挂接的分析器是一个二元分析器(这里是 并置分析器)时,才生成如上所示新的分析器。如果原始的分析器不是动作分析器则编 译失败。如果动作所挂接到的分析器不是二元分析器,则重构不会发生。</p>
+<h3>Nested refactoring 嵌套重构</h3>
<p>Sometimes it is required to nest different types of refactoring, i.e. to transform
-  constructs like</p>
-<pre><code> <span class=special>(*</span><span class=identifier>some_parser</span><span class=special>)[</span><span class=identifier>some_actor</span><span class=special>] </span><span class=special>- </span><span class=identifier>another_parser</span></code></pre>
-<p>to </p>
-<pre><code> <span class=special>(*(</span><span class=identifier>some_parser </span><span class=special>- </span><span class=identifier>another_parser</span><span class=special>))[</span><span class=identifier>some_actor</span><span class=special>]</span></code></pre>
+  constructs like<br>有时需要嵌套不同类型的重构,比如转化类似下面的结构</p>
+<pre><code> <span class="special">(*</span><span class="identifier">some_parser</span><span class="special">)[</span><span class="identifier">some_actor</span><span class="special">] </span><span class="special">- </span><span class="identifier">another_parser</span></code></pre>
+<p>to<br>为 </p>
+<pre><code> <span class="special">(*(</span><span class="identifier">some_parser </span><span class="special">- </span><span class="identifier">another_parser</span><span class="special">))[</span><span class="identifier">some_actor</span><span class="special">]</span></code></pre> <p>To simplify the construction of such nested refactoring parsers the <tt>refactor_unary_gen&lt;&gt;</tt> and <tt>refactor_action_gen&lt;&gt;</tt> both can take another refactoring parser generator type as their respective template parameter. For instance, to construct a refactoring parser generator for the mentioned nested transformation we should
-  write:</p>
-<pre><span class=special> </span><span class=keyword>typedef </span><span class=identifier>refactor_action_gen</span><span class=special>&lt;</span><span class=identifier>refactor_unary_gen</span><span class=special>&lt;&gt; </span><span class=special>&gt; </span><span class=identifier>refactor_t</span><span class=special>; - </span><span class=keyword>const </span><span class=identifier>refactor_t </span><span class=identifier>refactor_nested_d </span><span class=special>= </span><span class=identifier>refactor_t</span><span class=special>(</span><span class=identifier>refactor_unary_d</span><span class=special>);</span></pre>
-<p>Now we could use it as follows to get the required result:</p>
-<pre><code><font color="#0000FF"> </font><span class=identifier>refactor_nested_d</span><span class=special>[(*</span><span class=identifier>some_parser</span><span class=special>)[</span><span class=identifier>some_actor</span><span class=special>] </span><span class=special>- </span><span class=identifier>another_parser</span><span class=special>]</span></code></pre> + write:<br>为了简化这类嵌套重构分析器的构 造,<tt>refactor_unary_gen&lt;&gt;</tt><span style="font-family: Courier New;"></span> 和 <tt>refactor_action_gen&lt;&gt;</tt> 都可以接受对方的分析器 生成器类型为自己的模板参数。比如,要构造一个我们上面提到的分析器生成器,应该 这么写:</p> +<pre><span class="special"> </span><span class="keyword">typedef </span><span class="identifier">refactor_action_gen</span><span class="special">&lt;</span><span class="identifier">refactor_unary_gen</span><span class="special">&lt;&gt; </span><span class="special">&gt; </span><span class="identifier">refactor_t</span><span class="special">;<br> </span><span class="keyword">const </span><span class="identifier">refactor_t </span><span class="identifier">refactor_nested_d </span><span class="special">= </span><span class="identifier">refactor_t</span><span class="special">(</span><span class="identifier">refactor_unary_d</span><span class="special">);</span></pre> +<p>Now we could use it as follows to get the required result:<br>现在我们可 以像下面那样使用以获得所需的结果:</p> +<pre><code><font color="#0000ff"> </font><span class="identifier">refactor_nested_d</span><span class="special">[(*</span><span class="identifier">some_parser</span><span class="special">)[</span><span class="identifier">some_actor</span><span class="special">] </span><span class="special">- </span><span class="identifier">another_parser</span><span class="special">]</span></code></pre> <p>An empty template parameter means not to nest this particular refactoring parser. The default template parameter is <tt>non_nesting_refactoring</tt>, a predefined helper structure for inhibiting nesting. Sometimes it is required to nest a particular refactoring parser with itself. This is achieved by providing the predefined helper structure <tt>self_nested_refactoring</tt> as the template
-  parameter to the corresponding refactoring parser generator template.</p>
-<p><img src="theme/lens.gif" width="15" height="16"> See <a href="../example/fundamental/refactoring.cpp">refactoring.cpp</a> for a compilable example. This is part of the Spirit distribution. </p> + parameter to the corresponding refactoring parser generator template.<br>空的模板参数意味着不嵌套特定的重构分析器。默认的模板参数为 <tt>non_nesting_refactoring</tt><span style="font-family: Courier New;">,一 个用于限制嵌套的预定义的辅助结构。有时特定的重构分析器需要嵌套自身。这是借由 把预定义的辅助结构 <tt>self_nested_refactoring</tt> 作为对应的分析器生成器的 模板参数来实现的。</span></p> +<p><img src="theme/lens.gif" height="16" width="15"> See <a href="../example/fundamental/refactoring.cpp">refactoring.cpp</a> for a compilable example. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15">&nbsp;可编译的例子见 <a href="../example/fundamental/refactoring.cpp">refactoring.cpp</a>,这是 Spirit发布包的组成部分。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="functor_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="regular_expression_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2001-2003 Hartmut Kaiser<br>
+<p class="copyright">Copyright © 2001-2003 Hartmut Kaiser<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p>&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/regular_expression_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/regular_expression_parser.html Sun Sep 20 23:13:57 2009
@@ -1,37 +1,35 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Regular Expression Parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="theme/style.css" rel="stylesheet" type="text/css">
-</head>
+<html><head>
+
+<title>Regular Expression Parser</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="theme/style.css" rel="stylesheet" type="text/css"></head>

 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
- <td width="10" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>&nbsp;</b></font></td> - <td width="85%" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Regular Expression Parser</b></font></td> - <td width="112" height="49"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
+ <td height="49" width="10"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>&nbsp;</b></font></td> + <td height="49" width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Regular Expression Parser 正则表达式分析器 </b></font></td> + <td height="49" width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="refactoring.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="refactoring.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> <td width="30"><a href="scoped_lock.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p><a name="regular_expression_parser"></a>Regular expressions are a form of pattern-matching that are often used in text processing. Many users will be familiar with the usage of regular expressions. Initially there were the Unix utilities grep, sed and awk, and the programming language perl, each of which make extensive use of regular expressions. Today the usage of such regular expressions is integrated
-  in many more available systems.</p>
+ in many more available systems.<br>正则表达式是经常在字符处理中使用模式匹 配的一种形式。很多用户对正则表达式都很熟悉。最初是Unix的工具grep、sed和 awk,还有编程语言perl,这些都大量应用了正则表达式。今天对这样的正则表达式的 应用已经集成到了很多系统之中。</p> <p>During parser construction it is often useful to have the power of regular expressions available. The Regular Expression Parser was introduced, to make - the use of regular expressions accessible for Spirit parser construction.</p> + the use of regular expressions accessible for Spirit parser construction.<br>由于正则表达式对分析器的构造大有益处,所以正则表达式分析器 出现了,作为连接正则表达式与Spirit分析器的桥梁。</p> <p>The Regular Expression Parser <tt>rxstrlit</tt> has a single template type parameter: an iterator type. Internally, <tt>rxstrlit</tt> holds the Boost Regex object containing the provided regular expression. The <tt>rxstrlit</tt> attempts
@@ -40,28 +38,24 @@
<tt>rxstrlit</tt> has two constructors. The first accepts a null-terminated character pointer. This constructor may be used to build <tt>rxstrlit's</tt> from quoted regular expression literals. The second constructor takes in a first/last
-  iterator pair. The function generator version is <tt>regex_p</tt>. </p>
-<p>Here are some examples:</p>
-<pre><code><span class=comment> </span><span class=identifier>rxstrlit</span><span class=special>&lt;&gt;(</span><span class=string>"Hello[[:space:]]+[W|w]orld"</span><span class=special>) - </span><span class=identifier>regex_p</span><span class=special>(</span><span class=string>"Hello[[:space:]]+[W| w]orld"</span><span class=special>)
-
- </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>msg</span><span class=special>(</span><span class=string>"Hello[[:space:]]+[W|w]orld"</span><span class=special>); - rx</span><span class=identifier>strlit</span><span class=special>&lt;&gt;(</span><span class=identifier>msg</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(), </span><span class=identifier>msg</span><span class=special>.</span><span class=identifier>end</span><span class=special>());</span></code></pre> + iterator pair. The function generator version is <tt>regex_p</tt>.<br>正 则表达式分析器<span style="font-family: Courier New;">&nbsp;</span><tt>rxstrlit</tt> 只有一个模板参数:迭代器类型。在内 部,<tt>rxstrlit</tt> 有一个包含了给定的正则表达式的 Boost Regex 对象。 <tt>rxstrlit</tt> 尝试使用这个正则表达式来匹配当前输入流。模板参数默认值为 <span style="font-family: Courier New;"> </span><tt>char const<span class="operators">*</span></tt>。 <tt>rxstrlit</tt> 有两个构造函数。第一个接 受null结尾的字符串指针。这个构造函数可从引号括起的正则表达式字串构造<span style="font-family: Courier New;"> </span><tt>rxstrlit</tt><span style="font-family: Courier New;">。第二个构造函数接受 first/last 迭代器对。 它的函数生成器版本为 </span><tt>regex_p</tt><span style="font-family: Courier New;">。</span></p>
+<p>Here are some examples:<br>以下是一些例子:</p>
+<pre><code><span class="comment"> </span><span class="identifier">rxstrlit</span><span class="special">&lt;&gt;(</span><span class="string">"Hello[[:space:]]+[W| w]orld"</span><span class="special">)<br> </span><span class="identifier">regex_p</span><span class="special">(</span><span class="string">"Hello[[:space:]]+[W|w]orld"</span><span class="special">)<br><br> </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string </span><span class="identifier">msg</span><span class="special">(</span><span class="string">"Hello[[:space:]]+[W| w]orld"</span><span class="special">);<br> rx</span><span class="identifier">strlit</span><span class="special">&lt;&gt;(</span><span class="identifier">msg</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(), </span><span class="identifier">msg</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span></code></pre> <p>The generated parser object acts at the character level, thus an eventually given skip parser is not used during the attempt to match the regular expression
-  (see <a href="faq.html#scanner_business">The Scanner Business</a>).</p>
+ (see <a href="faq.html#scanner_business">The Scanner Business</a>).<br>所 生成的分析器对象作用于字符层面,因此实际上给定的忽略分析器在尝试匹配正则表达 式时并不工作(见<a href="faq.html#scanner_business">扫描器事务</a>)。</p> <p>The Regular Expression Parser is implemented by the help of the <a href="http://www.boost.org/libs/regex/index.html";>Boost
-  Regex++ library</a>, so you have to have some limitations in mind. </p>
+ Regex++ library</a>, so you have to have some limitations in mind.<br>正 则表达式分析器的实现依赖于<a href="http://www.boost.org/libs/regex/index.html";>Boost Regex++ 库</a>,因此 你要牢记某些限制。</p>
 <blockquote>
- <p><img src="theme/bullet.gif" width="12" height="12"> Boost libraries have + <p><img src="theme/bullet.gif" height="12" width="12"> Boost libraries have to be installed on your computer and the Boost root directory has to be added to your compiler <tt>#include&lt;...&gt;</tt> search path. You can download - the actual version at the <a href="http://www.boost.org/";>Boost web site</a>.</p> - <p><img src="theme/bullet.gif" width="12" height="12"> The Boost Regex library + the actual version at the <a href="http://www.boost.org/";>Boost web site</a>.<br>你的电脑里必须安装了Boost库,而Boost的根目录必须被添加到编译器 的 <tt>#include&lt;...&gt;</tt>&nbsp;的搜索路径中。你可以在<a href="http://www.boost.org/";>Boost网站</a>下载所需的版本。</p> + <p><img src="theme/bullet.gif" height="12" width="12"> The Boost Regex library requires the usage of bi-directional iterators. So you have to ensure this during the usage of the Spirit parser, which contains a Regular Expression
-    Parser.</p>
- <p><img src="theme/bullet.gif" width="12" height="12"> The Boost Regex library + Parser.<br>Boost Regex 库要求使用双向迭代器。所以在使用包含正则表达式分 析器的Spirit分析器时,这点必须得到保证。</p> + <p><img src="theme/bullet.gif" height="12" width="12"> The Boost Regex library is not a header only library, as Spirit is, though it provides the possibility to include all of the sources, if you are using it in one compilation unit only. Define the preprocessor constant <tt>BOOST_SPIRIT_NO_REGEX_LIB</tt> before
@@ -69,23 +63,22 @@
all the Boost Regex sources into this compilation unit. If you are using the Regular Expression Parser in more than one compilation unit, you should not define this constant and must link your application against the regex library
-    as described in the related documentation.</p>
+ as described in the related documentation.<br>Boost Regex 库不是一个只 有头文件的库(虽然Spirit如此),但它提供了包含所有必须的资源的能力,如果你只 在一个编译单元里使用它的话。在包含Spirit正则表达式分析器头文件之前定义预处理 常量 <tt>BOOST_SPIRIT_NO_REGEX_LIB</tt><span style="font-family: Courier New;">,如果你想把 Boost Regex 的所有资源包含在一个编译单元里的话。如果你在 不止一个的编译单元里使用正则表达式分析器,则不应该定义这个常量,而是依据相关 文档连接regex库到你的应用程序中。</span></p>
 </blockquote>
-<p> <img src="theme/lens.gif" width="15" height="16"> See <a href="../example/fundamental/regular_expression.cpp">regular_expression.cpp</a> for a compilable example. This is part of the Spirit distribution.</p> +<p> <img src="theme/lens.gif" height="16" width="15"> See <a href="../example/fundamental/regular_expression.cpp">regular_expression.cpp</a> for a compilable example. This is part of the Spirit distribution.<br><img src="theme/lens.gif" height="16" width="15"> 可编译的例子见 <a href="../example/fundamental/regular_expression.cpp">regular_expression.cpp</a>,这 是Spirit发布包的组成部分。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> - <td width="30"><a href="refactoring.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> + <td width="30"><a href="refactoring.html"><img src="theme/l_arr.gif" border="0" height="19" width="20"></a></td> <td width="30"><a href="scoped_lock.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2001-2002 Hartmut Kaiser<br>
+<p class="copyright">Copyright © 2001-2002 Hartmut Kaiser<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/scoped_lock.html     Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/scoped_lock.html     Sun Sep 20 23:13:57 2009
@@ -1,54 +1,51 @@
-<html>
-<head>
-<title>Scoped Lock</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Scoped Lock</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Scoped
-      Lock</b></font></td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Scoped
+      Lock 范围锁</b></font></td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="regular_expression_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="distinct.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <h2>scoped_lock_d</h2>
<p>The <tt>scoped_lock_d</tt> directive constructs a parser that locks a mutex
-  during the attempt to match the contained parser.</p>
-<p>Syntax:</p>
+ during the attempt to match the contained parser.<br><tt>scoped_lock_d</tt><span style="font-family: Courier New;">&nbsp;</span>定向器产生一个在尝试匹配所包含的分析器时锁定一个临界区的 分析器。</p>
+<p>Syntax:<br>语法:</p>
<pre> <span class="identifier">scoped_lock_d</span><span class="special">(</span>mutex<span class="special">&amp;)[</span>body-parser<span class="special">]</span></pre>
+
<p>Note, that nesting <tt>scoped_lock_d</tt> directives bears the risk of deadlocks since the order of locking depends on the grammar used and may even depend on the input being parsed. Locking order has to be consistent within an application
-  to ensure deadlock free operation.</p>
-<p></p>
+ to ensure deadlock free operation.<br>注意,嵌套的 <tt>scoped_lock_d</tt> 指示符有死锁的风险,因为锁定的顺序取决于所使用的语 法,且甚至取决于所分析的输入流。要做到排除死锁,锁定顺序在同一个应用中必须保 持一致。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="regular_expression_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="distinct.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003 Martin Wille<br>
+<p class="copyright">Copyright © 2003 Martin Wille<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/select_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/select_parser.html Sun Sep 20 23:13:57 2009
@@ -1,7 +1,7 @@
-<html>
-<head>
-<title>The Select Parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>The Select Parser</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link rel="stylesheet" href="theme/style.css" type="text/css">
 <style type="text/css">
 <!--
@@ -9,88 +9,88 @@
 .style2 {font-family: "Courier New", Courier, mono; font-style: italic; }
 .style3 {font-family: "Courier New", Courier, mono; color: #FF0000; }
 -->
-</style>
-</head>
-
+</style></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10"> </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>The Select Parser </b></font></td> - <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>The Select Parser 选择分析器 </b></font></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="the_lazy_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="switch_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <p>Select parsers may be used to identify a single parser from a given list
- of parsers, which successfully recognizes the current input sequence. Example:</p> + of parsers, which successfully recognizes the current input sequence. Example:<br>选择分析器可用于从给定的分析器表中选择一个成功识别当前输入的分析 器。例子:</p> <pre> rule<span class="special">&lt;&gt;</span> rule_select <span class="special">=</span>
         select_p<span class="special">
         (</span>
             parser_a<span class="special">
           ,</span> parser_b<span class="special">
             <span class="comment">/* ... */</span>
-          ,</span> parser_n
-        <span class="special">)</span><span class="special">;</span></pre>
-<p>The parsers (parser_a, parser_b etc.) are tried sequentially from left to right until a parser matches the current input sequence.
-  If there is a matching parser found, the <tt>select_p</tt> parser returns
+ ,</span> parser_n<br> <span class="special">)</span><span class="special">;</span></pre>
+<p>The parsers (parser_a, parser_b etc.) are tried sequentially from
+left to right until a parser matches the current input sequence. If
+there is a matching parser found, the <tt>select_p</tt> parser returns
the parser's position (zero based index). For instance, in the example above, <tt>1</tt> is returned if parser_b
-  matches.</p>
+ matches.<br>列表中的分析器(parser_a, parser_b 等等)将从左到右逐个测 试,直到有一个分析器匹配当前输入。如果找到一个匹配的分析 器,<tt>select_p</tt>&nbsp;将返回分析器的位置(索引从零起计)。比如,上面的 例子里,parser_b匹配时返回的是 <tt>1</tt>。</p> <p>There are two predefined parsers of the select parser family: <tt>select_p</tt>
   and <tt>select_fail_p</tt>. These parsers differ in the way the no match
case is handled (when none of the parsers match the current input sequence).
   While the <tt>select_p</tt> parser will return <tt>-1</tt>
if no matching parser is found, the <tt>select_fail_p</tt> parser will not match
-  at all.</p>
+ at all.<br>在选择分析器族中有两个预定义的分析器:select_p和 select_fail_p。这些分析器的不同之处在于无匹配情况的处理上(即没有分析器匹配 当前输入串)。如果没有匹配,select_p分析器返回-1而select_fail_p分析器将完全 不匹配。</p> <p>The following sample shows how the select parser may be used very conveniently
-  in conjunction with a <a href="switch_parser.html">switch parser</a>:</p>
+ in conjunction with a <a href="switch_parser.html">switch parser</a>:<br>下面的例子展示了选择分析器是如何便利地与<a href="switch_parser.html">跳转分析器</a>一起使用的:</p> <pre> <span class="keyword">int</span> choice <span class="special">=</span> <span class="literal">-1</span><span class="special">;</span> rule<span class="special">&lt;&gt;</span> rule_select <span class="special">=</span> select_fail_p<span class="special">(</span><span class="literal">'a'</span><span class="special">,</span> <span class="literal">'b'</span><span class="special">,</span> <span class="literal">'c'</span><span class="special">,</span> <span class="literal">'d'</span><span class="special">)[</span>assign_a<span class="special">(</span>choice<span class="special">)]</span> &gt;&gt; switch_p(var<span class="special">(</span>choice)) <span class="special"> - [</span><br> case_p<span class="special">&lt;</span><span class="literal">0</span><span class="special">&gt;(</span>int_p<span class="special">),</span><br> case_p<span class="special">&lt;</span><span class="literal">1</span><span class="special">&gt;(</span>ch_p<span class="special">(</span><span class="literal">','</span><span class="special">)),</span><br> case_p<span class="special">&lt;</span><span class="literal">2</span><span class="special">&gt;(</span>str_p<span class="special">(</span><span class="string">&quot;bcd&quot;</span><span class="special">)),</span><br> default_p<br> <span class="special">]</span><br><span class="special"> ;</span></pre>
-<p>This example shows a rule, which matches:</p>
+ [</span><br> case_p<span class="special">&lt;</span><span class="literal">0</span><span class="special">&gt;(</span>int_p<span class="special">),</span><br> case_p<span class="special">&lt;</span><span class="literal">1</span><span class="special">&gt;(</span>ch_p<span class="special">(</span><span class="literal">','</span><span class="special">)),</span><br> case_p<span class="special">&lt;</span><span class="literal">2</span><span class="special">&gt;(</span>str_p<span class="special">(</span><span class="string">"bcd"</span><span class="special">)),</span><br> default_p<br> <span class="special">]</span><br><span class="special"> ;</span></pre> +<p>This example shows a rule, which matches:<br>这个例子里的规则将匹 配:</p>
 <ul>
   <li><span class="literal"> 'a' </span>followed
-      by an integer</li>
+ by an integer<br><span class="literal"> 'a' </span>之后接一个整数 </li>
   <li><span class="literal">'b' </span>followed by a<span class="literal">
-    ','</span></li>
- <li><span class="literal">'c'</span> followed by <span class="string">&quot;bcd&quot;</span></li>
-  <li>a single <span class="literal">'d'</span>. </li>
+ ','</span><br><span class="literal">'b' </span>之后跟一个<span class="literal"> ','</span></li> + <li><span class="literal">'c'</span> followed by <span class="string">"bcd"</span><br><span class="literal">'c'</span> 之后跟 <span class="string">"bcd"</span></li> + <li>a single <span class="literal">'d'</span>.<br>单一个 <span class="literal">'d'</span>. </li>
 </ul>
 <p>For other input sequences the
-        give rule does not match at all.</p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><p><img src="theme/alert.gif" width="16" height="16"> <tt>BOOST_SPIRIT_SELECT_LIMIT</tt><br> + give rule does not match at all.<br>对于其他的输入分析器完全不匹 配。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><p><img src="theme/alert.gif" height="16" width="16"> <tt>BOOST_SPIRIT_SELECT_LIMIT</tt><br>
         <br>
- The number of possible entries inside the <tt>select_p</tt> parser is limited by the Spirit compile time constant <tt>BOOST_SPIRIT_SELECT_LIMIT</tt>, which defaults to 3. This value should not be greater than the compile time constant given by <tt>PHOENIX_LIMIT</tt> (see <a href="../phoenix/index.html">phoenix</a>). Example:</p> - <p class="style1"><span class="comment">// Define these before including anything else <br> + The number of possible entries inside the <tt>select_p</tt> parser is limited by the Spirit compile time constant <tt>BOOST_SPIRIT_SELECT_LIMIT</tt>, which defaults to 3. This value should not be greater than the compile time constant given by <tt>PHOENIX_LIMIT</tt> (see <a href="../phoenix/index.html">phoenix</a>). Example:</p><p><tt>select_p</tt>&nbsp;中的条目数量受限于Spirit的编译期常量 <tt>BOOST_SPIRIT_SELECT_LIMIT</tt>,默认值为3。这个值不能大于编译期常量 <tt>PHOENIX_LIMIT</tt>(见 <a href="../phoenix/index.html">phoenix</a><a href="http://www.boost.org/libs/spirit/phoenix/index.html";></a>)。例子:</p> + <p class="style1"><span class="comment">// Define these before including anything else 在包含其它头文件之前定义<br>
       </span><span class="style3">#define</span> PHOENIX_LIMIT 10<br>
<span class="preprocessor">#define</span> BOOST_SPIRIT_SELECT_LIMIT 10 </p></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="the_lazy_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="switch_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003-2004 Hartmut Kaiser <br>
+<p class="copyright">Copyright © 2003-2004 Hartmut Kaiser <br>
   <br>
- <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
+  <font size="2">Use,
+modification and distribution is subject to the Boost Software License,
+Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt) </font> </p>
 <p>&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/stored_rule.html     Tue Mar 31 01:07:16 2009
+++ /trunk/libs/spirit/classic/doc/stored_rule.html     Sun Sep 20 23:13:57 2009
@@ -1,99 +1,87 @@
-<html>
-<head>
-<title>Storable Rules</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>Storable Rules</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Storable
-      Rules</b></font></td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Storable
+      Rules 可保存规则</b></font></td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="stored_rule.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="the_lazy_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p>The rule is a weird C++ citizen, unlike any other C++ object. It does not have the proper copy and assignment semantics and cannot be stored and passed around by value. You cannot store rules in STL containers (vector, stack, etc) for - later use and you cannot pass and return rules to and from functions by value.</p> + later use and you cannot pass and return rules to and from functions by value.<br>规则是一个怪异的C++公民,和其他的C++对象不像。它没有恰当的拷贝和赋 值语义,也不能被以值的方式来传递和保存。你没法把规则保存在STL容器(比如 vector、stack等)以在随后使用,也不能把规则以值语义从函数中返回。</p> <p>EBNF is primarily declarative. Like in functional programming, an EBNF grammar is a static recipe and there's no notion of do this then that. However, in Spirit, we managed to coax imperative C++ to take in declarative EBNF. Hah! Fun!... We did that by masquerading the C++ assignment operator to mimic EBNF's <tt>::=</tt>. To do that, we gave the rule class' assignment operator and copy constructor a different meaning and semantics. The downside is that doing so made the rule
-  unlike any other C++ object. You can't copy it. You can't assign it. </p>
+ unlike any other C++ object. You can't copy it. You can't assign it.<br>EBNF本质上是声明式的。类似于函数式编程,一个EBNF语法就是一个静态的配 方,而且也不需要除此以外的其他东西。然而,在Spirit中,我们要 +把命令式的C++和声明式的EBNF拧到一块。哈!有趣!……我们通过把C++的等号伪装起 来模仿EBNF的::=来干这个事情,我们给予了规则类的赋值 +符以不同于拷贝构造函数的含义和语义。这样的缺点是使用起来与其他C++对象不同。 你不能把它拷贝,你不能给它赋值。</p> <p>We want to have the dynamic nature of C++ to our advantage. We've seen dynamic Spirit in action here and there. There are indeed some interesting applications of dynamic parsers using Spirit. Yet, we will not fully utilize the power of dynamic parsing, unless we have a rule that behaves like any other good C++ object. With such a beast, we can write full parsers that's defined at run time,
-  as opposed to compile time.</p>
+ as opposed to compile time.<br>我们希望拥有C++的动态行为以方便我们。我们 已经在这里和那里见过动态的Spirit。的确有些使用Spirit进行动态分析的应用。但 是,我们无法 +拥有动态分析的全部力量,除非我们有一个和其他C++对象有相似行为的规则。有了这 个东西,我们可以把整个分析器写成运行期定义,而不是编译期。</p> <p>We now have dynamic rules: <tt>stored_rules</tt>. Basically they are rules with perfect C++ assignment/copy-constructor semantics. This means that <tt>stored_rules</tt>
-  can be stored in containers and/or dynamically created at run-time.</p>
-<pre><code><font color="#000000"><span class=identifier> </span><span class=keyword>template</span><span class=special>&lt; - </span><span class=keyword>typename </span><span class=identifier>ScannerT </span><span class=special>= </span><span class=identifier>scanner</span><span class=special>&lt;&gt;, - </span><span class=keyword>typename </span><span class=identifier>ContextT </span><span class=special>= </span><span class=identifier>parser_context</span><span class=special>&lt;&gt;</span><span class=identifier>, - </span><span class="keyword">typename</span><span class=identifier> TagT </span><span class="special">=</span><span class=identifier> parser_address_tag</span><span class=special>&gt; - </span><span class=keyword>class </span><span class=identifier>stored_rule</span><span class=special>;</span></font></code></pre> + can be stored in containers and/or dynamically created at run-time.<br>现 在我们有了动态规则:<tt>stored_rules</tt><span style="font-family: Courier New;">。基本上它们就是拥有完美的C++赋值/拷贝语义的规则。这意味着</span> <tt>stored_rules</tt><span style="font-family: Courier New;"> 可以保存在容器 中且/或在运行期动态创建。</span></p> +<pre><code><font color="#000000"><span class="identifier"> </span><span class="keyword">template</span><span class="special">&lt;<br> </span><span class="keyword">typename </span><span class="identifier">ScannerT </span><span class="special">= </span><span class="identifier">scanner</span><span class="special">&lt;&gt;,<br> </span><span class="keyword">typename </span><span class="identifier">ContextT </span><span class="special">= </span><span class="identifier">parser_context</span><span class="special">&lt;&gt;</span><span class="identifier">,<br> </span><span class="keyword">typename</span><span class="identifier"> TagT </span><span class="special">=</span><span class="identifier"> parser_address_tag</span><span class="special">&gt;<br> </span><span class="keyword">class </span><span class="identifier">stored_rule</span><span class="special">;</span></font></code></pre> <p>The interface is exactly the same as with the rule class (see the <a href="rule.html">section on rules</a> for more information regarding the API). The only difference is with the copy and assignment semantics. Now, with <tt>stored_rule</tt>s, we - can dynamically and algorithmically define our rules. Here are some samples... + can dynamically and algorithmically define our rules. Here are some samples...<br>接口与规则类完全相同(<a href="rule.html">规则</a>一章中有关于 API的更多信息)。唯一的差别是复制和赋值语义。现在,有了 <tt>stored_rule</tt><span style="font-family: Courier New;">,我们可以动态而 系统的定义我们的规则了。下面是一些例子……</span>
 </p>
-<p>Say I want to dynamically create a rule for:</p>
-<pre>
-<span class=identifier> start </span><span class=special>= </span><span class=special>*(</span><span class=identifier>a </span><span class=special>| </span><span class=identifier>b </span><span class=special>| </span><span class=identifier>c</span><span class=special>);</span></pre>
-<p> I can write it dynamically step-by-step:</p>
-<pre> <span class=identifier> stored_rule</span><span class=special>&lt;&gt; </span><span class=identifier>start</span><span class=special>;
-
- </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>a</span><span class=special>; - </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>() </span><span class=special>| </span><span class=identifier>b</span><span class=special>; - </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>() </span><span class=special>| </span><span class=identifier>c</span><span class=special>; - </span><span class=identifier>start </span><span class=special>= </span><span class=special>*(</span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>());</span></pre> -<p>Later, I changed my mind and want to redefine it (again dynamically) as:</p> -<pre><span class=identifier> start </span><span class=special>= </span><span class=special>(</span><span class=identifier>a </span><span class=special>| </span><span class=identifier>b</span><span class=special>) </span><span class=special>&gt;&gt; </span><span class=special>(</span><span class=identifier>start </span><span class=special>| </span><span class=identifier>b</span><span class=special>);</span> +<p>Say I want to dynamically create a rule for:<br>比如我想动态创建如下规 则:</p> +<pre><span class="identifier"> start </span><span class="special">= </span><span class="special">*(</span><span class="identifier">a </span><span class="special">| </span><span class="identifier">b </span><span class="special">| </span><span class="identifier">c</span><span class="special">);</span></pre> +<p> I can write it dynamically step-by-step:<br>我可以以动态的形式一步步写 成:</p> +<pre> <span class="identifier"> stored_rule</span><span class="special">&lt;&gt; </span><span class="identifier">start</span><span class="special">;<br><br> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">a</span><span class="special">;<br> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">() </span><span class="special">| </span><span class="identifier">b</span><span class="special">;<br> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">() </span><span class="special">| </span><span class="identifier">c</span><span class="special">;<br> </span><span class="identifier">start </span><span class="special">= </span><span class="special">*(</span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">());</span></pre> +<p>Later, I changed my mind and want to redefine it (again dynamically) as:<br>之后,我改变主意,想把它重定义(动态赋值)为:</p> +<pre><span class="identifier"> start </span><span class="special">= </span><span class="special">(</span><span class="identifier">a </span><span class="special">| </span><span class="identifier">b</span><span class="special">) </span><span class="special">&gt;&gt; </span><span class="special">(</span><span class="identifier">start </span><span class="special">| </span><span class="identifier">b</span><span class="special">);</span>
 </pre>
-<p>I write:</p>
-<pre> <span class=special> </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>b</span><span class=special>; - </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>a </span><span class=special>| </span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>(); - </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>() </span><span class=special>&gt;&gt; </span><span class=special>(</span><span class=identifier>start </span><span class=special>| </span><span class=identifier>b</span><span class=special>);</span></pre>
-<p>Notice the statement:</p>
-<pre> <span class=special> </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>start</span><span class=special>.</span><span class=identifier>copy</span><span class=special>() </span><span class=special>| </span><span class=identifier>b</span><span class=special>;</span></pre>
+<p>I write:<br>我写成:</p>
+<pre> <span class="special"> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">b</span><span class="special">;<br> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">a </span><span class="special">| </span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">();<br> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">() </span><span class="special">&gt;&gt; </span><span class="special">(</span><span class="identifier">start </span><span class="special">| </span><span class="identifier">b</span><span class="special">);</span></pre>
+<p>Notice the statement:<br>注意语句:</p>
+<pre> <span class="special"> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">start</span><span class="special">.</span><span class="identifier">copy</span><span class="special">() </span><span class="special">| </span><span class="identifier">b</span><span class="special">;</span></pre> <p>Why is start.copy() required? Well, because like rules, stored rules are still embedded by reference when found in the RHS (one reason is to avoid cyclic-shared-pointers).
-  If we write:</p>
-<pre> <span class=special> </span><span class=identifier>start </span><span class=special>= </span><span class=identifier>start </span><span class=special>| </span><span class=identifier>b</span><span class=special>;</span></pre> + If we write:<br>为什么要 start.copy()?因为可储存规则类似于规则,在等式右 边时依然是以引用的方式被嵌入的(一个原因是避免循环共享指针)。如果我们 写:</p> +<pre> <span class="special"> </span><span class="identifier">start </span><span class="special">= </span><span class="identifier">start </span><span class="special">| </span><span class="identifier">b</span><span class="special">;</span></pre> <p>We have <strong>left-recursion</strong>! Copying copy of start avoids self referencing. What we are doing is making a copy of start, ORing it with b, then
-  destructively assigning the result back to start.</p>
+ destructively assigning the result back to start.<br>那我们就有<strong>左 递归</strong>了!拷贝 strat 的副本避免了自我引用。我们所作的是创建一个 start 的拷贝,把它和 b 取或,再把结果破坏性地复制回 start(即start的原有值被 取代)。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="stored_rule.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="the_lazy_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/switch_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/switch_parser.html Sun Sep 20 23:13:57 2009
@@ -1,41 +1,39 @@
-<html>
-<head>
-<title>The Switch Parser</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>The Switch Parser</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link rel="stylesheet" href="theme/style.css" type="text/css">
 <style type="text/css">
 <!--
 .style1 {font-family: "Courier New", Courier, mono}
 .style3 {font-family: "Courier New", Courier, mono; color: #FF0000; }
 -->
-</style>
-</head>
-
+</style></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10"> </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>The Switch Parser </b></font></td> - <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>The Switch Parser 跳转分析器 </b></font></td> + <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="select_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="escape_char_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
-<p>Switch parsers may be used to simplify certain alternation constructs. Consider the following code:</p>
+</tbody></table>
+<p>Switch parsers may be used to simplify certain alternation constructs. Consider the following code:<br>跳转分析器可用来简化选择结构。考虑下面的代 码:</p> <pre> rule<span class="special">&lt;&gt;</span> rule_overall <span class="special">=</span> - ch_p<span class="special">(</span><span class="literal">'a'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_a - <span class="special">|</span> ch_p<span class="special">(</span><span class="literal">'b'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_b
-            <span class="comment">// ...</span>
- <span class="special">|</span> ch_p<span class="special">(</span><span class="literal">'n'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_n
-        <span class="special">;</span></pre>
-<p>Each of the alternatives are evaluated normally in a sequential manner. This tend to be inefficient, especially for a large number of alternatives. To avoid this inefficiency and to make it possible to write such constructs in a more readable form, Spirit contains the <tt>switch_p</tt> family of parsers. The switch_p parser allows us to rewrite the previous construct as:</p> + ch_p<span class="special">(</span><span class="literal">'a'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_a<br> <span class="special">| </span> ch_p<span class="special">(</span><span class="literal">'b'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_b<br> <span class="comment">// ...</span> + <span class="special">|</span> ch_p<span class="special">(</span><span class="literal">'n'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> parser_n<br> <span class="special">;</span></pre>
+<p>Each of the alternatives are evaluated normally in a sequential
+manner. This tend to be inefficient, especially for a large number of
+alternatives. To avoid this inefficiency and to make it possible to
+write such constructs in a more readable form, Spirit contains the <tt>switch_p</tt> family of parsers. The switch_p parser allows us to rewrite the previous construct as:<br>这些选项被线性地依次调用。这是很低效 的,尤其在有大量选择的时候。为了避免这种低效并且把这样的代码写成更加可读的形 式,Spirit包含了 <tt>switch_p</tt>&nbsp;分析器族。switch_p 分析器使得我们可 以把上面的构造重写为:</p> <pre> rule<span class="special">&lt;&gt;</span> rule_overall <span class="special">=</span>
             switch_p
             <span class="special">[</span>
@@ -45,15 +43,24 @@
case_p<span class="special">&lt;</span><span class="literal">'n'</span><span class="special">&gt;(</span>parser_n<span class="special">)</span>
             ]
         ;</pre>
-<p>This <tt>switch_p</tt> parser takes the next character (or token) from the input stream and tries to match it against the given integral compile time constants supplied as the template parameters to the <tt>case_p</tt> parsers. If this character matches one of the <tt>case_p</tt> branches, the associated parser is executed (i.e. if 'a' is matched, <tt>parser_a</tt> is executed, if 'b' is matched, <tt>parser_b</tt> is executed and so on) . If no <tt>case_p</tt> branch matches the next input character, the overall construct does not match at all. </p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><div align="justify"><img src="theme/bulb.gif" width="13" height="18"><strong> Nabialek trick </strong><br>
+<p>This <tt>switch_p</tt> parser takes the next character (or token)
+from the input stream and tries to match it against the given integral
+compile time constants supplied as the template parameters to the <tt>case_p</tt> parsers. If this character matches one of the <tt>case_p</tt> branches, the associated parser is executed (i.e. if 'a' is matched, <tt>parser_a</tt> is executed, if 'b' is matched, <tt>parser_b</tt> is executed and so on) . If no <tt>case_p</tt> branch matches the next input character, the overall construct does not match at all.<br><tt>switch_p</tt>&nbsp;分析器从输入中取出下一个要分析的字符并且尝试 把它与经由 <tt>case_p</tt>&nbsp;分析器模板参数给定的编译期整形常量匹配。如果 字符匹配任意 +一个 <tt>case_p</tt>&nbsp;分支,则相关联的分析器将被执行(比如,如果 'a' 匹 配,<tt>parser_a</tt>&nbsp;被执行;如果匹配 'b',<tt>parser_b</tt>&nbsp;被执 行;如此等 +等)。如果没有那 <tt>case_p</tt>&nbsp;分支匹配下一个输入字符,则整个结构都 不匹配。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><div align="justify"><img src="theme/bulb.gif" height="18" width="13"><strong> Nabialek trick </strong><strong>&nbsp; Nabialek 戏法</strong><strong> </strong><br>
             <br>
- The <strong><em><a href="techniques.html#nabialek_trick">&quot;Nabialek trick&quot; </a></em></strong>(from the name of its inventor, Sam Nabialek), can also improve the rule dispatch from linear non-deterministic to deterministic. This is similar to the <tt>switch_p</tt> parser, yet, can handle grammars where a keyword (operator, etc), instead of a single character or token, precedes a production.</div></td> + The <strong><em><a href="techniques.html#nabialek_trick">"Nabialek trick" </a></em></strong>(from
+the name of its inventor, Sam Nabialek), can also improve the rule
+dispatch from linear non-deterministic to deterministic. This is
+similar to the <tt>switch_p</tt> parser, yet, can handle grammars
+where a keyword (operator, etc), instead of a single character or
+token, precedes a production.<br><a href="techniques.html#nabialek_trick"><strong><em>"Nabialek 戏 法"</em></strong></a> (来源于发明者的名字,Sam Nabialek),同样可以把规则分 配过程从线性的不确定改进为确定的。这与 <tt>switch_p</tt>&nbsp;类似,但是在语 法中它可以先于产生式处理一个关键字(运算符,等等),而不是单独一个字符。 </div></td>
   </tr>
-</table>
-<p>Sometimes it is desireable to add handling of the default case (none of the <tt>case_p</tt> branches matched). This may be achieved with the help of a <tt>default_p</tt> branch:</p>
+</tbody></table>
+<p>Sometimes it is desireable to add handling of the default case (none of the <tt>case_p</tt> branches matched). This may be achieved with the help of a <tt>default_p</tt> branch:<br>有时我们希望添加对默认情况(没有任何 <tt>case_p</tt>&nbsp;分支匹配)的处理。这可以借由 <tt>default_p</tt>&nbsp;的 帮助而完成:</p> <pre> rule<span class="special">&lt;&gt;</span> rule_overall <span class="special">=</span>
             switch_p
             <span class="special">[</span>
@@ -62,10 +69,9 @@
             <span class="comment">    // ...</span>
case_p<span class="special">&lt;</span><span class="literal">'n'</span><span class="special">&gt;(</span>parser_n<span class="special">),</span> default_p<span class="special">(</span>parser_default<span class="special">)</span>
-            <span class="special">]
-        ;</span></pre>
-<p>This form chooses the <tt>parser_default</tt> parser if none of the cases matches the next character from the input stream. Please note that, obviously, only one <tt>default_p</tt> branch may be added to the <tt>switch_p</tt> parser construct. </p> -<p>Moreover, it is possible to omit the parentheses and body from the <tt>default_p</tt> construct, in which case, no additional parser is executed and the overall <tt>switch_p</tt> construct simply returns a match on any character of the input stream, which does not match any of the <tt>case_p</tt> branches:</p>
+            <span class="special">]<br>        ;</span></pre>
+<p>This form chooses the <tt>parser_default</tt> parser if none of the cases matches the next character from the input stream. Please note that, obviously, only one <tt>default_p</tt> branch may be added to the <tt>switch_p</tt> parser construct.<br>这一形式中如果输入流中的下一个字符没 有匹配任何分支则其将选择 <tt>parser_default</tt>&nbsp;分析器。请注意,很明 显,只允许在 <tt>switch_p</tt>&nbsp;构造中加入一个 <tt>default_p</tt>&nbsp;分支。</p> +<p>Moreover, it is possible to omit the parentheses and body from the <tt>default_p</tt> construct, in which case, no additional parser is executed and the overall <tt>switch_p</tt> construct simply returns a match on any character of the input stream, which does not match any of the <tt>case_p</tt> branches:<br>此外,可以把 <tt>default_p</tt>&nbsp;构造的括号 和分析体拿掉,在这种情况下,不再执行其他分析器,并且 <tt>switch_p</tt>&nbsp;构造返回一个对输入流中任意字符的匹配,这个字符没有和 任何 <tt>case_p</tt>&nbsp;匹配。</p> <pre> rule<span class="special">&lt;&gt;</span> rule_overall <span class="special">=</span>
             switch_p
             <span class="special">[</span>
@@ -76,7 +82,8 @@
                 default_p
             <span class="special">]</span>
         ;</pre>
-<p>There is another form of the switch_p construct. This form allows us to explicitly specify the value to be used for matching against the <tt>case_p</tt> branches: </p>
+<p>There is another form of the switch_p construct. This form allows us
+to explicitly specify the value to be used for matching against the <tt>case_p</tt> branches:<br>这是 switch_p 构造的另一个形式。这个形式允许我 们显式地指定用于匹配 <tt>case_p</tt>&nbsp;的值:</p> <pre> rule<span class="special">&lt;&gt;</span> rule_overall <span class="special">=</span> switch_p<span class="special">(</span>cond<span class="special">)</span>
             <span class="special">[</span>
@@ -86,30 +93,37 @@
case_p<span class="special">&lt;</span><span class="literal">'n'</span><span class="special">&gt;(</span>parser_n<span class="special">)</span>
             <span class="special">]</span>
         ;</pre>
-<p>where <tt>cond</tt> is a parser or a nullary function or function object (functor). If it is a parser, then it is tried and its return value is used to match against the <tt>case_p</tt> branches. If it is a nullary function or functor, then its return value will be used. </p> -<p>Please note that during its compilation, the <tt>switch_p</tt> construct is transformed into a real C++ <tt>switch</tt> statement. This makes the runtime execution very efficient. </p>
-<table width="80%" border="0" align="center">
-  <tr>
- <td class="note_box"><p><img src="theme/alert.gif" width="16" height="16"> <tt>BOOST_SPIRIT_SWITCH_CASE_LIMIT</tt><br>
+<p>where <tt>cond</tt> is a parser or a nullary function or function
+object (functor). If it is a parser, then it is tried and its return
+value is used to match against the <tt>case_p</tt> branches. If it is a nullary function or functor, then its return value will be used.<br>这里 <tt>cond</tt>&nbsp;是一个分析器或者无参函数或者函数对象(仿函数)。如果它是 分析器,那么它将被测试并且测试返回值将用来与 <tt>case_p</tt>&nbsp;分支匹配。 如果是无参函数或者仿函数,那么将直接使用它的返回值。</p> +<p>Please note that during its compilation, the <tt>switch_p</tt> construct is transformed into a real C++ <tt>switch</tt> statement. This makes the runtime execution very efficient.<br>请注意,在编译 期,<tt>switch_p</tt>&nbsp;构造被转换成真正的C++的 <tt>switch</tt>&nbsp;语 句。这使得运行时的效率相当高。</p>
+<table align="center" border="0" width="80%">
+  <tbody><tr>
+ <td class="note_box"><p><img src="theme/alert.gif" height="16" width="16"> <tt>BOOST_SPIRIT_SWITCH_CASE_LIMIT</tt><br>
         <br>
- The number of possible <tt>case_p</tt>/<tt>default_p</tt> branches is limited by the Spirit compile time constant <tt>BOOST_SPIRIT_SWITCH_CASE_LIMIT</tt>, which defaults to 3. There is no theoretical upper limit for this constant, but most compilers won't allow you to specify a very large number.</p>
-    <p>Example:</p>
- <p class="style1"><span class="comment">// Define these before including switch.hpp <br> + The number of possible <tt>case_p</tt>/<tt>default_p</tt> branches is limited by the Spirit compile time constant <tt>BOOST_SPIRIT_SWITCH_CASE_LIMIT</tt>,
+which defaults to 3. There is no theoretical upper limit for this
+constant, but most compilers won't allow you to specify a very large
+number.</p><p><tt>case_p</tt>/<tt>default_p</tt>&nbsp;分支的最大数目受限于 Spirit编译期常量 <tt>BOOST_SPIRIT_SWITCH_CASE_LIMIT</tt>,其默认值为3。这个 常量理论上没有限制,但大多数编译器都不会允许你指定很大的数目。</p>
+    <p>Example:<br>例子:</p>
+ <p class="style1"><span class="comment">// Define these before including switch.hpp 在包含switch.hpp之前定义<br> </span><span class="preprocessor">#define</span> BOOST_SPIRIT_SWITCH_CASE_LIMIT 10 </p></td>
   </tr>
-</table><br>
+</tbody></table><br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="select_parser.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="escape_char_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003-2004 Hartmut Kaiser <br>
+<p class="copyright">Copyright © 2003-2004 Hartmut Kaiser <br>
   <br>
- <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
-</body>
-</html>
+  <font size="2">Use,
+modification and distribution is subject to the Boost Software License,
+Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt) </font> </p>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/doc/the_lazy_parser.html Tue Mar 31 01:07:16 2009 +++ /trunk/libs/spirit/classic/doc/the_lazy_parser.html Sun Sep 20 23:13:57 2009
@@ -1,33 +1,31 @@
-<html>
-<head>
-<title>The Lazy Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+
+<title>The Lazy Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
-  <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+  <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>The
-      Lazy Parser</b></font></td>
- <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> + <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>The
+      Lazy Parser 惰性分析器</b></font></td>
+ <td width="112"><a href="http://spirit.sf.net";><img src="theme/spirit.gif" align="right" border="0" height="48" width="112"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="dynamic_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="select_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
<p>Closures are cool. It allows us to inject stack based local variables anywhere in our parse descent hierarchy. Typically, we store temporary variables, generated by our semantic actions, in our closure variables, as a means to pass information
-  up and down the recursive descent.</p>
+ up and down the recursive descent.<br>闭包非常酷。它使得我们可以在下降分 析的任意层次注入基于栈的变量。典型地,我们在闭包里储存由我们的语义动作产生的 临时变量,以之作为在递归下降中向上或向下传递信息的方法。</p> <p>Now imagine this... Having in mind that closure variables can be just about any type, we can store a parser, a rule, or a pointer to a parser or rule, in a closure variable. <em>Yeah, right, so what?...</em> Ok, hold on... What if
@@ -36,82 +34,73 @@
round trip from to <a href="../phoenix/index.html">Phoenix</a> and Spirit and back! <a href="../phoenix/index.html">Phoenix</a> semantic actions choose the right Spirit parser and Spirit parsers choose the right <a href="../phoenix/index.html">Phoenix</a>
-  semantic action. Oh MAN, what a honky cool idea, I might say!!</p>
+ semantic action. Oh MAN, what a honky cool idea, I might say!!<br>现在想 想这个……记住闭包变量可以是任意类型,我们可以在闭包变量里储存一个分析器、规 则、或是规则或分析器的指针。<em>没错,然后呢?……</em>OK,稍等……假如我们用这 个闭包变量来开始一次分析呢?想想这个吧。突然我们拥有了某些强大的动态分析 器!我们一下子拥有了从 Spirit 到<a href="http://www.boost.org/libs/spirit/phoenix/index.html";> </a><a href="../phoenix/index.html">Phoenix</a>&nbsp;再回来的整条路线。<a href="../phoenix/index.html">Phoenix</a>&nbsp;语义动作选择正确的 Spirit 语义 动作而 Spirit 语义动作又反过来选择正确的 <a href="../phoenix/index.html">Phoenix</a>&nbsp;语义动作。天啊,真是个好主 意,我得这么说!</p>
 <h2>lazy_p</h2>
<p>This is the idea behind the <tt>lazy_p</tt> parser. The <tt>lazy_p</tt> syntax
-  is:</p>
+ is:<br>这是 <tt>lazy_p</tt>&nbsp;幕后的构思。<tt>lazy_p</tt>&nbsp;的语法 是:</p> <pre> lazy_p<span class="special">(</span>actor<span class="special">)</span></pre> <p>where actor is a <a href="../phoenix/index.html">Phoenix</a> expression that - returns a Spirit parser. This returned parser is used in the parsing process.
-</p>
-<p>Example: </p>
+ returns a Spirit parser. This returned parser is used in the parsing process.<br>其中&nbsp;actor 是 <a href="../phoenix/index.html">Phoenix</a>&nbsp;<a href="http://www.boost.org/libs/spirit/phoenix/index.html";></a>表达式,返回 一个 Spirit 分析器。所返回的分析器将用于分析过程中。</p>
+<p>Example:<br>例如: </p>
<pre> lazy_p<span class="special">(</span>phoenix<span class="special">::</span>val<span class="special">(</span>int_p<span class="special">))[</span>assign_a<span class="special">(</span>result<span class="special">)]</span>
 </pre>
<p>Semantic actions attached to the <tt>lazy_p</tt> parser expects the same signature - as that of the returned parser (<tt>int_p</tt>, in our example above).</p> + as that of the returned parser (<tt>int_p</tt>, in our example above).<br>挂接于 <tt>lazy_p</tt>&nbsp;分析器上的语义动作的签名要求与所返回 的分析器一致(在即以上例子中的 <tt>int_p</tt>)。</p>
 <h2>lazy_p example</h2>
<p>To give you a better glimpse (see the <tt><a href="../example/intermediate/lazy_parser.cpp">lazy_parser.cpp</a></tt>),
-  say you want to parse inputs such as:</p>
-<pre>    <span class=identifier>dec
- </span><span class="special">{</span><span class=identifier><br> 1 2 3<br> bin - </span><span class="special">{</span><span class=identifier><br> 1 10 11<br> </span><span class="special">}</span><span class=identifier><br> 4 5 6<br> </span><span class="special">}</span></pre> + say you want to parse inputs such as:<br>为了更深入了解(见 <tt><a href="../example/intermediate/lazy_parser.cpp">lazy_parser.cpp</a></tt>),假 设你想分析如下输入:</p> +<pre> <span class="identifier">dec <br> </span><span class="special">{</span><span class="identifier"><br> 1 2 3<br> bin <br> </span><span class="special">{</span><span class="identifier"><br> 1 10 11<br> </span><span class="special">}</span><span class="identifier"><br> 4 5 6<br> </span><span class="special">}</span></pre> <p>where <tt>bin {...}</tt> and <tt>dec {...}</tt> specifies the numeric format (binary or decimal) that we are expecting to read. If we analyze the input,
-  we want a grammar like:</p>
-<pre><code><font color="#000000"><span class=special> </span><span class=identifier>base </span><span class="special">=</span><span class=identifier> </span><span class="string">&quot;bin&quot;</span><span class=identifier> </span><span class="special">|</span><span class=identifier> </span><span class="string">&quot;dec&quot;</span><span class="special">;</span><span class=identifier> - block </span><span class=special>= </span><span class="identifier">base</span><span class=special> &gt;&gt; </span><span class="literal">'{'</span><span class=special> &gt;&gt; *</span><span class="identifier">block_line</span><span class=special> &gt;&gt; </span><span class="literal">'}'</span><span class=special>; - </span>block_line <span class=special>= </span><span class="identifier">number</span><span class=special> | </span><span class=identifier>block</span><span class=special>;</span></font></code></pre> + we want a grammar like:<br>其中 <tt>bin {...}</tt> 和 <tt>dec {...}</tt> 区分了我们想读入的数字的格式(二进制或十进制)。如果我们要分析这个输入,那么语 法是这样的:<tt></tt></p> +<pre><code><font color="#000000"><span class="special"> </span><span class="identifier">base </span><span class="special">=</span><span class="identifier"> </span><span class="string">"bin"</span><span class="identifier"> </span><span class="special">|</span><span class="identifier"> </span><span class="string">"dec"</span><span class="special">;</span><span class="identifier"> + block </span><span class="special">= </span><span class="identifier">base</span><span class="special"> &gt;&gt; </span><span class="literal">'{'</span><span class="special"> &gt;&gt; *</span><span class="identifier">block_line</span><span class="special"> &gt;&gt; </span><span class="literal">'}'</span><span class="special">;<br> </span>block_line <span class="special">= </span><span class="identifier">number</span><span class="special"> | </span><span class="identifier">block</span><span class="special">;</span></font></code></pre> <p>We intentionally left out the <code><font color="#000000"><span class="identifier"><tt>number</tt></span></font></code> rule. The tricky part is that the way <tt>number</tt> rule behaves depends on - the result of the <tt>base</tt> rule. If <tt>base</tt> got a <em>&quot;bin&quot;</em>, - then number should parse binary numbers. If <tt>base</tt> got a <em>&quot;dec&quot;</em>, + the result of the <tt>base</tt> rule. If <tt>base</tt> got a <em>"bin"</em>, + then number should parse binary numbers. If <tt>base</tt> got a <em>"dec"</em>, then number should parse decimal numbers. Typically we'll have to rewrite our
-  grammar to accomodate the different parsing behavior:</p>
-<pre><code><font color="#000000"><span class=identifier> block </span><span class=special>= - </span><span class=identifier>&quot;bin&quot;</span> <span class=special>&gt;&gt; </span><span class="literal">'{'</span><span class=special> &gt;&gt; *</span>bin_line<span class=special> &gt;&gt; </span><span class="literal">'}'</span><span class=special> - | </span><span class=identifier>&quot;dec&quot;</span> <span class=special>&gt;&gt; </span><span class="literal">'{'</span><span class=special> &gt;&gt; *</span>dec_line<span class=special> &gt;&gt; </span><span class="literal">'}'</span><span class=special>
-        ;
- </span>bin_line <span class=special>= </span><span class="identifier">bin_p</span><span class=special> | </span><span class=identifier>block</span><span class=special>; - </span>dec_line <span class=special>= </span><span class="identifier">int_p</span><span class=special> | </span><span class=identifier>block</span><span class=special>;</span></font></code></pre> + grammar to accomodate the different parsing behavior:</p><p>我们有意把 <span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>number</tt></span></span> 规则留空。精妙的部分在于 <span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>number</tt></span></span></tt></span></span> 规则的行 为取决于&nbsp;<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>base</tt></span></span></tt></span></span> 规则的结 果。如果&nbsp;<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>base</tt></span></span></tt></span></span> 分析得到 <em>"bin"</em>,则&nbsp;<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>number</tt></span></span></tt></span></span></tt></span></span> 将分析二进制数。如果&nbsp;<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>base</tt></span></span></tt></span></span></tt></span></span> 分析得到 <em>"dec"</em>,则&nbsp;<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt>number</tt></span></span></tt></span></span></tt></span></span></tt></span></span> 将分析十进制数。通常我们需要重写语法以适应不同的分析行为:<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt><span style="color: rgb(0, 0, 0);"><span class="identifier"><tt></tt></span></span></tt></span></span></tt></span></span></tt></span></span></p> +<pre><code><font color="#000000"><span class="identifier"> block </span><span class="special">= <br> </span><span class="identifier">"bin"</span> <span class="special">&gt;&gt; </span><span class="literal">'{'</span><span class="special"> &gt;&gt; *</span>bin_line<span class="special"> &gt;&gt; </span><span class="literal">'}'</span><span class="special"> + | </span><span class="identifier">"dec"</span> <span class="special">&gt;&gt; </span><span class="literal">'{'</span><span class="special"> &gt;&gt; *</span>dec_line<span class="special"> &gt;&gt; </span><span class="literal">'}'</span><span class="special">
+        ;
+ </span>bin_line <span class="special">= </span><span class="identifier">bin_p</span><span class="special"> | </span><span class="identifier">block</span><span class="special">;<br> </span>dec_line <span class="special">= </span><span class="identifier">int_p</span><span class="special"> | </span><span class="identifier">block</span><span class="special">;</span></font></code></pre> <p>while this is fine, the redundancy makes us want to find a better solution; after all, we'd want to make full use of Spirit's dynamic parsing capabilities. Apart from that, there will be cases where the set of parsing behaviors for our <tt>number</tt> rule is not known when the grammar is written. We'll only - be given a map of string descriptors and corresponding rules [e.g. ((&quot;dec&quot;,
-  int_p), (&quot;bin&quot;, bin_p) ... etc...)].</p>
+ be given a map of string descriptors and corresponding rules [e.g. (("dec", + int_p), ("bin", bin_p) ... etc...)].<br>虽然这样也不错,但其中的冗余使得 我们想寻找更好的解决办法;最后,我们还想完全利用Spirit的动态分析能力。此 外,还有我们的 <tt>number</tt> 规则需要解析的数字的类别在书写语法时还是未知 的情况。那么我们只能指定一个描述字符串和相应规则的映射[比如&nbsp;(("dec", + int_p), ("bin", bin_p) ... 等等]。<span style="color: rgb(0, 0, 0);"><span class="identifier"><tt></tt></span></span></p> <p>The basic idea is to have a rule for binary and decimal numbers. That's easy enough to do (see <a href="numerics.html">numerics</a>). When <tt>base</tt> is being parsed, in your semantic action, store a pointer to the selected base - in a closure variable (e.g. <tt>block.int_rule</tt>). Here's an example:</p> -<pre><code><font color="#000000"><span class=special> </span><span class=identifier>base - </span><span class="special">=</span><span class=identifier> str_p</span><span class="special">(</span><span class="string">&quot;bin&quot;</span><span class="special">)[</span><span class=identifier>block.int_rule</span> = <span class="special">&amp;</span>var<span class="special">(</span><span class="identifier">bin_rule</span><span class="special">)] - | </span><span class=identifier>str_p</span><span class="special">(</span><span class="string">&quot;dec&quot;</span><span class="special">)[</span><span class=identifier>block.int_rule</span> = <span class="special">&amp;</span>var<span class="special">(</span><span class="identifier">dec_rule</span><span class="special">)]
-        ;</span></font></code></pre>
-<p>With this setup, your number rule will now look something like:</p>
-<pre><code><font color="#000000"><span class=special> </span><span class=identifier>number </span><span class="special">=</span><span class=identifier> lazy_p</span><span class="special">(*</span><span class=identifier>block.int_rule</span><span class="special">);</span></font></code></pre> + in a closure variable (e.g. <tt>block.int_rule</tt>). Here's an example:<br>基本的原理是用一个规则解析二进制和十进制的数字。这很容易做到(见 <a href="numerics.html">数值</a>)。当 <tt>base</tt>&nbsp;分析过后,在你的语 义动作里把一个指向所选择的进制的指针储存于一个闭包变量中(比如&nbsp; <tt>block.int_rule</tt>)。这是一个例子:</p> +<pre><code><font color="#000000"><span class="special"> </span><span class="identifier">base <br> </span><span class="special">=</span><span class="identifier"> str_p</span><span class="special">(</span><span class="string">"bin"</span><span class="special">)[</span><span class="identifier">block.int_rule</span> = <span class="special">&amp;</span>var<span class="special">(</span><span class="identifier">bin_rule</span><span class="special">)] <br> | </span><span class="identifier">str_p</span><span class="special">(</span><span class="string">"dec"</span><span class="special">)[</span><span class="identifier">block.int_rule</span> = <span class="special">&amp;</span>var<span class="special">(</span><span class="identifier">dec_rule</span><span class="special">)]<br> ;</span></font></code></pre> +<p>With this setup, your number rule will now look something like:<br>有了 这个,你的number规则看起来就像:</p> +<pre><code><font color="#000000"><span class="special"> </span><span class="identifier">number </span><span class="special">=</span><span class="identifier"> lazy_p</span><span class="special">(*</span><span class="identifier">block.int_rule</span><span class="special">);</span></font></code></pre> <p>The <tt><a href="../example/intermediate/lazy_parser.cpp">lazy_parser.cpp</a></tt> does it a bit differently, ingeniously using the <a href="symbols.html">symbol table</a> to dispatch the correct rule, but in essence, both strategies are similar. This technique, using the symbol table, is detailed in the Techiques section: <a href="techniques.html#nabialek_trick">nabialek_trick</a>. Admitedly, when you add up all the rules, the resulting grammar is more complex than the hard-coded grammar above. Yet, for more complex grammar patterns with a lot more rules to choose from, the additional setup is well
-  worth it.</p>
+ worth it.<br><a href="../example/intermediate/lazy_parser.cpp"><span style="font-family: Courier New;">lazy_parser.cpp</span></a>所做的有些不 同,它聪明地使用了<a href="symbols.html">符号表</a>来分派对应的规则,但本质 上,这两种策略是相同的。这个技术,符号表的使用,其细节在技术章节:<a href="techniques.html#nabialek_trick">nabialek戏法</a>。要承认的是,你添加以 上全部规则后,所产生的语法要比原来的语法更加复杂。但j ,在需要选择更多的分析 样式的更复杂的语法中,这种代价是值得的。</p>
 <table border="0">
-  <tr>
+  <tbody><tr>
     <td width="10"></td>
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="dynamic_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="select_parser.html"><img src="theme/r_arr.gif" border="0"></a></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2003 Joel de Guzman<br>
-  Copyright &copy; 2003 Vaclav Vesely<br>
+<p class="copyright">Copyright © 2003 Joel de Guzman<br>
+  Copyright © 2003 Vaclav Vesely<br>
   <br>
<font size="2">Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
=======================================
--- /trunk/libs/spirit/classic/index.html       Sat Oct  4 05:29:09 2008
+++ /trunk/libs/spirit/classic/index.html       Sun Sep 20 23:13:57 2009
@@ -1,6 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
+<html><head>



@@ -12,8 +11,8 @@



-  <title>Spirit User's Guide</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <title>Spirit User's Guide</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">



@@ -21,10 +20,7 @@



-  <link rel="stylesheet" href="doc/theme/style.css" type="text/css">
-</head>
-
-
+  <link rel="stylesheet" href="doc/theme/style.css" type="text/css"></head>
 <body>


@@ -496,7 +492,7 @@



-    <td class="toc_cells_L1"><a href="doc/phoenix.html">凤凰</a></td>
+    <td class="toc_cells_L1"><a href="doc/phoenix.html">Phoenix</a></td>



@@ -511,7 +507,7 @@



-    <td class="toc_cells_L1"><a href="doc/closures.html">关闭</a></td>
+    <td class="toc_cells_L1"><a href="doc/closures.html">闭包</a></td>



@@ -571,7 +567,7 @@



- <td class="toc_cells_L1"><a href="doc/the_lazy_parser.html">懒惰解析器 </a></td> + <td class="toc_cells_L1"><a href="doc/the_lazy_parser.html">惰性解析器 </a></td>



@@ -601,7 +597,7 @@



- <td class="toc_cells_L1"><a href="doc/switch_parser.html">开关解析器 </a></td> + <td class="toc_cells_L1"><a href="doc/switch_parser.html">跳转解析器 </a></td>



@@ -616,7 +612,7 @@



-    <td class="toc_cells_L0"><b>有用部件</b></td>
+    <td class="toc_cells_L0"><b>工具组件</b></td>



@@ -631,7 +627,7 @@



- <td class="toc_cells_L1"><a href="doc/escape_char_parser.html">退出字符 解析器</a></td> + <td class="toc_cells_L1"><a href="doc/escape_char_parser.html">转义字符 解析器</a></td>



@@ -646,7 +642,7 @@



-    <td class="toc_cells_L1"><a href="doc/loops.html">循环解析器</a></td>
+    <td class="toc_cells_L1"><a href="doc/loops.html">循环</a></td>



@@ -661,7 +657,7 @@



- <td class="toc_cells_L1"><a href="doc/character_sets.html">字符集解析器 </a></td> + <td class="toc_cells_L1"><a href="doc/character_sets.html">字符集 </a></td>



@@ -676,7 +672,7 @@



- <td class="toc_cells_L1"><a href="doc/confix.html">首尾(Confix)与注释 解析</a></td>
+    <td class="toc_cells_L1"><a href="doc/confix.html">片段解释器</a></td>



@@ -706,7 +702,7 @@



- <td class="toc_cells_L1"><a href="doc/functor_parser.html">函数解析器 </a></td> + <td class="toc_cells_L1"><a href="doc/functor_parser.html">仿函数解析器 </a></td>



@@ -721,7 +717,7 @@



- <td class="toc_cells_L1"><a href="doc/refactoring.html">重因子分解解析 器</a></td> + <td class="toc_cells_L1"><a href="doc/refactoring.html">重构解析器 </a></td>



@@ -1095,7 +1091,7 @@



- <div align="center"><font color="#666666" size="2">Copyright &copy; 1998-2003 + <div align="center"><font color="#666666" size="2">Copyright © 1998-2003
         Joel de Guzman</font><font size="2"><br>


@@ -1111,43 +1107,43 @@



-        <font color="#666666">Copyright &copy; 2001-2003 Hartmut Kaiser<br>
+        <font color="#666666">Copyright © 2001-2003 Hartmut Kaiser<br>




-        Copyright &copy; 2001-2002 Daniel C. Nuffer<br>
+        Copyright © 2001-2002 Daniel C. Nuffer<br>




-        Copyright &copy; 2002 Chris Uzdavinis<br>
+        Copyright © 2002 Chris Uzdavinis<br>




-        Copyright &copy; 2002 Jeff Westfahl<br>
+        Copyright © 2002 Jeff Westfahl<br>




-        Copyright &copy; 2002 Juan Carlos Arevalo-Baeza<br>
+        Copyright © 2002 Juan Carlos Arevalo-Baeza<br>




- </font><font size="2"><font color="#666666">Copyright &copy; 2003 Martin
+        </font><font size="2"><font color="#666666">Copyright © 2003 Martin
         Wille <br>




-        Copyright &copy; 2003 Ross Smith<br>
+        Copyright © 2003 Ross Smith<br>




- <font size="2"><font size="2">Copyright &copy; 2003</font></font></font>
+        <font size="2"><font size="2">Copyright © 2003</font></font></font>
<font color="#666666">Jonathan de Halleux </font></font></font></div>


@@ -1258,5 +1254,4 @@



-</body>
-</html>
+</body></html>

Other related posts:

  • » [boost-doc-zh] r335 committed - Spirit库译文,由 青菜肉丝 提供,第二批 - codesite-noreply