⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse_8cpp.html

📁 building parser with C++ functions
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>a1: parse.cpp File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.9.1 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>parse.cpp File Reference</h1><code>#include "<a class="el" href="parse_8hpp-source.html">parse.hpp</a>"</code><br><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a1">iswhitespace</a> (char ch)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether the character is whitespace.  <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a2">is_legalnumeric</a> (string str)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether numericstr is an legal numericstr string.  <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a3">is_legaloperator</a> (string str)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether str is a legal operator.  <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a4">readsinglesymbol</a> (string &amp;substring, string &amp;sexpr)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a5">clearwhitespace</a> (string &amp;sexpr)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clear the whitespace at the begining and end of string sexpr.  <a href="#a5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a6">is_legalexpr</a> (string sexpr)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether the s-expression legal.  <a href="#a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classCell.html">Cell</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a7">makecell</a> (string str)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Make the cell.  <a href="#a7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classCell.html">Cell</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a8">separate_parse</a> (string &amp;sexpr)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Separately parse the sexpr and build the tree.  <a href="#a8"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classCell.html">Cell</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a9">parse</a> (string sexpr)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Recursively parse sexpr and build the parse tree.  <a href="#a9"></a><br></td></tr><tr><td colspan="2"><br><h2>Variables</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="parse_8cpp.html#a0">inparsecar</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Implementation of a parser that analyzes a string containing an s-expression, and determines its tree structure.<hr><h2>Function Documentation</h2><a class="anchor" name="a5" doxytag="parse.cpp::clearwhitespace"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void clearwhitespace           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>sexpr</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Clear the whitespace at the begining and end of string sexpr. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>sexpr</em>&nbsp;</td><td>The string. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a6" doxytag="parse.cpp::is_legalexpr"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">bool is_legalexpr           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>sexpr</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Check whether the s-expression legal. <p>    </td>  </tr></table><a class="anchor" name="a2" doxytag="parse.cpp::is_legalnumeric"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">bool is_legalnumeric           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Check whether numericstr is an legal numericstr string. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>The string to be checked </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>ture if numericstr is an legal numericstr string, false otherwise </dd></dl>    </td>  </tr></table><a class="anchor" name="a3" doxytag="parse.cpp::is_legaloperator"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">bool is_legaloperator           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Check whether str is a legal operator. <p>    </td>  </tr></table><a class="anchor" name="a1" doxytag="parse.cpp::iswhitespace"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">bool iswhitespace           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">char&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>ch</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Check whether the character is whitespace. <p><dl compact><dt><b>Returns:</b></dt><dd>True if it is character, false else. </dd></dl><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>ch</em>&nbsp;</td><td>The character to check. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a7" doxytag="parse.cpp::makecell"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"><a class="el" href="classCell.html">Cell</a>* makecell           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Make the cell. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>The string to represent the symbol, int or double. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a9" doxytag="parse.cpp::parse"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"><a class="el" href="classCell.html">Cell</a>* parse           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>sexpr</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Recursively parse sexpr and build the parse tree. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>sexpr</em>&nbsp;</td><td>The s-expression stored in a string variable (note that this version of parse has side effects: it may alter the contents of sexpr).</td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>A pointer to the conspair cell at the root of the parse tree. </dd></dl>    </td>  </tr></table><a class="anchor" name="a4" doxytag="parse.cpp::readsinglesymbol"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void readsinglesymbol           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string &amp;&nbsp;</td>          <td class="mdname" nowrap> <em>substring</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>string &amp;&nbsp;</td>          <td class="mdname" nowrap> <em>sexpr</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><a class="anchor" name="a8" doxytag="parse.cpp::separate_parse"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"><a class="el" href="classCell.html">Cell</a> * separate_parse           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">string &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>instr</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Separately parse the sexpr and build the tree. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>instr</em>&nbsp;</td><td>The string which consists of s-expressions. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>A pointer to the conspair cell at the root of the parse tree. </dd></dl>    </td>  </tr></table><hr><h2>Variable Documentation</h2><a class="anchor" name="a0" doxytag="parse.cpp::inparsecar"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">bool <a class="el" href="parse_8cpp.html#a0">inparsecar</a>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>    </td>  </tr></table><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 28 22:53:54 2007 for a1 by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -