Class Sass::SCSS::Parser
In: lib/sass/scss/parser.rb
Parent: Object

The parser for SCSS. It parses a string of code into a tree of {Sass::Tree::Node}s.

Methods

Included Modules

Sass::SCSS::RX

Constants

DIRECTIVES = Set[:mixin, :include, :debug, :warn, :for, :while, :if, :else, :extend, :import, :media, :charset]
EXPR_NAMES = { :media_query => "media query (e.g. print, screen, print and screen)", :media_expr => "media expression (e.g. (min-device-width: 800px)))", :pseudo_expr => "expression (e.g. fr, 2n+1)", :interp_ident => "identifier", :interp_name => "identifier", :expr => "expression (e.g. 1px, bold)", :selector_comma_sequence => "selector", :simple_selector_sequence => "selector", :import_arg => "file to import (string or url())", }
TOK_NAMES = Haml::Util.to_hash( Sass::SCSS::RX.constants.map {|c| [Sass::SCSS::RX.const_get(c), c.downcase]}). merge(IDENT => "identifier", /[;}]/ => '";"')

Public Class methods

@param str [String, StringScanner] The source document to parse.

  Note that `Parser` *won't* raise a nice error message if this isn't properly parsed;
  for that, you should use the higher-level {Sass::Engine} or {Sass::CSS}.

@param line [Fixnum] The line on which the source string appeared,

  if it's part of another document

Public Instance methods

Parses an SCSS document.

@return [Sass::Tree::RootNode] The root node of the document tree @raise [Sass::SyntaxError] if there‘s a syntax error in the document

Parses an identifier with interpolation. Note that this won‘t assert that the identifier takes up the entire input string; it‘s meant to be used with `StringScanner`s as part of other parsers.

@return [Array<String, Sass::Script::Node>, nil]

  The interpolated identifier, or nil if none could be parsed

[Validate]