diff --git a/content/v2.0/reference/flux/language/expressions.md b/content/v2.0/reference/flux/language/expressions.md index da47dff6e..1bec1bb6a 100644 --- a/content/v2.0/reference/flux/language/expressions.md +++ b/content/v2.0/reference/flux/language/expressions.md @@ -42,7 +42,7 @@ Object literals construct a value with the object type. ```js ObjectLiteral = "{" ObjectBody "}" . ObjectBody = WithProperties | PropertyList . -WithProperties = identifier "with" PropertyList . +WithProperties = identifier "with" PropertyList . PropertyList = [ Property { "," Property } ] . Property = identifier [ ":" Expression ] | string_lit ":" Expression . @@ -198,22 +198,23 @@ Operators combine operands into expressions. The precedence of the operators is given in the table below. Operators with a lower number have higher precedence. -| Precedence | Operator | Description | -|:----------:|:--------: |:--------------------------| -| 1 | `a()` | Function call | -| | `a[]` | Member or index access | -| | `.` | Member access | -| 2 | `*` `/` |Multiplication and division| -| 3 | `+` `-` | Addition and subtraction | -| 4 |`==` `!=` | Comparison operators | -| | `<` `<=` | | -| | `>` `>=` | | -| |`=~` `!~` | | -| 5 | `not` | Unary logical operator | -| | `exists` | Null check operator | -| 6 | `and` | Logical AND | -| 7 | `or` | Logical OR | -| 8 | `if` `then` `else` | Conditional | +| Precedence | Operator | Description | +|:----------:|:--------: |:-------------------------- | +| 1 | `a()` | Function call | +| | `a[]` | Member or index access | +| | `.` | Member access | +| 2 | `^` | Exponentiation | +| 3 | `*` `/` `%` | Multiplication, division, and modulo | +| 4 | `+` `-` | Addition and subtraction | +| 5 |`==` `!=` | Comparison operators | +| | `<` `<=` | | +| | `>` `>=` | | +| |`=~` `!~` | | +| 6 | `not` | Unary logical operator | +| | `exists` | Null check operator | +| 7 | `and` | Logical AND | +| 8 | `or` | Logical OR | +| 9 | `if` `then` `else` | Conditional | The operator precedence is encoded directly into the grammar as the following. @@ -235,7 +236,7 @@ AdditiveExpression = MultiplicativeExpression AdditiveOperator = "+" | "-" . MultiplicativeExpression = PipeExpression | MultiplicativeExpression MultiplicativeOperator PipeExpression . -MultiplicativeOperator = "*" | "/" . +MultiplicativeOperator = "*" | "/" | "%" | "^". PipeExpression = PostfixExpression | PipeExpression PipeOperator UnaryExpression . PipeOperator = "|>" . diff --git a/content/v2.0/reference/flux/language/operators.md b/content/v2.0/reference/flux/language/operators.md index ff0894932..0daf8d919 100644 --- a/content/v2.0/reference/flux/language/operators.md +++ b/content/v2.0/reference/flux/language/operators.md @@ -34,7 +34,8 @@ perform a calculation that returns a single numerical value. | `-` | Subtraction | `3 - 2` | `1` | | `*` | Multiplication | `2 * 3` | `6` | | `/` | Division | `9 / 3` | `3` | -| `%` | Modulus | `10 % 5` | `0` | +| `^` | Exponentiation | `2 ^ 3` | `8` | +| `%` | Modulo | `10 % 5` | `0` | {{% note %}} In the current version of Flux, values used in arithmetic operations must