Tighten up operator table a bit.

This commit is contained in:
Bob Nystrom
2015-03-13 07:56:47 -07:00
parent 69567c5eb5
commit f7849244a8
2 changed files with 64 additions and 126 deletions

View File

@ -268,184 +268,112 @@ precedence table, from highest to lowest, is:
<table class="precedence">
<tbody>
<tr>
<th>Precedence</th>
<th>Prec</th>
<th>Operator</th>
<th>Description</th>
<th>Associativity</th>
<th>Assoc</th>
</tr>
<tr>
<td>1</td>
<td>()</td>
<td>Call</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>1</td>
<td>[]</td>
<td>Subscript</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>1</td>
<td>.</td>
<td>Selection</td>
<td>Left-to-right</td>
<td><code>()</code> <code>[]</code> <code>.</code></td>
<td>Grouping, Subscript, Method call</td>
<td>Left</td>
</tr>
<tr>
<td>2</td>
<td>-</td>
<td>Unary minus</td>
<td>Right-to-left</td>
</tr>
<tr>
<td>2</td>
<td>!</td>
<td>Logical not</td>
<td>Right-to-left</td>
</tr>
<tr>
<td>2</td>
<td>~</td>
<td>Bitwise not</td>
<td>Right-to-left</td>
<td><code>-</code> <code>!</code> <code>~</code></td>
<td>Negate, Not, Complement</td>
<td>Right</td>
</tr>
<tr>
<td>3</td>
<td>*</td>
<td>Multiplication</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>3</td>
<td>/</td>
<td>Division</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>3</td>
<td>%</td>
<td>Modulo</td>
<td>Left-to-right</td>
<td><code>*</code> <code>/</code> <code>%</code></td>
<td>Multiply, Divide, Modulo</td>
<td>Left</td>
</tr>
<tr>
<td>4</td>
<td>+</td>
<td>Addition</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>4</td>
<td>-</td>
<td>Subtraction</td>
<td>Left-to-right</td>
<td><code>+</code> <code>-</code></td>
<td>Add, Subtract</td>
<td>Left</td>
</tr>
<tr>
<td>5</td>
<td>..</td>
<td>Range (inclusive)</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>5</td>
<td>...</td>
<td>Range (half-inclusive)</td>
<td>Left-to-right</td>
<td><code>..</code> <code>...</code></td>
<td>Inclusive range, Exclusive range</td>
<td>Left</td>
</tr>
<tr>
<td>6</td>
<td>&lt;&lt;</td>
<td>Bitwise left shift</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>6</td>
<td>&gt;&gt;</td>
<td>Bitwise right shift</td>
<td>Left-to-right</td>
<td><code>&lt;&lt;</code> <code>&gt;&gt;</code></td>
<td>Left shift, Right shift</td>
<td>Left</td>
</tr>
<tr>
<td>7</td>
<td>&lt;</td>
<td>Less than</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>7</td>
<td>&lt;=</td>
<td>Less than or equal to</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>7</td>
<td>&gt;</td>
<td>Greater than</td>
<td>Left-to-right</td>
</tr>
<tr>
<td>7</td>
<td>&gt;=</td>
<td>Greater than or equal to</td>
<td>Left-to-right</td>
<td><code>&lt;</code> <code>&lt;=</code> <code>&gt;</code> <code>&gt;=</code></td>
<td>Comparison</td>
<td>Left</td>
</tr>
<tr>
<td>8</td>
<td>==</td>
<td>Equal to</td>
<td>Left-to-right</td>
<td><code>==</code></td>
<td>Equals</td>
<td>Left</td>
</tr>
<tr>
<td>8</td>
<td>!=</td>
<td>Not equal to</td>
<td>Left-to-right</td>
<td><code>!=</code></td>
<td>Not equal</td>
<td>Left</td>
</tr>
<tr>
<td>9</td>
<td>&amp;</td>
<td>Bitwise AND</td>
<td>Left-to-right</td>
<td><code>&amp;</code></td>
<td>Bitwise and</td>
<td>Left</td>
</tr>
<tr>
<td>10</td>
<td>^</td>
<td>Bitwise XOR</td>
<td>Left-to-right</td>
<td><code>^</code></td>
<td>Bitwise xor</td>
<td>Left</td>
</tr>
<tr>
<td>11</td>
<td>|</td>
<td>Bitwise OR</td>
<td>Left-to-right</td>
<td><code>|</code></td>
<td>Bitwise or</td>
<td>Left</td>
</tr>
<tr>
<td>12</td>
<td>is</td>
<td><code>is</code></td>
<td>Type test</td>
<td>Left-to-right</td>
<td>Left</td>
</tr>
<tr>
<td>13</td>
<td>&amp;&amp;</td>
<td>Logical AND</td>
<td>Left-to-right</td>
<td><code>&amp;&amp;</code></td>
<td>Logical and</td>
<td>Left</td>
</tr>
<tr>
<td>14</td>
<td>||</td>
<td>Logical OR</td>
<td>Left-to-right</td>
<td><code>||</code></td>
<td>Logical or</td>
<td>Left</td>
</tr>
<tr>
<td>15</td>
<td>?:</td>
<td>Ternary Conditional</td>
<td>Right-to-left</td>
<td><code>?:</code></td>
<td>Conditional</td>
<td>Right</td>
</tr>
<tr>
<td>16</td>
<td>=</td>
<td>Assignment</td>
<td>Right-to-left</td>
<td><code>=</code></td>
<td>Assign</td>
<td>Right</td>
</tr>
</tbody>
</table>

View File

@ -340,8 +340,18 @@ table.chart {
// Precedence table on expressions page.
table.precedence {
tr {
padding: 2px 0;
th {
font: 500 11px $subheader;
text-transform: uppercase;
letter-spacing: 1px;
color: $gray-60;
padding: 6px 0;
border-bottom: solid 1px $gray-10;
}
td {
padding: 3px 0;
border-bottom: solid 1px $gray-10;
}
}