PageRenderTime 26ms CodeModel.GetById 8ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/scalate-jruby/src/main/resources/haml-3.0.25/lib/sass/scss/static_parser.rb

http://github.com/scalate/scalate
Ruby | 40 lines | 25 code | 3 blank | 12 comment | 0 complexity | 6b5ebee7db164d08e0f2ac453db94bbb MD5 | raw file
 1module Sass
 2  module SCSS
 3    # A parser for a static SCSS tree.
 4    # Parses with SCSS extensions, like nested rules and parent selectors,
 5    # but without dynamic SassScript.
 6    # This is useful for e.g. \{#parse\_selector parsing selectors}
 7    # after resolving the interpolation.
 8    class StaticParser < Parser
 9      # Parses the text as a selector.
10      #
11      # @param filename [String, nil] The file in which the selector appears,
12      #   or nil if there is no such file.
13      #   Used for error reporting.
14      # @return [Selector::CommaSequence] The parsed selector
15      # @raise [Sass::SyntaxError] if there's a syntax error in the selector
16      def parse_selector(filename)
17        init_scanner!
18        seq = expr!(:selector_comma_sequence)
19        expected("selector") unless @scanner.eos?
20        seq.line = @line
21        seq.filename = filename
22        seq
23      end
24
25      private
26
27      def variable; nil; end
28      def script_value; nil; end
29      def interpolation; nil; end
30      def interp_string; s = tok(STRING) and [s]; end
31      def interp_ident(ident = IDENT); s = tok(ident) and [s]; end
32      def use_css_import?; true; end
33
34      def special_directive(name)
35        return unless  %w[media import charset].include?(name)
36        super
37      end
38    end
39  end
40end