File: abstract-syntax/core/expression/unary/delay.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: Umu#6
  module: AbstractSyntax#8
  module: Core#10
  module: Expression#12
has properties
function: make_delay / 2 #50
  module: Unary#14
  class: Delay#16
inherits from
  Abstract ( Umu::AbstractSyntax::Core::Expression::Unary )
has properties
alias: expr obj #17
method: initialize / 2 #20
method: to_s #27
method: pretty_print / 1 #32
method: __evaluate__ / 2 #40

Code

   1  # coding: utf-8
   2  # frozen_string_literal: true
   3 
   4 
   5 
   6  module Umu
   7 
   8  module AbstractSyntax
   9 
  10  module Core
  11 
  12  module Expression
  13 
  14  module Unary
  15 
  16  class Delay < Abstract
  17      alias expr obj
  18 
  19 
  20      def initialize(loc, expr)
  21          ASSERT.kind_of expr, ASCE::Abstract
  22 
  23          super
  24      end
  25 
  26 
  27      def to_s
  28          format "%%DELAY %s", self.expr.to_s
  29      end
  30 
  31 
  32      def pretty_print(q)
  33          q.text '%DELAY '
  34          q.pp self.expr
  35      end
  36 
  37 
  38  private
  39 
  40      def __evaluate__(env, event)
  41          VC.make_suspension self.expr, env.va_context
  42      end
  43  end
  44 
  45  end # Umu::AbstractSyntax::Core::Expression::Unary
  46 
  47 
  48  module_function
  49 
  50      def make_delay(loc, expr)
  51          ASSERT.kind_of loc,  LOC::Entry
  52          ASSERT.kind_of expr, ASCE::Abstract
  53 
  54          Unary::Delay.new(loc, expr).freeze
  55      end
  56 
  57  end # Umu::AbstractSyntax::Core::Expression
  58 
  59  end # Umu::AbstractSyntax::Core
  60 
  61  end # Umu::AbstractSyntax
  62 
  63  end # Umu