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/functions.rb,
lib/sass/script/operation.rb,
lib/sass/script/unary_operation.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, Funcall, Lexer, Literal, Node, Number, Operation, Parser, String, UnaryOperation, Variable
Constant Summary collapse
- VARIABLE_CHAR =
The character that begins a variable.
?!
- MATCH =
The regular expression used to parse variables.
/^!([a-zA-Z_]\w*)\s*((?:\|\|)?=)\s*(.+)/
- VALIDATE =
The regular expression used to validate variables without matching.
/^![a-zA-Z_]\w*$/
Class Method Summary collapse
-
.parse(value, line, offset, filename = nil) ⇒ Script::Node
Parses a string of SassScript.
-
.resolve(value, line, offset, environment) ⇒ String
Parses and evaluates a string of SassScript.
Class Method Details
.parse(value, line, offset, filename = nil) ⇒ Script::Node
Parses a string of SassScript
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/sass/script.rb', line 47 def self.parse(value, line, offset, filename = nil) Parser.parse(value, line, offset, filename) rescue Sass::SyntaxError => e if e. == "SassScript error" e.instance_eval do @message += ": #{value.dump}." end end e.sass_line = line raise e end |
.resolve(value, line, offset, environment) ⇒ String
Parses and evaluates a string of SassScript.
33 34 35 |
# File 'lib/sass/script.rb', line 33 def self.resolve(value, line, offset, environment) parse(value, line, offset).perform(environment).to_s end |