Sha256: cff3483169e8594528e85fca03556d8940e1b7ac0842a7f05f66d605169c206f

Contents?: true

Size: 1.58 KB

Versions: 17

Compression:

Stored size: 1.58 KB

Contents

require 'strscan'
require 'sass/script/node'
require 'sass/script/variable'
require 'sass/script/funcall'
require 'sass/script/operation'
require 'sass/script/literal'
require 'sass/script/parser'

module Sass
  # 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.
  module Script
    # The character that begins a variable.
    # @private
    VARIABLE_CHAR = ?!

    # The regular expression used to parse variables.
    # @private
    MATCH = /^!([a-zA-Z_-][\w-]*)\s*((?:\|\|)?=)\s*(.+)/

    # The regular expression used to validate variables without matching.
    # @private
    VALIDATE = /^![a-zA-Z_-][\w-]*$/

    # Parses a string of SassScript
    #
    # @param value [String] The SassScript
    # @param line [Fixnum] The number of the line on which the SassScript appeared.
    #   Used for error reporting
    # @param offset [Fixnum] The number of characters in on `line` that the SassScript started.
    #   Used for error reporting
    # @param options [{Symbol => Object}] An options hash;
    #   see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
    # @return [Script::Node] The root node of the parse tree
    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
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
haml-edge-2.3.179 lib/sass/script.rb
haml-edge-2.3.178 lib/sass/script.rb
haml-edge-2.3.177 lib/sass/script.rb
haml-edge-2.3.176 lib/sass/script.rb
haml-edge-2.3.175 lib/sass/script.rb
haml-edge-2.3.174 lib/sass/script.rb
haml-edge-2.3.173 lib/sass/script.rb
haml-edge-2.3.172 lib/sass/script.rb
haml-edge-2.3.171 lib/sass/script.rb
haml-edge-2.3.170 lib/sass/script.rb
haml-edge-2.3.169 lib/sass/script.rb
haml-edge-2.3.168 lib/sass/script.rb
haml-edge-2.3.167 lib/sass/script.rb
haml-edge-2.3.166 lib/sass/script.rb
haml-edge-2.3.165 lib/sass/script.rb
haml-edge-2.3.164 lib/sass/script.rb
haml-edge-2.3.163 lib/sass/script.rb