Merge pull request #3056 from grahamc/operators

operators: document exact precedence, split up similar operators
This commit is contained in:
Eelco Dolstra 2019-08-27 17:12:36 +02:00 committed by GitHub
commit 177e5742fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,13 +15,16 @@ weakest binding).</para>
<tgroup cols='3'> <tgroup cols='3'>
<thead> <thead>
<row> <row>
<entry>Name</entry>
<entry>Syntax</entry> <entry>Syntax</entry>
<entry>Associativity</entry> <entry>Associativity</entry>
<entry>Description</entry> <entry>Description</entry>
<entry>Precedence</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>Select</entry>
<entry><replaceable>e</replaceable> <literal>.</literal> <entry><replaceable>e</replaceable> <literal>.</literal>
<replaceable>attrpath</replaceable> <replaceable>attrpath</replaceable>
[ <literal>or</literal> <replaceable>def</replaceable> ] [ <literal>or</literal> <replaceable>def</replaceable> ]
@ -33,19 +36,25 @@ weakest binding).</para>
dot-separated list of attribute names.) If the attribute dot-separated list of attribute names.) If the attribute
doesnt exist, return <replaceable>def</replaceable> if doesnt exist, return <replaceable>def</replaceable> if
provided, otherwise abort evaluation.</entry> provided, otherwise abort evaluation.</entry>
<entry>1</entry>
</row> </row>
<row> <row>
<entry>Application</entry>
<entry><replaceable>e1</replaceable> <replaceable>e2</replaceable></entry> <entry><replaceable>e1</replaceable> <replaceable>e2</replaceable></entry>
<entry>left</entry> <entry>left</entry>
<entry>Call function <replaceable>e1</replaceable> with <entry>Call function <replaceable>e1</replaceable> with
argument <replaceable>e2</replaceable>.</entry> argument <replaceable>e2</replaceable>.</entry>
<entry>2</entry>
</row> </row>
<row> <row>
<entry>Arithmetic Negation</entry>
<entry><literal>-</literal> <replaceable>e</replaceable></entry> <entry><literal>-</literal> <replaceable>e</replaceable></entry>
<entry>none</entry> <entry>none</entry>
<entry>Arithmetic negation.</entry> <entry>Arithmetic negation.</entry>
<entry>3</entry>
</row> </row>
<row> <row>
<entry>Has Attribute</entry>
<entry><replaceable>e</replaceable> <literal>?</literal> <entry><replaceable>e</replaceable> <literal>?</literal>
<replaceable>attrpath</replaceable></entry> <replaceable>attrpath</replaceable></entry>
<entry>none</entry> <entry>none</entry>
@ -53,34 +62,69 @@ weakest binding).</para>
the attribute denoted by <replaceable>attrpath</replaceable>; the attribute denoted by <replaceable>attrpath</replaceable>;
return <literal>true</literal> or return <literal>true</literal> or
<literal>false</literal>.</entry> <literal>false</literal>.</entry>
<entry>4</entry>
</row> </row>
<row> <row>
<entry>List Concatenation</entry>
<entry><replaceable>e1</replaceable> <literal>++</literal> <replaceable>e2</replaceable></entry> <entry><replaceable>e1</replaceable> <literal>++</literal> <replaceable>e2</replaceable></entry>
<entry>right</entry> <entry>right</entry>
<entry>List concatenation.</entry> <entry>List concatenation.</entry>
<entry>5</entry>
</row> </row>
<row> <row>
<entry>Multiplication</entry>
<entry> <entry>
<replaceable>e1</replaceable> <literal>*</literal> <replaceable>e2</replaceable>, <replaceable>e1</replaceable> <literal>*</literal> <replaceable>e2</replaceable>,
</entry>
<entry>left</entry>
<entry>Arithmetic multiplication.</entry>
<entry>6</entry>
</row>
<row>
<entry>Division</entry>
<entry>
<replaceable>e1</replaceable> <literal>/</literal> <replaceable>e2</replaceable> <replaceable>e1</replaceable> <literal>/</literal> <replaceable>e2</replaceable>
</entry> </entry>
<entry>left</entry> <entry>left</entry>
<entry>Arithmetic multiplication and division.</entry> <entry>Arithmetic division.</entry>
<entry>6</entry>
</row> </row>
<row> <row>
<entry>Addition</entry>
<entry>
<replaceable>e1</replaceable> <literal>+</literal> <replaceable>e2</replaceable>
</entry>
<entry>left</entry>
<entry>Arithmetic addition.</entry>
<entry>7</entry>
</row>
<row>
<entry>Subtraction</entry>
<entry> <entry>
<replaceable>e1</replaceable> <literal>+</literal> <replaceable>e2</replaceable>,
<replaceable>e1</replaceable> <literal>-</literal> <replaceable>e2</replaceable> <replaceable>e1</replaceable> <literal>-</literal> <replaceable>e2</replaceable>
</entry> </entry>
<entry>left</entry> <entry>left</entry>
<entry>Arithmetic addition and subtraction. String or path concatenation (only by <literal>+</literal>).</entry> <entry>Arithmetic subtraction.</entry>
<entry>7</entry>
</row> </row>
<row> <row>
<entry>String Concatenation</entry>
<entry>
<replaceable>string1</replaceable> <literal>+</literal> <replaceable>string2</replaceable>
</entry>
<entry>left</entry>
<entry>String concatenation.</entry>
<entry>7</entry>
</row>
<row>
<entry>Not</entry>
<entry><literal>!</literal> <replaceable>e</replaceable></entry> <entry><literal>!</literal> <replaceable>e</replaceable></entry>
<entry>none</entry> <entry>none</entry>
<entry>Boolean negation.</entry> <entry>Boolean negation.</entry>
<entry>8</entry>
</row> </row>
<row> <row>
<entry>Update</entry>
<entry><replaceable>e1</replaceable> <literal>//</literal> <entry><replaceable>e1</replaceable> <literal>//</literal>
<replaceable>e2</replaceable></entry> <replaceable>e2</replaceable></entry>
<entry>right</entry> <entry>right</entry>
@ -89,47 +133,90 @@ weakest binding).</para>
<replaceable>e2</replaceable> (with the latter taking <replaceable>e2</replaceable> (with the latter taking
precedence over the former in case of equally named precedence over the former in case of equally named
attributes).</entry> attributes).</entry>
<entry>9</entry>
</row> </row>
<row> <row>
<entry>Less Than</entry>
<entry> <entry>
<replaceable>e1</replaceable> <literal>&lt;</literal> <replaceable>e2</replaceable>, <replaceable>e1</replaceable> <literal>&lt;</literal> <replaceable>e2</replaceable>,
<replaceable>e1</replaceable> <literal>&gt;</literal> <replaceable>e2</replaceable>, </entry>
<replaceable>e1</replaceable> <literal>&lt;=</literal> <replaceable>e2</replaceable>, <entry>none</entry>
<entry>Arithmetic comparison.</entry>
<entry>10</entry>
</row>
<row>
<entry>Less Than or Equal To</entry>
<entry>
<replaceable>e1</replaceable> <literal>&lt;=</literal> <replaceable>e2</replaceable>
</entry>
<entry>none</entry>
<entry>Arithmetic comparison.</entry>
<entry>10</entry>
</row>
<row>
<entry>Greater Than</entry>
<entry>
<replaceable>e1</replaceable> <literal>&gt;</literal> <replaceable>e2</replaceable>
</entry>
<entry>none</entry>
<entry>Arithmetic comparison.</entry>
<entry>10</entry>
</row>
<row>
<entry>Greater Than or Equal To</entry>
<entry>
<replaceable>e1</replaceable> <literal>&gt;=</literal> <replaceable>e2</replaceable> <replaceable>e1</replaceable> <literal>&gt;=</literal> <replaceable>e2</replaceable>
</entry> </entry>
<entry>none</entry> <entry>none</entry>
<entry>Arithmetic comparison.</entry> <entry>Arithmetic comparison.</entry>
<entry>10</entry>
</row> </row>
<row> <row>
<entry>Equality</entry>
<entry>
<replaceable>e1</replaceable> <literal>==</literal> <replaceable>e2</replaceable>
</entry>
<entry>none</entry>
<entry>Equality.</entry>
<entry>11</entry>
</row>
<row>
<entry>Inequality</entry>
<entry> <entry>
<replaceable>e1</replaceable> <literal>==</literal> <replaceable>e2</replaceable>,
<replaceable>e1</replaceable> <literal>!=</literal> <replaceable>e2</replaceable> <replaceable>e1</replaceable> <literal>!=</literal> <replaceable>e2</replaceable>
</entry> </entry>
<entry>none</entry> <entry>none</entry>
<entry>Equality and inequality.</entry> <entry>Inequality.</entry>
<entry>11</entry>
</row> </row>
<row> <row>
<entry>Logical AND</entry>
<entry><replaceable>e1</replaceable> <literal>&amp;&amp;</literal> <entry><replaceable>e1</replaceable> <literal>&amp;&amp;</literal>
<replaceable>e2</replaceable></entry> <replaceable>e2</replaceable></entry>
<entry>left</entry> <entry>left</entry>
<entry>Logical AND.</entry> <entry>Logical AND.</entry>
<entry>12</entry>
</row> </row>
<row> <row>
<entry>Logical OR</entry>
<entry><replaceable>e1</replaceable> <literal>||</literal> <entry><replaceable>e1</replaceable> <literal>||</literal>
<replaceable>e2</replaceable></entry> <replaceable>e2</replaceable></entry>
<entry>left</entry> <entry>left</entry>
<entry>Logical OR.</entry> <entry>Logical OR.</entry>
<entry>13</entry>
</row> </row>
<row> <row>
<entry>Logical Implication</entry>
<entry><replaceable>e1</replaceable> <literal>-></literal> <entry><replaceable>e1</replaceable> <literal>-></literal>
<replaceable>e2</replaceable></entry> <replaceable>e2</replaceable></entry>
<entry>none</entry> <entry>none</entry>
<entry>Logical implication (equivalent to <entry>Logical implication (equivalent to
<literal>!<replaceable>e1</replaceable> || <literal>!<replaceable>e1</replaceable> ||
<replaceable>e2</replaceable></literal>).</entry> <replaceable>e2</replaceable></literal>).</entry>
<entry>14</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
</section> </section>