Sha256: 3cbb238767883356ff00f62fcac9a79a4f02c8222ab05dae62a68c0f1844c22b

Contents?: true

Size: 494 Bytes

Versions: 10

Compression:

Stored size: 494 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]
          marker = true
          exprs.delete_at(i)
        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

10 entries across 10 versions & 1 rubygems

Version Path
faml-0.6.0 lib/faml/newline.rb
faml-0.5.1 lib/faml/newline.rb
faml-0.5.0 lib/faml/newline.rb
faml-0.4.2 lib/faml/newline.rb
faml-0.4.1 lib/faml/newline.rb
faml-0.4.0 lib/faml/newline.rb
faml-0.3.6 lib/faml/newline.rb
faml-0.3.5 lib/faml/newline.rb
faml-0.3.4 lib/faml/newline.rb
faml-0.3.3 lib/faml/newline.rb