class Crass::Parser

def consume_function(input = @tokens)

5.4.8. http://dev.w3.org/csswg/css-syntax-3/#consume-a-function

Consumes a function and returns it.
def consume_function(input = @tokens)
  function = {
    :name   => input.current[:value],
    :value  => [],
    :tokens => [input.current] # Non-standard, used for serialization.
  }
  function[:tokens].concat(input.collect {
    while token = input.consume
      case token[:node]
      when :')'
        break
      # Non-standard.
      when :comment
        next
      else
        input.reconsume
        function[:value] << consume_component_value(input)
      end
    end
  })
  create_node(:function, function)
end