Skip to content

invisibleOperator canonicalization #219

@alexisflesch

Description

@alexisflesch

Description

Parsing some expressions with canonical : ["InvisibleOperator"] can remove items that shouldn't be removed. For example,

  • parsing the expression 1(2+3) with canonical : ["InvisibleOperator"] drops the 1 (it shouldn't)
  • parsing the expression 1(2+3) with canonical: false doesn't

Steps to Reproduce

Load the ComputeEngine and parse the expression 1(2+3).

const ce = new ComputeEngine();
expression = "1(1+1)";
ce.parse(expression , { canonical: ["InvisibleOperator"] }).print();

Actual Result

Gives an oversimplified MathJSON like so
["Delimiter",["Add",2,3]]

Expected Result

A less simplified MathJSON object like the one found with canonical: false.
["Multiply",1,["Delimiter",["Add",2,3]]]

Environment

Compute Engine version 0.26.4

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions