Sha256: 4d30c62aae26de446eb112f1896145a3c87f594985932245c76b934b66e86d64

Contents?: true

Size: 1.18 KB

Versions: 23

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module SlimLint
  # Generates a {SlimLint::Sexp} suitable for consumption by the
  # {RubyExtractor}.
  #
  # This is mostly copied from Slim::Engine, with some filters and generators
  # omitted.
  class RubyExtractEngine < Temple::Engine
    filter :Encoding
    filter :RemoveBOM

    # Parse into S-expression using Slim parser
    use Slim::Parser

    # Perform additional processing so extracting Ruby code in {RubyExtractor}
    # is easier. We don't do this for regular linters because some information
    # about the original syntax tree is lost in the process, but that doesn't
    # matter in this case.
    use Slim::Embedded
    use Slim::Interpolation
    use SlimLint::Filters::SplatProcessor
    use Slim::DoInserter
    use Slim::EndInserter
    use SlimLint::Filters::ControlProcessor
    use SlimLint::Filters::AttributeProcessor
    filter :MultiFlattener
    filter :StaticMerger

    # Converts Array-based S-expressions into SlimLint::Sexp objects, and gives
    # them line numbers so we can easily map from the Ruby source to the
    # original source
    use SlimLint::Filters::SexpConverter
    use SlimLint::Filters::InjectLineNumbers
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
slim_lint-0.31.1 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.31.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.30.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.29.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.28.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.27.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.26.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.25.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.24.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.23.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.22.1 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.22.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.21.1 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.21.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.20.2 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.20.1 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.20.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.19.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.18.0 lib/slim_lint/ruby_extract_engine.rb
slim_lint-0.17.1 lib/slim_lint/ruby_extract_engine.rb