File: abstract-syntax/core/expression/suspended-stream.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_suspended_stream / 2 #49
  class: SuspendedStream#14
inherits from
  Abstract ( Umu::AbstractSyntax::Core::Expression )
has properties
attribute: expr [R] #15
method: initialize / 2 #18
method: to_s #27
method: pretty_print / 1 #32
method: __evaluate__ / 2 #41

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  class SuspendedStream < Expression::Abstract
  15      attr_reader :expr
  16 
  17 
  18      def initialize(loc, expr)
  19          ASSERT.kind_of expr, ASCE::Abstract
  20 
  21          super(loc)
  22 
  23          @expr = expr
  24      end
  25 
  26 
  27      def to_s
  28          format "&{ %s }", self.expr.to_s
  29      end
  30 
  31 
  32      def pretty_print(q)
  33          PRT.group q, bb:'&{', eb:'}', sep:' ' do
  34              q.pp self.expr
  35          end
  36      end
  37 
  38 
  39  private
  40 
  41      def __evaluate__(env, event)
  42          VC.make_suspended_stream self.expr, env.va_context
  43      end
  44  end
  45 
  46 
  47  module_function
  48 
  49      def make_suspended_stream(loc, expr)
  50          ASSERT.kind_of loc,     LOC::Entry
  51          ASSERT.kind_of expr,    ASCE::Abstract
  52 
  53          SuspendedStream.new(loc, expr).freeze
  54      end
  55 
  56  end # Umu::AbstractSyntax::Core::Expression
  57 
  58  end # Umu::AbstractSyntax::Core
  59 
  60  end # Umu::AbstractSyntax
  61 
  62  end # Umu