class Sass::SCSS::StaticParser
after resolving the interpolation.
This is useful for e.g. {#parse_selector parsing selectors}
but without dynamic SassScript.
Parses with SCSS extensions, like nested rules and parent selectors,
A parser for a static SCSS tree.
def interp_ident(ident = IDENT); s = tok(ident) and [s]; end
def interp_ident(ident = IDENT); s = tok(ident) and [s]; end
def interp_string; s = tok(STRING) and [s]; end
def interp_string; s = tok(STRING) and [s]; end
def interpolation; nil; end
def interpolation; nil; end
def parse_selector(filename)
-
(Sass::SyntaxError)
- if there's a syntax error in the selector
Returns:
-
(Selector::CommaSequence)
- The parsed selector
Parameters:
-
filename
(String, nil
) -- The file in which the selector appears, -
line
(Fixnum
) -- The line on which the selector appears.
def parse_selector(filename) init_scanner! selectors = [expr!(:_selector)] while tok(/,/) ws = str{ss} selectors << expr!(:_selector) selectors[-1] = Selector::Sequence.new(["\n"] + selectors.last.members) if ws.include?("\n") end expected("selector") unless @scanner.eos? seq = Selector::CommaSequence.new(selectors) seq.line = @line seq.filename = filename seq end
def script_value; nil; end
def script_value; nil; end
def special_directive(name)
def special_directive(name) return unless name == 'media' || name == 'import' super end
def use_css_import?; true; end
def use_css_import?; true; end
def variable; nil; end
def variable; nil; end