private void InitMath() { var closeTagLexeme = new CloseTagLexeme <double>(")", 1); var openTagLexeme = new OpenTagLexeme <double>("(", 1); closeTagLexeme.OpenTag = openTagLexeme; openTagLexeme.CloseTag = closeTagLexeme; _mathOperations = new List <IOperationLexeme <double> > { openTagLexeme, closeTagLexeme, new BinaryOperationLexeme <double>("+", 2, MathLexemeOperations.Add), new BinaryOperationLexeme <double>("-", 3, MathLexemeOperations.Minus), new UnaryOperationLexeme <double>("-", 4, MathLexemeOperations.Minus), new BinaryOperationLexeme <double>("*", 5, MathLexemeOperations.Multiply), new BinaryOperationLexeme <double>("/", 5, MathLexemeOperations.Divide), new BinaryOperationLexeme <double>("^", 6, MathLexemeOperations.Pow), new UnaryOperationLexeme <double>("cos", 7, MathLexemeOperations.Cos), new UnaryOperationLexeme <double>("sin", 7, MathLexemeOperations.Sin) }; _mathOperations.Sort(new LexemeComparer <double>()); _mathLexemeParser = new MathLexemeParser(_mathOperations); }
private void InitLogic() { var closeTagLexeme = new CloseTagLexeme <bool>(")", 1); var openTagLexeme = new OpenTagLexeme <bool>("(", 1); closeTagLexeme.OpenTag = openTagLexeme; openTagLexeme.CloseTag = closeTagLexeme; _logicOperations = new List <IOperationLexeme <bool> > { openTagLexeme, closeTagLexeme, new BinaryOperationLexeme <bool>("\\/", 2, LogicLexemeOperations.Or), new BinaryOperationLexeme <bool>("/\\", 3, LogicLexemeOperations.And), new UnaryOperationLexeme <bool>("!", 4, LogicLexemeOperations.Mirror), }; _logicOperations.Sort(new LexemeComparer <bool>()); _logicLexemeParser = new LogicLexemeParser(_logicOperations); }
private void InitMatrix() { var closeTagLexeme = new CloseTagLexeme <Matrix>(")", 1); var openTagLexeme = new OpenTagLexeme <Matrix>("(", 1); closeTagLexeme.OpenTag = openTagLexeme; openTagLexeme.CloseTag = closeTagLexeme; _matrixOperations = new List <IOperationLexeme <Matrix> > { openTagLexeme, closeTagLexeme, new BinaryOperationLexeme <Matrix>("+", 2, MatrixLexemeOperations.Add), new BinaryOperationLexeme <Matrix>("-", 3, MatrixLexemeOperations.Minus), new UnaryOperationLexeme <Matrix>("-", 3, MatrixLexemeOperations.Minus), new BinaryOperationLexeme <Matrix>("*", 4, MatrixLexemeOperations.Multiply), new UnaryOperationLexeme <Matrix>("inv", 5, MatrixLexemeOperations.Invariant) }; _matrixOperations.Sort(new LexemeComparer <Matrix>()); _matrixLexemeParser = new MatrixLexemeParser(_matrixOperations); }