Sha256: 37c30fcb92006e7c6b619fb5ed428e2f6a83943135c11074ed78d3ff0451f8ba

Contents?: true

Size: 1.37 KB

Versions: 23

Compression:

Stored size: 1.37 KB

Contents

module Sass
  module SCSS
    # A parser for a static SCSS tree.
    # Parses with SCSS extensions, like nested rules and parent selectors,
    # but without dynamic SassScript.
    # This is useful for e.g. \{#parse\_selector parsing selectors}
    # after resolving the interpolation.
    class StaticParser < Parser
      # Parses the text as a selector.
      #
      # @param line [Fixnum] The line on which the selector appears.
      #   Used for error reporting
      # @param filename [String, nil] The file in which the selector appears,
      #   or nil if there is no such file.
      #   Used for error reporting
      # @return [Selector::CommaSequence] The parsed selector
      # @raise [Sass::SyntaxError] if there's a syntax error in the selector
      def parse_selector(filename)
        init_scanner!
        seq = expr!(:selector_comma_sequence)
        expected("selector") unless @scanner.eos?
        seq.line = @line
        seq.filename = filename
        seq
      end

      private

      def variable; nil; end
      def script_value; nil; end
      def interpolation; nil; end
      def interp_string; s = tok(STRING) and [s]; end
      def interp_ident(ident = IDENT); s = tok(ident) and [s]; end
      def use_css_import?; true; end

      def special_directive(name)
        return unless name == 'media' || name == 'import'
        super
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
haml-edge-3.1.60 lib/sass/scss/static_parser.rb
haml-edge-3.1.59 lib/sass/scss/static_parser.rb
haml-3.0.16 lib/sass/scss/static_parser.rb
haml-edge-3.1.58 lib/sass/scss/static_parser.rb
haml-edge-3.1.57 lib/sass/scss/static_parser.rb
haml-edge-3.1.56 lib/sass/scss/static_parser.rb
haml-edge-3.1.55 lib/sass/scss/static_parser.rb
haml-edge-3.1.54 lib/sass/scss/static_parser.rb
haml-edge-3.1.53 lib/sass/scss/static_parser.rb
haml-edge-3.1.52 lib/sass/scss/static_parser.rb
haml-edge-3.1.51 lib/sass/scss/static_parser.rb
haml-3.0.15 lib/sass/scss/static_parser.rb
haml-edge-3.1.50 lib/sass/scss/static_parser.rb
haml-3.0.14 lib/sass/scss/static_parser.rb
haml-edge-3.1.49 lib/sass/scss/static_parser.rb
haml-3.0.13 lib/sass/scss/static_parser.rb
haml-edge-3.1.48 lib/sass/scss/static_parser.rb
haml-edge-3.1.47 lib/sass/scss/static_parser.rb
haml-edge-3.1.46 lib/sass/scss/static_parser.rb
haml-edge-3.1.45 lib/sass/scss/static_parser.rb