Sha256: ab3a23dca326a354eb0c6a23b90fcf395de709129043a906aa9073eb19358d87

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

module Hexp
  module CssSelector
    # A CSS Parser that only knows how to parse CSS selectors
    #
    class SassParser < ::Sass::SCSS::CssParser
      # Initialize the parser with the selector to parse
      #
      # @param [String] selector
      #
      # @api private
      def initialize(selector)
        super(selector, '')
      end

      # Parse the selector
      #
      # @return [Sass::Selector::CommaSequence]
      #
      # @api private
      def parse
        init_scanner!
        result = selector_comma_sequence
        raise "Invalid CSS selector : unconsumed input #{@scanner.rest}" unless @scanner.eos?
        result
      end

      # Parse a CSS selector in one go
      #
      # @param [String] selector
      # @return [Sass::Selector::CommaSequence]
      #
      # @api private
      def self.call(selector)
        self.new(selector).parse
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hexp-0.3.2 lib/hexp/css_selector/sass_parser.rb
hexp-0.3.1 lib/hexp/css_selector/sass_parser.rb
hexp-0.3.0 lib/hexp/css_selector/sass_parser.rb