def read_attribute_list(src, con, break_on_chars)
separators = break_on_chars + [?=,?\ ,?\t]
escaped = Maruku::EscapedCharInQuotes
al = AttributeList.new
while true
src.consume_whitespace
break if break_on_chars.include? src.cur_char
case src.cur_char
when nil
maruku_error "Attribute list terminated by EOF:\n "+
"#{al.inspect}" , src, con
tell_user "I try to continue and return partial attribute list:\n"+
al.inspect
break
when ?=
maruku_error "In attribute lists, cannot start identifier with `=`."
tell_user "I try to continue"
src.ignore_char
when ?#
src.ignore_char
if id = read_quoted_or_unquoted(src, con, escaped, separators)
al.push_id id
else
maruku_error 'Could not read `id` attribute.', src, con
tell_user 'Trying to ignore bad `id` attribute.'
end
when ?.
src.ignore_char
if klass = read_quoted_or_unquoted(src, con, escaped, separators)
al.push_class klass
else
maruku_error 'Could not read `class` attribute.', src, con
tell_user 'Trying to ignore bad `class` attribute.'
end
else
if key = read_quoted_or_unquoted(src, con, escaped, separators)
if src.cur_char == ?=
src.ignore_char
if val = read_quoted_or_unquoted(src, con, escaped, separators)
al.push_key_val(key, val)
else
maruku_error "Could not read value for key #{key.inspect}.",
src, con
tell_user "Ignoring key #{key.inspect}."
end
else
al.push_ref key
end
else
maruku_error 'Could not read key or reference.'
end
end
end
al
end