Пример #1
0
        public Expression Parse(MathParser parser, Token <RMathToken> token)
        {
            var e = new AbsExpression(parser.ParseExpression());

            parser.Take(RMathToken.Pipe);
            return(e);
        }
Пример #2
0
        public Expression Parse(MathParser parser, Token <RMathToken> token)
        {
            var e = parser.ParseExpression();

            parser.Take(RMathToken.RightParen);
            return(e);
        }
Пример #3
0
        private void ReportLongestSubsequence(string equation)
        {
            Expression parsed = MathParser.ParseExpression(equation);

            Print();
            Print("----------------------------");
            Print(parsed.ToString());
            ReportSubsequence(parsed);
        }
Пример #4
0
        public void CombineArithmeticTokens(string expressionString, string expected)
        {
            Expression exp = MathParser.ParseExpression(expressionString);

            Print("-----");
            Print();
            Print($"Input: {exp.ToString()}");
            Print();

            exp.Simplify();
            Print($"Result: [{exp.ToString()}]           Expecting: ({expected})");
            Print();

            Assert.AreEqual(expected, exp.ToString());
        }
Пример #5
0
        public Expression Parse(MathParser parser, Expression left, Token <RMathToken> token)
        {
            var right = parser.ParseExpression(Precedence - (_right ? 1 : 0));

            return(new BinaryOperatorExpression(left, right, token));
        }
Пример #6
0
        public Expression Parse(MathParser parser, Token <RMathToken> token)
        {
            var right = parser.ParseExpression(_precedence);

            return(new PrefixOperatorExpression(token, right));
        }