コード例 #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);
        }
コード例 #2
0
ファイル: TermExpression.cs プロジェクト: brn-dev/Matura
        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);
        }