### Home Classes Methods

### In Files

- lib/sass/scss/rx.rb

### Methods

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

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- 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::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- 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::ReadOnlyEnvironment
- 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::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Script::Value::String
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- 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::Cssize::Bubble
- 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::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

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
DOMAIN
ESCAPE
FUNCTION
GREATER
H
HASH
HEXCOLOR

  Custom

IDENT
IDENT_HYPHEN_INTERP
IDENT_START
IMPORTANT
INCLUDES
INTERP_START
NAME
NL
NMCHAR
NMSTART
NONASCII
NOT
NUM
NUMBER
OPTIONAL
PERCENTAGE
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
UNIT

  A unit is like an IDENT, but disallows a hyphen followed by a digit. This allows “1px-2px” to be interpreted as subtraction rather than “1” with the unit “px-2px”. It also allows “%”.

UNITLESS_NUMBER
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 =~ /[ -\/:-~]/
      "\\#{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}
      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.