Assembler.Assembler.Term C# (CSharp) Method

Term() private method

private Term ( Stack operations ) : void
operations Stack
return void
        private void Term(Stack<ExpressionOperation> operations)
        {
            Factor(operations);

            while (AssemblyTokenizer.IsTermOperation(tokens[pos].Type))
            {
                if (Accept(TokenType.Multiply))
                {
                    Factor(operations);
                    operations.Push(new ExpressionOperation(TokenType.Multiply));
                }
                else if (Accept(TokenType.Divide))
                {
                    Factor(operations);
                    operations.Push(new ExpressionOperation(TokenType.Divide));
                }
                else if (Accept(TokenType.Modulo))
                {
                    Factor(operations);
                    operations.Push(new ExpressionOperation(TokenType.Modulo));
                }
                else
                    throw new AssemblerException("Unexpected term operation.");
            }
        }