def consume_rules(flags = {})
      rules = []

      while token = @tokens.consume
        case token[:node]
          # Non-standard. Spec says to discard comments and whitespace, but we
          # keep them so we can serialize faithfully.
        when :comment, :whitespace
          rules << token

        when :cdc, :cdo
          unless flags[:top_level]
            @tokens.reconsume
            rule = consume_qualified_rule
            rules << rule if rule
          end

        when :at_keyword
          @tokens.reconsume
          rule = consume_at_rule
          rules << rule if rule

        else
          @tokens.reconsume
          rule = consume_qualified_rule
          rules << rule if rule
        end
      end

      rules
    end
def consume_rules(flags = {})
      rules = []

      while token = @tokens.consume
        case token[:node]
          # Non-standard. Spec says to discard comments and whitespace, but we
          # keep them so we can serialize faithfully.
        when :comment, :whitespace
          rules << token

        when :cdc, :cdo
          unless flags[:top_level]
            @tokens.reconsume
            rule = consume_qualified_rule
            rules << rule if rule
          end

        when :at_keyword
          @tokens.reconsume
          rule = consume_at_rule
          rules << rule if rule

        else
          @tokens.reconsume
          rule = consume_qualified_rule
          rules << rule if rule
        end
      end

      rules
    end
Consumes a list of rules and returns them.

 5.4.1. http://dev.w3.org/csswg/css-syntax/#consume-a-list-of-rules