class Sass::SCSS::StaticParser

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.

Public Instance Methods

parse_selector() click to toggle source

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

# File lib/sass/scss/static_parser.rb, line 18
def parse_selector
  init_scanner!
  seq = expr!(:selector_comma_sequence)
  expected("selector") unless @scanner.eos?
  seq.line = @line
  seq.filename = @filename
  seq
end

Private Instance Methods

interp_ident(ident = IDENT) click to toggle source
# File lib/sass/scss/static_parser.rb, line 42
def interp_ident(ident = IDENT); s = tok(ident) and [s]; end
interp_string() click to toggle source
# File lib/sass/scss/static_parser.rb, line 40
def interp_string; s = tok(STRING) and [s]; end
interp_uri() click to toggle source
# File lib/sass/scss/static_parser.rb, line 41
def interp_uri; s = tok(URI) and [s]; end
interpolation() click to toggle source
# File lib/sass/scss/static_parser.rb, line 38
def interpolation; nil; end
moz_document_function() click to toggle source
# File lib/sass/scss/static_parser.rb, line 29
def moz_document_function
  return unless val = tok(URI) || tok(URL_PREFIX) || tok(DOMAIN) ||
    function(!:allow_var)
  ss
  [val]
end
script_value() click to toggle source
# File lib/sass/scss/static_parser.rb, line 37
def script_value; nil; end
special_directive(name) click to toggle source
Calls superclass method Sass::SCSS::Parser#special_directive
# File lib/sass/scss/static_parser.rb, line 45
def special_directive(name)
  return unless %w[media import charset -moz-document].include?(name)
  super
end
use_css_import?() click to toggle source
# File lib/sass/scss/static_parser.rb, line 43
def use_css_import?; true; end
var_expr() click to toggle source
# File lib/sass/scss/static_parser.rb, line 39
def var_expr; nil; end
variable() click to toggle source
# File lib/sass/scss/static_parser.rb, line 36
def variable; nil; end