Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 39121eaa6e08c828e313b57261e3f286 > files > 32

antlr-C++-doc-2.7.7-15.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ANTLR Support Libraries 2.7.1+: antlr/ASTFactory.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ANTLR Support Libraries 2.7.1+</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>antlr/ASTFactory.hpp</h1>  </div>
</div>
<div class="contents">
<a href="ASTFactory_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef INC_ASTFactory_hpp__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define INC_ASTFactory_hpp__</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="comment">/* ANTLR Translator Generator</span>
<a name="l00005"></a>00005 <span class="comment"> * Project led by Terence Parr at http://www.jGuru.com</span>
<a name="l00006"></a>00006 <span class="comment"> * Software rights: http://www.antlr.org/license.html</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTFactory.hpp#2 $</span>
<a name="l00009"></a>00009 <span class="comment"> */</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;antlr/config.hpp&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;antlr/AST.hpp&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;antlr/ASTArray.hpp&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;antlr/ASTPair.hpp&gt;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;istream&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;utility&gt;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="keyword">namespace </span>antlr {
<a name="l00021"></a>00021 <span class="preprocessor">#endif</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="comment">// Using these extra types to appease MSVC</span>
<a name="l00024"></a><a class="code" href="ASTFactory_8hpp.html#a2d75f858411b36f90810c514e027d898">00024</a> <span class="keyword">typedef</span> <a class="code" href="ASTRefCount_8hpp.html#a25b300faa8730e33c35b83c55afd2596">RefAST</a> (*<a class="code" href="ASTFactory_8hpp.html#a2d75f858411b36f90810c514e027d898">factory_type_</a>)();
<a name="l00025"></a><a class="code" href="ASTFactory_8hpp.html#a3b00832dfc56df44016c8e4a2fa859d9">00025</a> <span class="keyword">typedef</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)pair&lt; const <span class="keywordtype">char</span>*, <a class="code" href="ASTFactory_8hpp.html#a2d75f858411b36f90810c514e027d898">factory_type_</a> &gt;  <a class="code" href="ASTFactory_8hpp.html#a3b00832dfc56df44016c8e4a2fa859d9">factory_descriptor_</a>;
<a name="l00026"></a><a class="code" href="ASTFactory_8hpp.html#ad238d646f2cb061795ebb1781b5bd0b1">00026</a> typedef <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)vector&lt; factory_descriptor_* &gt;      <a class="code" href="ASTFactory_8hpp.html#ad238d646f2cb061795ebb1781b5bd0b1">factory_descriptor_list_</a>;
<a name="l00027"></a>00027 
<a name="l00036"></a><a class="code" href="classASTFactory.html">00036</a> class <a class="code" href="config_8hpp.html#ad583892c7af76867441115e41aa1ce52">ANTLR_API</a> <a class="code" href="classASTFactory.html">ASTFactory</a> {
<a name="l00037"></a>00037 <span class="keyword">public</span>:
<a name="l00038"></a><a class="code" href="classASTFactory.html#ab1f4d9a4164b3fdbc108cd80c4a90c91">00038</a>    <span class="keyword">typedef</span> <a class="code" href="ASTFactory_8hpp.html#a2d75f858411b36f90810c514e027d898">factory_type_</a>             <a class="code" href="classASTFactory.html#ab1f4d9a4164b3fdbc108cd80c4a90c91">factory_type</a>;
<a name="l00039"></a><a class="code" href="classASTFactory.html#a9c97858a3e774830ff79786df5e7eeb8">00039</a>    <span class="keyword">typedef</span> factory_descriptor_       <a class="code" href="classASTFactory.html#a9c97858a3e774830ff79786df5e7eeb8">factory_descriptor</a>;
<a name="l00040"></a><a class="code" href="classASTFactory.html#a5dd9db29bc09513ee1b8d669cd47177d">00040</a>    <span class="keyword">typedef</span> factory_descriptor_list_  <a class="code" href="classASTFactory.html#a5dd9db29bc09513ee1b8d669cd47177d">factory_descriptor_list</a>;
<a name="l00041"></a>00041 <span class="keyword">protected</span>:
<a name="l00042"></a>00042    <span class="comment">/* The mapping of AST node type to factory..</span>
<a name="l00043"></a>00043 <span class="comment">    */</span>
<a name="l00044"></a><a class="code" href="classASTFactory.html#a803fa045e14e331920a509f5a8dc84f1">00044</a>    factory_descriptor <a class="code" href="classASTFactory.html#a803fa045e14e331920a509f5a8dc84f1">default_factory_descriptor</a>;
<a name="l00045"></a><a class="code" href="classASTFactory.html#a853cf94e2d67392314cbba6d1118b22c">00045</a>    factory_descriptor_list <a class="code" href="classASTFactory.html#a853cf94e2d67392314cbba6d1118b22c">nodeFactories</a>;
<a name="l00046"></a>00046 <span class="keyword">public</span>:
<a name="l00048"></a>00048    ASTFactory();
<a name="l00054"></a>00054    ASTFactory( <span class="keyword">const</span> <span class="keywordtype">char</span>* factory_node_name, factory_type factory );
<a name="l00056"></a>00056    <span class="keyword">virtual</span> ~ASTFactory();
<a name="l00057"></a>00057 
<a name="l00059"></a>00059    <span class="keywordtype">void</span> registerFactory( <span class="keywordtype">int</span> type, <span class="keyword">const</span> <span class="keywordtype">char</span>* ast_name, factory_type factory );
<a name="l00061"></a>00061    <span class="keywordtype">void</span> setMaxNodeType( <span class="keywordtype">int</span> type );
<a name="l00062"></a>00062 
<a name="l00064"></a>00064    <span class="keywordtype">void</span> addASTChild(<a class="code" href="classASTPair.html">ASTPair</a>&amp; currentAST, <a class="code" href="classASTRefCount.html">RefAST</a> child);
<a name="l00066"></a>00066    <span class="keyword">virtual</span> <a class="code" href="classASTRefCount.html">RefAST</a> create();
<a name="l00068"></a>00068    <a class="code" href="classASTRefCount.html">RefAST</a> create(<span class="keywordtype">int</span> type);
<a name="l00070"></a>00070    <a class="code" href="classASTRefCount.html">RefAST</a> create(<span class="keywordtype">int</span> type, <span class="keyword">const</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)<span class="keywordtype">string</span>&amp; txt);
<a name="l00072"></a>00072    <a class="code" href="classASTRefCount.html">RefAST</a> create(<a class="code" href="classASTRefCount.html">RefAST</a> tr);
<a name="l00074"></a>00074    <a class="code" href="classASTRefCount.html">RefAST</a> create(<a class="code" href="classTokenRefCount.html">RefToken</a> tok);
<a name="l00076"></a>00076    <a class="code" href="classASTRefCount.html">RefAST</a> create(<span class="keyword">const</span> <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)<span class="keywordtype">string</span>&amp; txt, <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)istream&amp; infile );
<a name="l00080"></a>00080    <a class="code" href="classASTRefCount.html">RefAST</a> dup(<a class="code" href="classASTRefCount.html">RefAST</a> t);
<a name="l00082"></a>00082    <a class="code" href="classASTRefCount.html">RefAST</a> dupList(<a class="code" href="classASTRefCount.html">RefAST</a> t);
<a name="l00086"></a>00086    <a class="code" href="classASTRefCount.html">RefAST</a> dupTree(<a class="code" href="classASTRefCount.html">RefAST</a> t);
<a name="l00093"></a>00093    <a class="code" href="classASTRefCount.html">RefAST</a> make(<a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)vector&lt;RefAST&gt;&amp; nodes);
<a name="l00098"></a>00098    <a class="code" href="classASTRefCount.html">RefAST</a> make(<a class="code" href="classASTArray.html">ASTArray</a>* nodes);
<a name="l00100"></a>00100    <span class="keywordtype">void</span> makeASTRoot(<a class="code" href="classASTPair.html">ASTPair</a>&amp; currentAST, <a class="code" href="classASTRefCount.html">RefAST</a> root);
<a name="l00101"></a>00101 
<a name="l00109"></a>00109    <span class="keywordtype">void</span> setASTNodeFactory( <span class="keyword">const</span> <span class="keywordtype">char</span>* factory_node_name, factory_type factory );
<a name="l00110"></a>00110 
<a name="l00111"></a>00111 <span class="preprocessor">#ifdef ANTLR_SUPPORT_XML</span>
<a name="l00112"></a>00112 <span class="preprocessor"></span>
<a name="l00116"></a>00116    <a class="code" href="classASTRefCount.html">RefAST</a> LoadAST( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)istream&amp; infile );
<a name="l00117"></a>00117 <span class="preprocessor">#endif</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span><span class="keyword">protected</span>:
<a name="l00119"></a>00119    <span class="keywordtype">void</span> loadChildren( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)istream&amp; infile, <a class="code" href="classASTRefCount.html">RefAST</a> current );
<a name="l00120"></a>00120    <span class="keywordtype">void</span> loadSiblings( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)istream&amp; infile, <a class="code" href="classASTRefCount.html">RefAST</a> current );
<a name="l00121"></a>00121    <span class="keywordtype">bool</span> checkCloseTag( <a class="code" href="config_8hpp.html#ad1e4025d0db4046e6e85a46c92b7ff77">ANTLR_USE_NAMESPACE</a>(std)istream&amp; infile );
<a name="l00122"></a>00122 
<a name="l00123"></a>00123 <span class="preprocessor">#ifdef ANTLR_VECTOR_HAS_AT</span>
<a name="l00124"></a>00124 <span class="preprocessor"></span>
<a name="l00125"></a>00125    <span class="keyword">inline</span> <a class="code" href="classASTRefCount.html">RefAST</a> getNodeOfType( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00126"></a>00126    {
<a name="l00127"></a>00127       <span class="keywordflow">return</span> <a class="code" href="ASTRefCount_8hpp.html#a25b300faa8730e33c35b83c55afd2596">RefAST</a>(nodeFactories.at(type)-&gt;second());
<a name="l00128"></a>00128    }
<a name="l00130"></a>00130    <span class="keyword">const</span> <span class="keywordtype">char</span>* getASTNodeType( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00131"></a>00131    {
<a name="l00132"></a>00132       <span class="keywordflow">return</span> nodeFactories.at(type)-&gt;first;
<a name="l00133"></a>00133    }
<a name="l00135"></a>00135    factory_type getASTNodeFactory( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00136"></a>00136    {
<a name="l00137"></a>00137       <span class="keywordflow">return</span> nodeFactories.at(type)-&gt;second;
<a name="l00138"></a>00138    }
<a name="l00139"></a>00139 <span class="preprocessor">#else</span>
<a name="l00140"></a><a class="code" href="classASTFactory.html#ab52e3f4268d49df3bb1b00a913abbca6">00140</a> <span class="preprocessor"></span>   <span class="keyword">inline</span> <a class="code" href="classASTRefCount.html">RefAST</a> getNodeOfType( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00141"></a>00141    {
<a name="l00142"></a>00142       <span class="keywordflow">return</span> <a class="code" href="ASTRefCount_8hpp.html#a25b300faa8730e33c35b83c55afd2596">RefAST</a>(nodeFactories[type]-&gt;second());
<a name="l00143"></a>00143    }
<a name="l00145"></a><a class="code" href="classASTFactory.html#a636d3e54488e7308577da8efd8c36214">00145</a>    <span class="keyword">const</span> <span class="keywordtype">char</span>* getASTNodeType( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00146"></a>00146    {
<a name="l00147"></a>00147       <span class="keywordflow">return</span> nodeFactories[type]-&gt;first;
<a name="l00148"></a>00148    }
<a name="l00149"></a><a class="code" href="classASTFactory.html#a6f9a2eb1a3c134a9ad2f28c12e91a676">00149</a>    factory_type getASTNodeFactory( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> type )
<a name="l00150"></a>00150    {
<a name="l00151"></a>00151       <span class="keywordflow">return</span> nodeFactories[type]-&gt;second;
<a name="l00152"></a>00152    }
<a name="l00153"></a>00153 <span class="preprocessor">#endif</span>
<a name="l00154"></a>00154 <span class="preprocessor"></span>
<a name="l00155"></a>00155 <span class="keyword">private</span>:
<a name="l00156"></a>00156    <span class="comment">// no copying and such..</span>
<a name="l00157"></a>00157    ASTFactory( <span class="keyword">const</span> ASTFactory&amp; );
<a name="l00158"></a>00158    ASTFactory&amp; operator=( <span class="keyword">const</span> ASTFactory&amp; );
<a name="l00159"></a>00159 };
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 <span class="preprocessor">#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span>}
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span>
<a name="l00165"></a>00165 <span class="preprocessor">#endif //INC_ASTFactory_hpp__</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated on Fri Mar 25 2011 for ANTLR Support Libraries 2.7.1+ by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>