class Crass::Tokenizer

def consume_numeric

4.3.3. http://dev.w3.org/csswg/css-syntax/#consume-a-numeric-token

Consumes a numeric token and returns it.
def consume_numeric
  number = consume_number
  repr = number[0]
  value = number[1]
  type = number[2]
  if type == :integer
    value = value.to_i
  else
    value = value.to_f
  end
  if start_identifier?(@s.peek(3))
    create_token(:dimension,
      :repr => repr,
      :type => type,
      :unit => consume_name,
      :value => value)
  elsif @s.peek == '%'
    @s.consume
    create_token(:percentage,
      :repr => repr,
      :type => type,
      :value => value)
  else
    create_token(:number,
      :repr => repr,
      :type => type,
      :value => value)
  end
end