### Home Classes Methods

### In Files

- lib/sass/scss/rx.rb

### Methods

- ::escape_char
- ::escape_ident
- ::quote

### Class/Module Index

Quicksearch

- Sass
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Generic
- Sass::Exec::Sass
- Sass::Exec::SassConvert
- Sass::Exec::Scss
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::ArgList
- Sass::Script::Bool
- Sass::Script::Color
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Interpolation
- Sass::Script::Lexer
- Sass::Script::List
- Sass::Script::Literal
- Sass::Script::Node
- Sass::Script::Null
- Sass::Script::Number
- Sass::Script::Operation
- Sass::Script::Parser
- Sass::Script::String
- Sass::Script::StringInterpolation
- Sass::Script::UnaryOperation
- Sass::Script::Variable
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Interpolation
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::SelectorPseudoClass
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::Shared
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::MultibyteStringScanner
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object

No matching classes.

# Sass::SCSS::RX

A module containing regular expressions used for lexing tokens in an SCSS document. Most of these are taken from [the CSS3 spec](www.w3.org/TR/css3-syntax/#lexical), although some have been modified for various reasons.

### Constants

ANY
CDC
CDO
COMMENT
DASHMATCH
DEFAULT
DOMAIN
ESCAPE
FUNCTION
GREATER
H
HASH
HEXCOLOR

  Custom

IDENT
IDENT_HYPHEN_INTERP
IMPORTANT
INCLUDES
INTERP_START
NAME
NL
NMCHAR
NMSTART
NONASCII
NOT
NUM
NUMBER
OPTIONAL
PLUS

  Defined in www.w3.org/TR/css3-selectors/#lex

PREFIXMATCH
RANGE

  This is more liberal than the spec's definition, but that definition didn't work well with the greediness rules

S
SINGLE_LINE_COMMENT
STATIC_COMPONENT
STATIC_SELECTOR
STATIC_VALUE
STRING
STRING1
STRING1_NOINTERP
STRING2
STRING2_NOINTERP
STRING_NOINTERP
SUBSTRINGMATCH
SUFFIXMATCH
TILDE
UNICODE
UNICODERANGE
URI
URL
URLCHAR
URL_PREFIX

  Defined in developer.mozilla.org/en/CSS/@-moz-document as a non-standard version of www.w3.org/TR/css3-conditional/

VARIABLE
W

### Public Class Methods

escape_char(c) click to toggle source

Escapes a single character for a CSS identifier.

@param c [String] The character to escape. Should have length 1 @return [String] The escaped character @private

    # File lib/sass/scss/rx.rb, line 33
    def self.escape_char(c)
      return "\\%06x" % Sass::Util.ord(c) unless c =~ /[ -\/:-~]/
      return "\\#{c}"
    end

escape_ident(str) click to toggle source

Takes a string and returns a CSS identifier that will have the value of the given string.

@param str [String] The string to escape @return [String] The escaped string

    # File lib/sass/scss/rx.rb, line 13
    def self.escape_ident(str)
      return "" if str.empty?
      return "\\#{str}" if str == '-' || str == '_'
      out = ""
      value = str.dup
      out << value.slice!(0...1) if value =~ /^[-_]/
      if value[0...1] =~ NMSTART
        out << value.slice!(0...1)
      else
        out << escape_char(value.slice!(0...1))
      end
      out << value.gsub(/[^a-zA-Z0-9_-]/) {|c| escape_char c}
      return out
    end

quote(str, flags = 0) click to toggle source

Creates a Regexp from a plain text string, escaping all significant characters.

@param str [String] The text of the regexp @param flags [Fixnum] Flags for the created regular expression @return [Regexp] @private

    # File lib/sass/scss/rx.rb, line 45
    def self.quote(str, flags = 0)
      Regexp.new(Regexp.quote(str), flags)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.