Sha256: 4b8c4061e4237590a57d7643a6b6416728e14189e7e1b4cc4395f79986f46e2e

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

require 'temple'

module Faml
  class Newline < Temple::Filter
    def on_multi(*exprs)
      i = exprs.size-1
      marker = false
      while i >= 0
        case exprs[i]
        when [:rmnl]
          if marker
            raise "InternalError: double rmnl error"
          else
            marker = true
            exprs.delete_at(i)
          end
        when [:mknl]
          if marker
            marker = false
            exprs.delete_at(i)
          else
            exprs[i] = [:static, "\n"]
          end
        end
        i -= 1
      end
      [:multi, *exprs]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faml-0.2.0 lib/faml/newline.rb