Doc: bitwise operators in the main operator table and special assignment operators table
This commit is contained in:
parent
6fc689c46c
commit
01c04feea5
@ -737,7 +737,7 @@ The table below shows all supported operators by decreasing priorities.
|
||||
.Operators priorities
|
||||
[cols="^3,^2,^2,^5,^6"]
|
||||
|===
|
||||
| Priority | Operators | Position | Operation | Operands and results
|
||||
| Priority | Operator | Position | Operation | Operands and results
|
||||
|
||||
.2+|*ITEM*| [blue]`[`...`]` | _Postfix_ | _List item_| _list_ `[` _integer_ `]` -> _any_
|
||||
| [blue]`[`...`]` | _Postfix_ | _Dict item_ | _dict_ `[` _any_ `]` -> _any_
|
||||
@ -751,6 +751,8 @@ The table below shows all supported operators by decreasing priorities.
|
||||
.3+|*SIGN*| [blue]`+`, [blue]`-` | _Prefix_ | _Change-sign_| (`+`\|`-`) _number_ -> _number_
|
||||
| [blue]`#` | _Prefix_ | _Lenght-of_ | `#` _collection_ -> _integer_
|
||||
| [blue]`#` | _Prefix_ | _Size-of_ | `#` _iterator_ -> _integer_
|
||||
.2+|*BIT SHIFT*| [blue]`<<` | _Infix_ | _Left-Shift_ | _integer_ `<<` _integer_ -> _integer_
|
||||
| [blue]`>>` | _Infix_ | _Right-Shift_ | _integer_ `>>` _iterator_ -> _integer_
|
||||
.2+|*SELECT*| [blue]`? : ::` | _Multi-Infix_ | _Case-Selector_ | _any-expr_ `?` _case-list_ _case-expr_ `:` _case-list_ _case-expr_ ... `::` _default-expr_ -> _any_
|
||||
| [blue]`? : ::` | _Multi-Infix_ | _Index-Selector_ | _int-expr_ `?` _case-expr_ `:` _case-expr_ ... `::` _default-expr_ -> _any_
|
||||
.1+|*FRACT*| [blue]`:` | _Infix_ | _Fraction_ | _integer_ `:` _integer_ -> _fraction_
|
||||
@ -767,9 +769,9 @@ The table below shows all supported operators by decreasing priorities.
|
||||
| [blue]`+` | _Infix_ | _Dict-join_ | _dict_ `+` _dict_ -> _dict_
|
||||
| [blue]`-` | _Infix_ | _Subtraction_ | _number_ `-` _number_ -> _number_
|
||||
| [blue]`-` | _Infix_ | _List-difference_ | _list_ `-` _list_ -> _list_
|
||||
.1+|*BINARY NOT*| [blue]`~` | _Prefix_ | _Binary Not_ | `~` _number_ -> _number_
|
||||
.1+|*BINARY AND*| [blue]`&` | _Infix_ | _Binary And_ | _number_ `&` _number_ -> _number_
|
||||
.1+|*BINARY OR*| [blue]`\|` | _Infix_ | _Binary Or_ | _number_ `\|` _number_ -> _number_
|
||||
.1+|*BITWISE NOT*| [blue]`~` | _Prefix_ | _Binary Not_ | `~` _number_ -> _number_
|
||||
.1+|*BITWISE AND*| [blue]`&` | _Infix_ | _Binary And_ | _number_ `&` _number_ -> _number_
|
||||
.1+|*BITWISE OR*| [blue]`\|` | _Infix_ | _Binary Or_ | _number_ `\|` _number_ -> _number_
|
||||
.8+|*RELATION*| [blue]`<` | _Infix_ | _Less_ | _comparable_ `<` _comparable_ -> _boolean_
|
||||
| [blue]`\<=` | _Infix_ | _less-equal_ | _comparable_ `\<=` _comparable_ -> _boolean_
|
||||
| [blue]`>` | _Infix_ | _Greater_ | _comparable_ `>` _comparable_ -> _boolean_
|
||||
@ -785,15 +787,47 @@ The table below shows all supported operators by decreasing priorities.
|
||||
| [blue]`\|\|` | _Infix_ | _Or_ | _boolean_ `\|\|` _boolean_ -> _boolean_
|
||||
.2+|*INSERT*| [blue]`+>` | _Infix_ | _Prepend_ | _any_ `+>` _list_ -> _list_
|
||||
| [blue]`<+` | _Infix_ | _Append_ | _list_ `<+` _any_ -> _list_
|
||||
.3+|*ASSIGN*| [blue]`=` | _Infix_ | _Assignment_ | _identifier_ `=` _any_ -> _any_
|
||||
| [blue]`>>` | _Infix_ | _Front-insert_ | _any_ `>>` _list_ -> _list_
|
||||
| [blue]`<<` | _Infix_ | _Back-insert_ | _list_ `<<` _any_ -> _list_
|
||||
.2+|*ASSIGN*| [blue]`=` | _Infix_ | _Assignment_ | _identifier_ `=` _any_ -> _any_
|
||||
4+| _See also the special assignment operators table below_
|
||||
.1+|*BUT*| [blue]`but` | _Infix_ | _But_ | _any_ `but` _any_ -> _any_
|
||||
.1+|*RANGE*| [blue]`:` | _Infix_ | _Index-range_ | _integer_ `:` _integer_ -> _integer-pair_
|
||||
|===
|
||||
|
||||
//^1^ Experimental
|
||||
|
||||
.Special assignment perators
|
||||
[cols="^2,^2,^4,^6"]
|
||||
|===
|
||||
| Priority | Operator | Operation |Equivalent operation
|
||||
|
||||
.9+|*ASSIGN*| [blue]`+=` | _Sum & Assign_ | _var_ `\+=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `+` _expr_
|
||||
| [blue]`-=` | _Subtract & Assign_ | _var_ `-=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `-` _expr_
|
||||
| [blue]`*=` | _Multiply & Assign_ | _var_ `\*=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `*` _expr_
|
||||
| [blue]`/=` | _Divide & Assign_ | _var_ `/=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `/` _expr_
|
||||
| [blue]`%=` | _Remainder & Assign_ | _var_ `%=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `%` _expr_
|
||||
| [blue]`&=` | _Bitwise and & Assign_ | _var_ `&=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `&` _expr_
|
||||
| [blue]`\|=` | _Bitwise or & Assign_ | _var_ `\|=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `\|` _expr_
|
||||
| [blue]`<\<=` | _Left shift & Assign_ | _var_ `<\<=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `<<` _expr_
|
||||
| [blue]`>>=` | _Right shift & Assign_ | _var_ `>>=` _expr_ +
|
||||
short for +
|
||||
_var_ `=` _value-of-var_ `>>` _expr_
|
||||
|===
|
||||
|
||||
== Functions
|
||||
Functions in _Expr_ are very similar to functions available in many programming languages. Currently, _Expr_ supports two types of function, _expr-functions_ and _go-functions_.
|
||||
@ -844,7 +878,7 @@ _param-name_ = _identifier_
|
||||
|
||||
|
||||
=== _Golang_ function definition
|
||||
Description of how to define Golan functions and how to bind them to _Expr_ are topics treated in another document that I'll write, one day, maybe.
|
||||
Description of how to define Golang functions and how to bind them to _Expr_ are topics covered in another document that I'll write, one day, maybe.
|
||||
|
||||
=== Function calls
|
||||
To call a function, either Expr or Golang type, it is necessary to specify its name and, at least, its required parameters.
|
||||
|
121
doc/Expr.html
121
doc/Expr.html
@ -1909,7 +1909,7 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-center valign-top">Priority</th>
|
||||
<th class="tableblock halign-center valign-top">Operators</th>
|
||||
<th class="tableblock halign-center valign-top">Operator</th>
|
||||
<th class="tableblock halign-center valign-top">Position</th>
|
||||
<th class="tableblock halign-center valign-top">Operation</th>
|
||||
<th class="tableblock halign-center valign-top">Operands and results</th>
|
||||
@ -1988,6 +1988,19 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code>#</code> <em>iterator</em> → <em>integer</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top" rowspan="2"><p class="tableblock"><strong>BIT SHIFT</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue"><<</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Left-Shift</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>integer</em> <code><<</code> <em>integer</em> → <em>integer</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">>></code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Right-Shift</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>integer</em> <code>>></code> <em>iterator</em> → <em>integer</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top" rowspan="2"><p class="tableblock"><strong>SELECT</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">? : ::</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Multi-Infix</em></p></td>
|
||||
@ -2088,21 +2101,21 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>list</em> <code>-</code> <em>list</em> → <em>list</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BINARY NOT</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BITWISE NOT</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">~</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Prefix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Binary Not</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code>~</code> <em>number</em> → <em>number</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BINARY AND</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BITWISE AND</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">&</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Binary And</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>number</em> <code>&</code> <em>number</em> → <em>number</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BINARY OR</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BITWISE OR</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">|</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Binary Or</em></p></td>
|
||||
@ -2204,23 +2217,14 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>list</em> <code><+</code> <em>any</em> → <em>list</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top" rowspan="3"><p class="tableblock"><strong>ASSIGN</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top" rowspan="2"><p class="tableblock"><strong>ASSIGN</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Assignment</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>identifier</em> <code>=</code> <em>any</em> → <em>any</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">>></code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Front-insert</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>any</em> <code>>></code> <em>list</em> → <em>list</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue"><<</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Infix</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Back-insert</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>list</em> <code><<</code> <em>any</em> → <em>list</em></p></td>
|
||||
<td class="tableblock halign-center valign-top" colspan="4"><p class="tableblock"><em>See also the special assignment operators table below</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><strong>BUT</strong></p></td>
|
||||
@ -2238,6 +2242,89 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="tableblock frame-all grid-all stretch">
|
||||
<caption class="title">Table 9. Special assignment perators</caption>
|
||||
<colgroup>
|
||||
<col style="width: 14.2857%;">
|
||||
<col style="width: 14.2857%;">
|
||||
<col style="width: 28.5714%;">
|
||||
<col style="width: 42.8572%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-center valign-top">Priority</th>
|
||||
<th class="tableblock halign-center valign-top">Operator</th>
|
||||
<th class="tableblock halign-center valign-top">Operation</th>
|
||||
<th class="tableblock halign-center valign-top">Equivalent operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top" rowspan="9"><p class="tableblock"><strong>ASSIGN</strong></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">+=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Sum & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>+=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>+</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">-=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Subtract & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>-=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>-</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">*=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Multiply & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>*=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>*</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">/=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Divide & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>/=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>/</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">%=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Remainder & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>%=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>%</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">&=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Bitwise and & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>&=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>&</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">|=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Bitwise or & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>|=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>|</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue"><<=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Left shift & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code><<=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code><<</code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">>>=</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Right shift & Assign</em></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>var</em> <code>>>=</code> <em>expr</em> <br>
|
||||
short for<br>
|
||||
<em>var</em> <code>=</code> <em>value-of-var</em> <code>>></code> <em>expr</em></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
@ -2309,7 +2396,7 @@ These operators have a high priority, in particular higher than the operator <co
|
||||
<div class="sect2">
|
||||
<h3 id="_golang_function_definition"><a class="anchor" href="#_golang_function_definition"></a><a class="link" href="#_golang_function_definition">6.2. <em>Golang</em> function definition</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>Description of how to define Golan functions and how to bind them to <em>Expr</em> are topics treated in another document that I’ll write, one day, maybe.</p>
|
||||
<p>Description of how to define Golang functions and how to bind them to <em>Expr</em> are topics covered in another document that I’ll write, one day, maybe.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
@ -2488,7 +2575,7 @@ g(@p):any{}`
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2024-12-28 19:21:30 +0100
|
||||
Last updated 2025-01-03 05:42:18 +0100
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user