Mathos-Parser icon indicating copy to clipboard operation
Mathos-Parser copied to clipboard

Operators and whitespace

Open napen123 opened this issue 6 years ago • 0 comments

This fails to parse, with System.FormatException: Input string was not in a correct format being thrown:

MathParser parser = new MathParser();

parser.Operators.Add("λ", (left, right) => Math.Pow(left, right));

Assert.AreEqual(Math.Pow(3, 2), parser.Parse("3λ2"));

However, if the last statement is changed to have whitespace in the expression, it parses correctly:

Assert.AreEqual(Math.Pow(3, 2), parser.Parse("3 λ 2"));

napen123 avatar Jun 20 '18 03:06 napen123