diff --git a/CHANGELOG.md b/CHANGELOG.md index 876892246..f4ba2a379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http: - Repaired borrowed bindings from other sources. - Prevent project reevaluation during typing. +- Permit evaluation of functions with operator names without inputs. ## 0.10.7 2024-07-27 diff --git a/src/parser/parseExpression.ts b/src/parser/parseExpression.ts index c7305de6c..35cfb6bf1 100644 --- a/src/parser/parseExpression.ts +++ b/src/parser/parseExpression.ts @@ -239,8 +239,14 @@ function parseAtomicExpression(tokens: Tokens): Expression { : // Nones tokens.nextIs(Sym.None) ? parseNone(tokens) - : // Unary expressions before names and binary operators, since some unary can be multiple. - tokens.nextIsUnary() + : // Unary expressions are a unary operator and then any expression. + // The only exception is if it's immediately followed except for an eval open and close. This allows functions with operator names to be evaluated. + tokens.nextIsUnary() && + !tokens.nextAre( + Sym.Operator, + Sym.EvalOpen, + Sym.EvalClose, + ) ? new UnaryEvaluate( parseReference(tokens), parseAtomicExpression(tokens),