Exemple #1
0
        // Слагаемое
        private TypeDesc Term(HashSet <SymbolEnum> followers)
        {
            var firstOperandType = NeutralizerDecoratorWithReturn(Factor, Starters.Factor, Followers.Factor, 6, followers);

            while (CurrentSymbol == SymbolEnum.Star ||
                   CurrentSymbol == SymbolEnum.Slash ||
                   CurrentSymbol == SymbolEnum.DivSy ||
                   CurrentSymbol == SymbolEnum.ModSy ||
                   CurrentSymbol == SymbolEnum.AndSy)
            {
                var operation = CurrentSymbol;
                NextSymbol();
                var secondOperandType = NeutralizerDecoratorWithReturn(Factor, Starters.Factor, Followers.Factor, 6, followers);
                var expressionType    = TypeValidator.GetTypeAfterMultiplication(firstOperandType, secondOperandType, operation);
                if (expressionType == null)
                {
                    Error(328);
                }

                return(expressionType);
            }

            return(firstOperandType);
        }