Skip to content

Commit f3587d8

Browse files
authored
fix #2199: parse non breaking white space   as white space (#3487)
1 parent 50bd26c commit f3587d8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/expression/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ export const createParse = /* #__PURE__ */ factory(name, dependencies, ({
543543
*/
544544
parse.isWhitespace = function isWhitespace (c, nestingLevel) {
545545
// TODO: also take '\r' carriage return as newline? Or does that give problems on mac?
546-
return c === ' ' || c === '\t' || (c === '\n' && nestingLevel > 0)
546+
return c === ' ' || c === '\t' || c === '\u00A0' || (c === '\n' && nestingLevel > 0)
547547
}
548548

549549
/**

test/unit-tests/expression/parse.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ describe('parse', function () {
9797
math.evaluate('\uD835\uDD38 = 1', scope) // double struck capital A
9898
assert.strictEqual(scope['\uD835\uDD38'], 1)
9999

100+
math.evaluate('x\t=\u00A02 +\u00A04', scope) // Non-breaking space ( )
101+
assert.strictEqual(scope.x, 6)
102+
100103
// should not allow the "holes"
101104
assert.throws(function () {
102105
math.evaluate('\uD835\uDCA3 = 1', scope)

0 commit comments

Comments
 (0)