Module: CodeRay::Scanners::CSS::RE

Defined in:
lib/coderay/scanners/css.rb

Constant Summary collapse

Hex =
/[0-9a-fA-F]/
Unicode =

differs from standard because it allows uppercase hex too

/\\#{Hex}{1,6}(?:\r\n|\s)?/
Escape =
/#{Unicode}|\\[^\r\n\f0-9a-fA-F]/
NMChar =
/[-_a-zA-Z0-9]|#{Escape}/
NMStart =
/[_a-zA-Z]|#{Escape}/
NL =
/\r\n|\r|\n|\f/
String1 =

FIXME: buggy regexp

/"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"?/
String2 =

FIXME: buggy regexp

/'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'?/
String =
/#{String1}|#{String2}/
HexColor =
/#(?:#{Hex}{6}|#{Hex}{3})/
Color =
/#{HexColor}/
Num =
/-?(?:[0-9]+|[0-9]*\.[0-9]+)/
Name =
/#{NMChar}+/
Ident =
/-?#{NMStart}#{NMChar}*/
AtKeyword =
/@#{Ident}/
Percentage =
/#{Num}%/
Unit =
Regexp.union(*(reldimensions + absdimensions))
Dimension =
/#{Num}#{Unit}/
Comment =
%r! /\* (?: .*? \*/ | .* ) !mx
Function =
/(?:url|alpha)\((?:[^)\n\r\f]|\\\))*\)?/
Id =
/##{Name}/
Class =
/\.#{Name}/
PseudoClass =
/:#{Name}/
AttributeSelector =
/\[[^\]]*\]?/