crystal
crystal copied to clipboard
Unable to use `"` or `'` characters in slash-delimited RegexLiteral after nesting two levels of macros
trafficstars
Bug Report
In the following example the " causes compilation to fail
{% begin %}
\{% begin %}
\\{% begin %}
\\{% puts "hi\"".gsub(/"/, "").downcase %}
\\{% end %}
\{% end %}
{% end %}
with a
In test.cr:6:6
6 | \{% end %}
^
Error: unknown token: '{'
This doesn't happen on earlier nest levels, and is also able to compile successfully when the double quote is replaced with any other character.
The same issue occurs with ' character
Occurs on 1.16.0 and a compiler built off master.
The compiler is able to parse correctly when you use a %r though or interestingly enough when that character occurs within the slash delimited regex pattern like /%r(")/