Sha256: d38cf9b1d0d73077b5a1448ea9608d377ff6169e6964a7ef3c65874bdf84bd1e

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

module Unparser
  class Emitter
    # Emitter for for nodes
    class For < self
      include Terminated

      handle :for

      children :condition, :assignment, :body

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(K_FOR, WS)
        emit_condition
        emit_body
        k_end
      end

      # Emit assignment
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_condition
        visit_plain(condition)
        write(WS, K_IN, WS)
        visit(assignment)
        write(WS, K_DO)
      end

    end # For
  end # Emitter
end # Unparser

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unparser-0.2.8 lib/unparser/emitter/for.rb
unparser-0.2.7 lib/unparser/emitter/for.rb
unparser-0.2.6 lib/unparser/emitter/for.rb
unparser-0.2.5 lib/unparser/emitter/for.rb