|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Behavior of escape processing under string interpolation can
be confusing. This commit improves the exception message so
you know at least what sort of escapes are handled.
This came up on SO in the form `s"\d".r`, where it may not
be obvious what is throwing and how to work around it.
```
scala> s"\d".r
scala.StringContext$InvalidEscapeException: invalid escape '\d' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 0 in "\d". Use \\ for literal \.
scala> s"a\"
scala.StringContext$InvalidEscapeException: invalid escape at terminal index 1 in "a\". Use \\ for literal \.
```
Referencing SI-6476 because that has become the magnet ticket
for "escape processing under string interpolation, huh?"
This doesn't address `$"` and doesn't handle the more interesting
parse error `s"a\"b"`.
|