Skip to content

Commit

Permalink
More operators and docs update
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
  • Loading branch information
Licenser committed Sep 26, 2023
1 parent 5c11db9 commit 32d25fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions static/language/epilog/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ For creating the product of numbers in a array we use:
end
```

The current supported operators in `use` are: `+`, `-`, `*` and `/`.



The `ForCaseClause` rule has examples of the two basic forms for record and array comprehensions.
For a overview of supported operators see the [operators](./../expressions/#operators) section.

The `ForCaseClause` rule has examples of the two basic forms for record and array comprehensions.
2 changes: 1 addition & 1 deletion tests/script_errors/bad_fold/error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Error:
1 | for event of
2 | case (k, v) => v
3 | into [] use merge end;
| ^^^^^ Found the token `merge` but expected one of `*`, `+`, `-`, `/`
| ^^^^^ Found the token `merge` but expected one of `%`, `&`, `*`, `+`, `-`, `/`, `^`
2 changes: 1 addition & 1 deletion tests/script_errors/bad_fold_imut/error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Error:
1 | (for event of
2 | case (k, v) => v
3 | into [] use merge end)
| ^^^^^ Found the token `merge` but expected one of `*`, `+`, `-`, `/`
| ^^^^^ Found the token `merge` but expected one of `%`, `&`, `*`, `+`, `-`, `/`, `^`
8 changes: 4 additions & 4 deletions tremor-script/src/grammar.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,10 @@ MaybeFoldOperator: Option<ComprehensionFoldOpRaw> = {
}

FoldOperator: ComprehensionFoldOpRaw = {
"+" => ComprehensionFoldOpRaw(BinOpKind::Add),
"-" => ComprehensionFoldOpRaw(BinOpKind::Sub),
"*" => ComprehensionFoldOpRaw(BinOpKind::Mul),
"/" => ComprehensionFoldOpRaw(BinOpKind::Div),
<BinAdd> => ComprehensionFoldOpRaw(<>),
<BinMul> => ComprehensionFoldOpRaw(<>),
<BinBitAnd> => ComprehensionFoldOpRaw(<>),
<BinBitXor> => ComprehensionFoldOpRaw(<>),
}

ForCaseClauses: ComprehensionCasesRaw<'input, ExprRaw<'input>> = {
Expand Down

0 comments on commit 32d25fa

Please sign in to comment.