Esempio n. 1
0
        public override void Parse(IList <char> input)
        {
            Factor = new FactorExpression();
            Factor.Parse(input);

            if (input.Count == 0)
            {
                return;
            }

            if (input[0] != '^')
            {
                return;
            }

            input.RemoveAt(0);

            if (input.Count == 0)
            {
                throw new UnexpectedTokenException();
            }

            Power = new PowerExpression();
            Power.Parse(input);
        }
Esempio n. 2
0
        public override void Parse(IList <char> input)
        {
            Power = new PowerExpression();
            Power.Parse(input);

            if (input.Count == 0)
            {
                return;
            }

            if (input[0] != '*' && input[0] != '/')
            {
                return;
            }

            if (input[0] == '/')
            {
                IsDivision = true;
            }

            input.RemoveAt(0);

            //Term = new TermExpression();
            //Term.Parse(input);
            if (input.Count == 0)
            {
                throw new UnexpectedTokenException();
            }
            Term = new TermExpression();
            Term.Parse(input);
        }