Skip to content

Commit

Permalink
Permit evaluation of functions with operator names without inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Aug 3, 2024
1 parent 2cf6729 commit ceface8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions src/parser/parseExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit ceface8

Please sign in to comment.