Sha256: e576b9762aa52999fcc99e688f54051ee1560af4be2dbf130d2ce74d1c9202dd

Contents?: true

Size: 559 Bytes

Versions: 15

Compression:

Stored size: 559 Bytes

Contents

module WLang
  class Compiler
    class StaticMerger < Filter

      def on_strconcat(*exps)
        result = [:strconcat]
        text = nil

        exps.each do |exp|
          if exp.first == :static
            if text
              text << exp.last
            else
              text = exp.last.dup
              result << [:static, text]
            end
          else
            result << compile(exp)
            text = nil
          end
        end

        result
      end

    end # class StaticMerger
  end # class Compiler
end # module WLang

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wlang-3.0.1 lib/wlang/compiler/static_merger.rb
wlang-3.0.0 lib/wlang/compiler/static_merger.rb
wlang-2.3.1 lib/wlang/compiler/static_merger.rb
wlang-2.3.0 lib/wlang/compiler/static_merger.rb
wlang-2.2.4 lib/wlang/compiler/static_merger.rb
wlang-2.2.3 lib/wlang/compiler/static_merger.rb
wlang-2.2.2 lib/wlang/compiler/static_merger.rb
wlang-2.2.1 lib/wlang/compiler/static_merger.rb
wlang-2.2.0 lib/wlang/compiler/static_merger.rb
wlang-2.1.2 lib/wlang/compiler/static_merger.rb
wlang-2.1.1 lib/wlang/compiler/static_merger.rb
wlang-2.1.0 lib/wlang/compiler/static_merger.rb
wlang-2.0.1 lib/wlang/compiler/static_merger.rb
wlang-2.0.0 lib/wlang/compiler/static_merger.rb
wlang-2.0.0.beta lib/wlang/compiler/static_merger.rb