Module: Sass::Constant
- Defined in:
- lib/gems/haml-2.0.4/lib/sass/constant.rb,
lib/gems/haml-2.0.4/lib/sass/constant/nil.rb,
lib/gems/haml-2.0.4/lib/sass/constant/color.rb,
lib/gems/haml-2.0.4/lib/sass/constant/number.rb,
lib/gems/haml-2.0.4/lib/sass/constant/string.rb,
lib/gems/haml-2.0.4/lib/sass/constant/literal.rb,
lib/gems/haml-2.0.4/lib/sass/constant/operation.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Color, Literal, Nil, Number, Operation, String
Constant Summary collapse
- CONSTANT_CHAR =
The character that begins a constant.
?!
- WHITESPACE =
Whitespace characters
[?\ , ?\t, ?\n, ?\r]
- ESCAPE_CHAR =
The character used to escape values
?\\
- STRING_CHAR =
The character used to open and close strings
?"
- SYMBOLS =
A mapping of syntactically-significant characters to parsed symbols
{ ?( => :open, ?) => :close, ?+ => :plus, ?- => :minus, ?* => :times, ?/ => :div, ?% => :mod, CONSTANT_CHAR => :const, STRING_CHAR => :str, ESCAPE_CHAR => :esc }
- MATCH =
The regular expression used to parse constants
/^#{Regexp.escape(CONSTANT_CHAR.chr)}([^\s#{(SYMBOLS.keys + [ ?= ]).map {|c| Regexp.escape("#{c.chr}") }.join}]+)\s*((?:\|\|)?=)\s*(.+)/
- FIRST_ORDER =
First-order operations
[:times, :div, :mod]
- SECOND_ORDER =
Second-order operations
[:plus, :minus]
Class Method Summary collapse
Class Method Details
.parse(value, constants, line) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/gems/haml-2.0.4/lib/sass/constant.rb', line 43 def parse(value, constants, line) begin operationalize(parenthesize(tokenize(value)), constants).to_s rescue Sass::SyntaxError => e if e. == "Constant arithmetic error" e.instance_eval do @message += ": #{value.dump}." end end e.sass_line = line raise e end end |