elematic / heximal

Heximal is a web-based interactive document and notebook system
MIT License
118 stars 1 forks source link

[expressions] Error parsing expression with chained array calls #9

Open brsanthu opened 1 week ago

brsanthu commented 1 week ago

@justinfagnani

Trying to parse expression [20, 30, 40, 50].filter(val => val < 40).join(',') but running into below error. Is this even possible with this library? If possible, is it a bug or any configuration I need to do? If not possible, what would it take to provide this capability?

Error

Error: Expected kind 9 ()), was 11 (=>)
    at Parser.#advance (file:///Users/brsanthu/projects/datasert/gitworkspace/formula-engine/node_modules/@heximal/expressions/src/lib/parser.ts:40:13)
    at Parser.#parseArguments (file:///Users/brsanthu/projects/datasert/gitworkspace/formula-engine/node_modules/@heximal/expressions/src/lib/parser.ts:273:18)
brsanthu commented 1 week ago

@justinfagnani Looks like it is due to I missing the parenthesis. This expression [20, 30, 40, 50].filter((val) => val < 40).join(',') works. Can we make the parenthesis optional for single argument arrow function?