<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="Up" href="Pa_infix.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Pa_do_nums" rel="Chapter" href="Pa_do_nums.html"> <link title="Pa_infix" rel="Chapter" href="Pa_infix.html"><title>Pa_infix.Level</title> </head> <body> <div class="navbar"> <a class="up" href="Pa_infix.html" title="Pa_infix">Up</a> </div> <h1>Module <a href="type_Pa_infix.Level.html">Pa_infix.Level</a></h1> <pre><span class="keyword">module</span> Level: <code class="code">sig</code> <a href="Pa_infix.Level.html">..</a> <code class="code">end</code></pre><div class="info"> Level of precedence of operators (also specifies their associativity).<br> </div> <hr width="100%"> <pre><span id="TYPEunary"><span class="keyword">type</span> <code class="type"></code>unary</span> </pre> <pre><span id="TYPEbinary"><span class="keyword">type</span> <code class="type"></code>binary</span> </pre> <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre> <div class="info"> A precedence level. Can be for unary or binary operators. Precedence levels know their associativity.<br> </div> <pre><code><span id="TYPEarity"><span class="keyword">type</span> <code class="type"></code>arity</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTarity.Unary"><span class="constructor">Unary</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTarity.Binary"><span class="constructor">Binary</span></span></code></td> </tr></table> <div class="info"> Arity of a level. Levels for unary and binary operators are different (unary operators always bind more tightly than binary ones).<br> </div> <pre><span id="TYPEassoc"><span class="keyword">type</span> <code class="type"></code>assoc</span> = <code class="type">Camlp4.Sig.Grammar.assoc</code> = </pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTassoc.NonA"><span class="constructor">NonA</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTassoc.RightA"><span class="constructor">RightA</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTassoc.LeftA"><span class="constructor">LeftA</span></span></code></td> </tr></table> <div class="info"> Possible associativity values for binary infix operators.<br> </div> <pre><code><span id="TYPEprecedence"><span class="keyword">type</span> <code class="type">'a</code> precedence</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTprecedence.Highest"><span class="constructor">Highest</span></span></code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Binds tighter than all previously defined levels of the same arity.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTprecedence.Higher"><span class="constructor">Higher</span></span> <span class="keyword">of</span> <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a></code></code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code class="code">Higher l</code> binds tighter than the level <code class="code">l</code>.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTprecedence.Lower"><span class="constructor">Lower</span></span> <span class="keyword">of</span> <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a></code></code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code class="code">Lower l</code> binds less tight than <code class="code">l</code></td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTprecedence.Lowest"><span class="constructor">Lowest</span></span></code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Binds less tight than all previously defined levels of the same arity.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> <div class="info"> Relative precedence of new levels.<br> </div> <pre><span id="EXCEPTIONBad_arity"><span class="keyword">exception</span> Bad_arity</span></pre> <div class="info"> <code class="code">Bad_arity</code> is raised if the type of level required by a function is not respected.<br> </div> <pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a> -> 'b <a href="Pa_infix.Level.html#TYPEt">t</a> -> int</code></pre><div class="info"> Total ordering on Level.t<br> </div> <pre><span id="VALbinary"><span class="keyword">val</span> binary</span> : <code class="type">?name:string -><br> ?assoc:<a href="Pa_infix.Level.html#TYPEassoc">assoc</a> -><br> <a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEprecedence">precedence</a> -><br> <a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">binary prec</code> creates a new level for infix operators at the level specified by <code class="code">prec</code>.<br> <b>Raises</b> <code>Bad_arity</code> if a <code class="code">'_a precedence</code> is given which does not turn out to be a <code class="code">binary precedence</code>.<br> </div> <div class="param_info"><code class="code">name</code> : the name of the new level (only used for error reporting).</div> <div class="param_info"><code class="code">assoc</code> : the associativity of the new level. By default, the associativity is inherited from the the level given in <code class="code">prec</code> or is <code class="code">NonA</code> for <code class="code">Highest</code> and <code class="code">Lowest</code>.</div> <pre><span id="VALunary"><span class="keyword">val</span> unary</span> : <code class="type">?name:string -><br> <a href="Pa_infix.Level.html#TYPEunary">unary</a> <a href="Pa_infix.Level.html#TYPEprecedence">precedence</a> -><br> <a href="Pa_infix.Level.html#TYPEunary">unary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">unnary prec</code> creates a new level for prefix or postfix operators at the level specified by <code class="code">prec</code>.<br> <b>Raises</b> <code>Bad_arity</code> if a <code class="code">'_a precedence</code> is given which does not turn out to be a <code class="code">unary precedence</code>.<br> </div> <div class="param_info"><code class="code">name</code> : the name of the new level.</div> <pre><span id="VALname"><span class="keyword">val</span> name</span> : <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a> -> string</code></pre><div class="info"> <code class="code">name l</code> returns the possible name given to the level <code class="code">l</code>.<br> </div> <pre><span id="VALarity"><span class="keyword">val</span> arity</span> : <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a> -> <a href="Pa_infix.Level.html#TYPEarity">arity</a></code></pre><div class="info"> <code class="code">arity l</code> returns the arity of that level.<br> </div> <pre><span id="VALassoc"><span class="keyword">val</span> assoc</span> : <code class="type">'a <a href="Pa_infix.Level.html#TYPEt">t</a> -> <a href="Pa_infix.Level.html#TYPEassoc">assoc</a></code></pre><div class="info"> <code class="code">assoc l</code> returns the associativity of that level.<br> </div> <pre><span id="VALassignment"><span class="keyword">val</span> assignment</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of ":="<br> </div> <pre><span id="VALdisjunction"><span class="keyword">val</span> disjunction</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "||"<br> </div> <pre><span id="VALconjunction"><span class="keyword">val</span> conjunction</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "&&"<br> </div> <pre><span id="VALcomparison"><span class="keyword">val</span> comparison</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "<", "<=", "=",...<br> </div> <pre><span id="VALconcatenation"><span class="keyword">val</span> concatenation</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "^"<br> </div> <pre><span id="VALaddition"><span class="keyword">val</span> addition</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "+", "-",...<br> </div> <pre><span id="VALmultiplication"><span class="keyword">val</span> multiplication</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "*", "/", "land",... and it is also the default level of alphabetic operators.<br> </div> <pre><span id="VALexponentiation"><span class="keyword">val</span> exponentiation</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEbinary">binary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "**", "lsl",...<br> </div> <pre><span id="VALdefault_unary"><span class="keyword">val</span> default_unary</span> : <code class="type"><a href="Pa_infix.Level.html#TYPEunary">unary</a> <a href="Pa_infix.Level.html#TYPEt">t</a></code></pre><div class="info"> Level of "!"<br> </div> </body></html>