Click here to Skip to main content
15,895,740 members
Articles / Programming Languages / C#

An extensible math expression parser with plug-ins

Rate me:
Please Sign up or sign in to vote.
4.92/5 (147 votes)
13 Mar 2008CPOL51 min read 1.5M   29K   364  
Design and code for an extensible, maintainable, robust, and easy to use math parser.
<!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>MTParserLib: MTParserPrivate.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="main.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="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>MTParserPrivate.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Internal declarations. 
<p>
<dl compact><dt><b>Author:</b></dt><dd>(c) 2008 Mathieu Jacques</dd></dl>
Put the implementation in this file (if needed) in order to avoid to have to use a .cpp file. Clients of this file (like plug-ins) should not have to link with the library only to use basic services.
<p>
Definition in file <a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.h</a>.
<p>
<code>#include &quot;<a class="el" href="MTParserPublic_8h-source.html">MTParserPublic.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="MTParserExcepStrEng_8h-source.html">MTParserExcepStrEng.h</a>&quot;</code><br>
<code>#include &lt;windows.h&gt;</code><br>

<p>
<a href="MTParserPrivate_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structSItemInfo.html">SItemInfo</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTRegistrarI.html">MTRegistrarI</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Private Registrar Interface.  <a href="classMTRegistrarI.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTCompilerI.html">MTCompilerI</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Private Compiler interface.  <a href="classMTCompilerI.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTCompilerStateI.html">MTCompilerStateI</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compiler state Interface.  <a href="classMTCompilerStateI.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTConvFunctionI.html">MTConvFunctionI</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Conversion Function Interface.  <a href="classMTConvFunctionI.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTFctParamTokenizer.html">MTFctParamTokenizer</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Function Parameter Tokenizer.  <a href="classMTFctParamTokenizer.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMTFctParamTokenizer_1_1ClientFctI.html">MTFctParamTokenizer::ClientFctI</a></td></tr>

<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="MTParserPrivate_8h.html#a0">MTTHROW</a>(data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Throw a first exception without parent exception.  <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="MTParserPrivate_8h.html#a1">MTRETHROW</a>(data, e)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Throw an exception with its parent exceptions.  <a href="#a1"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2"></a><!-- doxytag: member="MTParserPrivate.h::ItemInfoStack" ref="a2" args="" -->
typedef std::vector&lt; <a class="el" href="structSItemInfo.html">SItemInfo</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="MTParserPrivate_8h.html#a2">ItemInfoStack</a></td></tr>

</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="a1"></a><!-- doxytag: member="MTParserPrivate.h::MTRETHROW" ref="a1" args="(data, e)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define MTRETHROW          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">data,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>e&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </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>
<b>Value:</b><div class="fragment"><pre class="fragment">{                                                                                                                                                       \
                                <a class="code" href="MTUnicodeANSIDefs_8h.html#a0">MTSTRING</a> desc = <a class="code" href="classMTParserExcepStrEng.html#e0">MTParserExcepStrEng::format</a>(data);                                              \
                                e.add(__LINE__,  _T(__FILE__), 0, data, desc.c_str()); <span class="keywordflow">throw</span>(e);                \
                        }
</pre></div>Throw an exception with its parent exceptions. 
<p>
This macro puts the line number, the source file and a default description.<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>data</em>&nbsp;</td><td>The exception date to add to the chain </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>e</em>&nbsp;</td><td>The parent exception</td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="MTParserPrivate_8h-source.html#l00038">38</a> of file <a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.h</a>.
<p>
Referenced by <a class="el" href="MTParserRegistrar_8cpp-source.html#l00934">MTParserRegistrar::loadPlugin()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="a0"></a><!-- doxytag: member="MTParserPrivate.h::MTTHROW" ref="a0" args="(data)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define MTTHROW          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">data&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </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>
<b>Value:</b><div class="fragment"><pre class="fragment">{                                                                                                                                                       \
                                <a class="code" href="MTUnicodeANSIDefs_8h.html#a0">MTSTRING</a> desc = <a class="code" href="classMTParserExcepStrEng.html#e0">MTParserExcepStrEng::format</a>(data);                                              \
                                <span class="keywordflow">throw</span>( <a class="code" href="classMTChainedExceptions.html">MTChainedExceptions&lt;MTExcepData&gt;</a>(        __LINE__, _T(__FILE__),         \
                                                                                                                0, data, desc.c_str()) );               \
                        }
</pre></div>Throw a first exception without parent exception. 
<p>
This macro puts the line number, the source file and a default description.<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>data</em>&nbsp;</td><td>The data exception</td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="MTParserPrivate_8h-source.html#l00024">24</a> of file <a class="el" href="MTParserPrivate_8h-source.html">MTParserPrivate.h</a>.
<p>
Referenced by <a class="el" href="MTParserLocalizer_8cpp-source.html#l00149">MTParserLocalizer::getConstInfo()</a>, <a class="el" href="MTParserLocalizer_8cpp-source.html#l00219">MTParserLocalizer::getExcep()</a>, <a class="el" href="MTParserLocalizer_8cpp-source.html#l00128">MTParserLocalizer::getFuncInfo()</a>, <a class="el" href="MTParserLocalizer_8cpp-source.html#l00138">MTParserLocalizer::getOpInfo()</a>, <a class="el" href="MTParserLocalizer_8cpp-source.html#l00160">MTParserLocalizer::getVarInfo()</a>, <a class="el" href="MTParser_8cpp-source.html#l00332">MTParser::loadAllPlugins()</a>, <a class="el" href="MTParserRegistrar_8cpp-source.html#l00934">MTParserRegistrar::loadPlugin()</a>, and <a class="el" href="MTParserCompiler_8cpp-source.html#l00981">MTParserCompiler::throwParsingExcep()</a>.    </td>
  </tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun Mar 9 17:39:36 2008 for MTParserLib by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
Software Engineer working at a fun and smart startup company

Comments and Discussions