Sha256: ed8db0f45a7fbeecc3c2856956258ff8cad0b349f8b06eefaf88761014b75f51

Contents?: true

Size: 1.29 KB

Versions: 15

Compression:

Stored size: 1.29 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 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
        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 var_expr; 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  %w[media import charset].include?(name)
        super
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sass-3.2.0.alpha.88 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.86 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.85 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.76 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.75 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.74 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.72 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.71 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.70 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.64 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.61 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.59 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.63 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.62 lib/sass/scss/static_parser.rb
sass-3.2.0.alpha.60 lib/sass/scss/static_parser.rb