File: concrete-syntax/core/expression/binary/infix/pipe.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: Umu#6
  module: ConcreteSyntax#8
  module: Core#10
  module: Expression#12
has properties
function: make_pipe_left / 5 #70
function: make_pipe_right / 5 #83
  module: Binary#14
  module: Infix#16
  module: Pipe#18
  class: Abstract#20
  class: Left#41
inherits from
  Abstract ( Umu::ConcreteSyntax::Core::Expression::Binary::Infix::Pipe )
has properties
method: __desugar__ / 2 #45
  class: Right#52
inherits from
  Abstract ( Umu::ConcreteSyntax::Core::Expression::Binary::Infix::Pipe )
has properties
method: __desugar__ / 2 #56

Code

   1  # coding: utf-8
   2  # frozen_string_literal: true
   3 
   4 
   5 
   6  module Umu
   7 
   8  module ConcreteSyntax
   9 
  10  module Core
  11 
  12  module Expression
  13 
  14  module Binary
  15 
  16  module Infix
  17 
  18  module Pipe
  19 
  20  class Abstract < Abstraction::WithRepetition
  21 
  22  private
  23 
  24      def __desugar_pipe__(env, event, &_block)
  25          new_env = env.enter event
  26 
  27          opnd_expr,
  28          hd_opr_exprs,
  29          *tl_opr_exprs = self.then { |exprs|
  30                              yield exprs
  31                          }.map { |expr|
  32                              expr.desugar new_env
  33                          }
  34 
  35          ASCE.make_pipe self.loc, opnd_expr, hd_opr_exprs, tl_opr_exprs
  36      end
  37  end
  38 
  39 
  40 
  41  class Left < Abstract
  42 
  43  private
  44 
  45      def __desugar__(env, event)
  46          __desugar_pipe__ env, event, &:each
  47      end
  48  end
  49 
  50 
  51 
  52  class Right < Abstract
  53 
  54  private
  55 
  56      def __desugar__(env, event)
  57          __desugar_pipe__ env, event, &:reverse_each
  58      end
  59  end
  60 
  61  end # Umu::ConcreteSyntax::Core::Expression::Binary::Infix::Pipe
  62 
  63  end # Umu::ConcreteSyntax::Core::Expression::Binary::Infix
  64 
  65  end # Umu::ConcreteSyntax::Core::Expression::Binary
  66 
  67 
  68  module_function
  69 
  70      def make_pipe_left(loc, lhs_opnd, opr_sym, hd_rhs_opnd, tl_rhs_opnds)
  71          ASSERT.kind_of loc,             LOC::Entry
  72          ASSERT.kind_of lhs_opnd,        CSCE::Abstract
  73          ASSERT.kind_of opr_sym,         ::Symbol
  74          ASSERT.kind_of hd_rhs_opnd,     CSCE::Abstract
  75          ASSERT.kind_of tl_rhs_opnds,    ::Array
  76 
  77          Binary::Infix::Pipe::Left.new(
  78              loc, lhs_opnd, opr_sym, hd_rhs_opnd, tl_rhs_opnds.freeze
  79          ).freeze
  80      end
  81 
  82 
  83      def make_pipe_right(loc, lhs_opnd, opr_sym, hd_rhs_opnd, tl_rhs_opnds)
  84          ASSERT.kind_of loc,             LOC::Entry
  85          ASSERT.kind_of lhs_opnd,        CSCE::Abstract
  86          ASSERT.kind_of opr_sym,         ::Symbol
  87          ASSERT.kind_of hd_rhs_opnd,     CSCE::Abstract
  88          ASSERT.kind_of tl_rhs_opnds,    ::Array
  89 
  90          Binary::Infix::Pipe::Right.new(
  91              loc, lhs_opnd, opr_sym, hd_rhs_opnd, tl_rhs_opnds.freeze
  92          ).freeze
  93      end
  94 
  95  end # Umu::ConcreteSyntax::Core::Expression
  96 
  97  end # Umu::ConcreteSyntax::Core
  98 
  99  end # Umu::ConcreteSyntax
 100 
 101  end # Umu