Sha256: f6e700e0b2f85216696c0a8f43121c1a3f07ccd16ad2f0e0647fa42792b7c7c2

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

require 'rubygems'
require 'ruby_parser'
require 'erb'

module Simplabs

  module Excellent

    module Parsing

      class Parser #:nodoc:

        def parse(content, filename)
          return silent_parse(content, filename)
        rescue Exception
          #continue on errors
        end

        private

          def silent_parse(content, filename)
            if @parser.nil?
              @parser = RUBY_VERSION =~ /2\.0/ ? Ruby19Parser.new : RubyParser.for_current_ruby
            else
              @parser.reset
            end
            content = ::ERB.new(content, nil, '-').src if filename =~ /\.erb$/
            sexp = @parser.parse(content, filename)
            sexp
          end

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
excellent-2.1.1 lib/simplabs/excellent/parsing/parser.rb