Module: Sass::Script

Defined in:
lib/sass/script.rb,
lib/sass/script/bool.rb,
lib/sass/script/node.rb,
lib/sass/script/color.rb,
lib/sass/script/lexer.rb,
lib/sass/script/number.rb,
lib/sass/script/parser.rb,
lib/sass/script/string.rb,
lib/sass/script/funcall.rb,
lib/sass/script/literal.rb,
lib/sass/script/variable.rb,
lib/sass/script/css_lexer.rb,
lib/sass/script/functions.rb,
lib/sass/script/operation.rb,
lib/sass/script/css_parser.rb,
lib/sass/script/interpolation.rb,
lib/sass/script/unary_operation.rb,
lib/sass/script/string_interpolation.rb

Overview

SassScript is code that's embedded in Sass documents to allow for property values to be computed from variables.

This module contains code that handles the parsing and evaluation of SassScript.

Defined Under Namespace

Modules: Functions Classes: Bool, Color, CssLexer, CssParser, Funcall, Interpolation, Lexer, Literal, Node, Number, Operation, Parser, String, StringInterpolation, UnaryOperation, Variable

Constant Summary collapse

MATCH =

The regular expression used to parse variables.

/^[!\$](#{Sass::SCSS::RX::IDENT})\s*((?:\|\|)?=|:)\s*(.+?)(!(?i:default))?$/
VALIDATE =

The regular expression used to validate variables without matching.

/^[!\$]#{Sass::SCSS::RX::IDENT}$/

Class Method Summary collapse

Class Method Details

.parse(value, line, offset, options = {}) ⇒ Script::Node

Parses a string of SassScript

Parameters:

  • value (String)

    The SassScript

  • line (Fixnum)

    The number of the line on which the SassScript appeared. Used for error reporting

  • offset (Fixnum)

    The number of characters in on line that the SassScript started. Used for error reporting

  • options ({Symbol => Object}) (defaults to: {})

    An options hash; see the Sass options documentation

Returns:



31
32
33
34
35
36
37
# File 'lib/sass/script.rb', line 31

def self.parse(value, line, offset, options = {})
  Parser.parse(value, line, offset, options)
rescue Sass::SyntaxError => e
  e.message << ": #{value.inspect}." if e.message == "SassScript error"
  e.modify_backtrace(:line => line, :filename => options[:filename])
  raise e
end