Sha256: e2cc3f6c6de82f53479cff6d8f29bd7a066985c42b19e71e33a78a2ee7e39666

Contents?: true

Size: 1.67 KB

Versions: 95

Compression:

Stored size: 1.67 KB

Contents

require 'sass/script/css_parser'

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 moz_document_function
        return unless val = tok(URI) || tok(URL_PREFIX) || tok(DOMAIN) ||
          function(!:allow_var)
        ss
        [val]
      end

      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_uri; s = tok(URI) 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 -moz-document].include?(name)
        super
      end

      @sass_script_parser = Class.new(Sass::Script::CssParser)
      @sass_script_parser.send(:include, ScriptParser)
    end
  end
end

Version data entries

95 entries across 90 versions & 11 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/sass-3.2.19/lib/sass/scss/static_parser.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/sass-3.2.19/lib/sass/scss/static_parser.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/sass-3.2.5/lib/sass/scss/static_parser.rb
xass-0.1.0 lib/sass/scss/static_parser.rb
oreorenasass-3.4.14 lib/sass/scss/static_parser.rb
oreorenasass-3.4.13 lib/sass/scss/static_parser.rb
oreorenasass-3.4.12 lib/sass/scss/static_parser.rb
oreorenasass-3.4.11 lib/sass/scss/static_parser.rb
oreorenasass-3.4.9 lib/sass/scss/static_parser.rb
oreorenasass-3.4.7 lib/sass/scss/static_parser.rb
oreorenasass-3.4.5 lib/sass/scss/static_parser.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/sass-3.2.14/lib/sass/scss/static_parser.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/sass-3.2.14/lib/sass/scss/static_parser.rb
sass-3.2.19 lib/sass/scss/static_parser.rb
sass-3.2.18 lib/sass/scss/static_parser.rb
sass-3.2.17 lib/sass/scss/static_parser.rb
sass-3.2.16 lib/sass/scss/static_parser.rb
sass-3.2.15 lib/sass/scss/static_parser.rb
sass-3.2.14 lib/sass/scss/static_parser.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/sass-3.2.13/lib/sass/scss/static_parser.rb