defmacro sigil_D({:<<>>, _, [string]}, []) do
{{:ok, {year, month, day}}, calendar} = parse_with_calendar!(string, :parse_date, "Date")
to_calendar_struct(Date, calendar: calendar, year: year, month: month, day: day)
end
defmacro sigil_r({:<<>>, _meta, [string]}, options) when is_binary(string) do
binary = :elixir_interpolation.unescape_string(string, &Regex.unescape_map/1)
regex = Regex.compile!(binary, :binary.list_to_bin(options))
Macro.escape(regex)
end
defmacro sigil_r({:<<>>, meta, pieces}, options) do
binary = {:<<>>, meta, unescape_tokens(pieces, &Regex.unescape_map/1)}
quote(do: Regex.compile!(unquote(binary), unquote(:binary.list_to_bin(options))))
end