# Attempt to parse a link destination, returning the string or null if not match
private fun parse_link_destination: Couple[nullable String, Bool] do
var buffer = new Buffer
var c = peek
var parens = 0
var has_bracket = c == '<'
if has_bracket then advance 1
loop
c = peek
if c == '\0' then
break # end of input
else if c == ' ' or c == '\t' or c == '\n' or c == '\r' then
break # no spaces allowed in urls
else if c == '\\' then
var next = peek_next
if escapable.has(next) then
buffer.add next
advance 2 # skip over the backslash
continue
end
else if has_bracket and c == '>' then
advance 1
break
else if not has_bracket and c == '(' then
parens += 1
else if not has_bracket and c == ')' then
if parens == 0 then break
parens -= 1
else if c == '\0' then
break
end
buffer.add c
advance 1
end
return new Couple[nullable String, Bool](buffer.to_s, has_bracket)
end
lib/markdown2/markdown_inline_parsing.nit:651,2--689,4