class Haml::Parser

def parse_new_attribute(scanner)

def parse_new_attribute(scanner)
  unless name = scanner.scan(/[-:\w]+/)
    return if scanner.scan(/\)/)
    return false
  end
  scanner.scan(/\s*/)
  return name, [:static, true] unless scanner.scan(/=/) #/end
  scanner.scan(/\s*/)
  unless quote = scanner.scan(/["']/)
    return false unless var = scanner.scan(/(@@?|\$)?\w+/)
    return name, [:dynamic, var]
  end
  re = /((?:\\.|\#(?!\{)|[^#{quote}\\#])*)(#{quote}|#\{)/
  content = []
  loop do
    return false unless scanner.scan(re)
    content << [:str, scanner[1].gsub(/\\(.)/, '\1')]
    break if scanner[2] == quote
    content << [:ruby, balance(scanner, ?{, ?}, 1).first[0...-1]]
  end
  return name, [:static, content.first[1]] if content.size == 1
  return name, [:dynamic,
    %!"#{content.each_with_object('') {|(t, v), s| s << (t == :str ? inspect_obj(v)[1...-1] : "\#{#{v}}")}}"!]
end