Class/Module Index [+]

Quicksearch

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 Class Methods

new(str, filename, importer, line = 1, offset = 1, allow_parent_ref = true) click to toggle source

@see Parser#initialize @param allow_parent_ref [Boolean] Whether to allow the

parent-reference selector, `&`, when parsing the document.

@comment

rubocop:disable ParameterLists
# File lib/sass/scss/static_parser.rb, line 56
def initialize(str, filename, importer, line = 1, offset = 1, allow_parent_ref = true)
  # rubocop:enable ParameterLists
  super(str, filename, importer, line, offset)
  @allow_parent_ref = allow_parent_ref
end

Public Instance Methods

parse_keyframes_selector() click to toggle source
# File lib/sass/scss/static_parser.rb, line 44
def parse_keyframes_selector
  init_scanner!
  sel = expr!(:keyframes_selector)
  expected("keyframes selector") unless @scanner.eos?
  sel
end
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
parse_static_at_root_query() click to toggle source

Parses a static at-root query.

@return [(Symbol, Array<String>)] The type of the query

(`:with` or `:without`) and the values that are being filtered.

@raise [Sass::SyntaxError] if there's a syntax error in the query,

or if it doesn't take up the entire input string.
# File lib/sass/scss/static_parser.rb, line 33
def parse_static_at_root_query
  init_scanner!
  tok!(/\(/); ss
  type = tok!(/\b(without|with)\b/).to_sym; ss
  tok!(/:/); ss
  directives = expr!(:at_root_directive_list); ss
  tok!(/\)/)
  expected("@at-root query list") unless @scanner.eos?
  return type, directives
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.