josdejong / josdejong/mathjs

parser apparently aliases the `state` argument to internal functions

Open
#3,629 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

OK, inserted `return parseSymbol(state)` at the point where `not` is detected. Note that it's necessary to restore `state` to what it was before grabbing the `(` token; you can't just return `parseSymbol(saveState)`. In other words, the `state` object that comes into parseUnary must be aliased somewhere, so that if it doesn't agree with the state passed into parseSymbol then the parse is spoiled. Should I file an issue about that, or just not worry about it since the parser is working as long as you properly update the input state object in every parseXxx() function? (I'm inclined toward the latter.)

_Originally posted by @gwhitney in https://github.com/josdejong/mathjs/pull/3611#discussion_r2641366557_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.