summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/reflect
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-03-01 19:22:56 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-03-09 14:44:43 +0100
commit9bc17e7779f878f17b97130359940b0d0b30f243 (patch)
tree08cb4d18eb2989929209bdea475f67687ef81f90 /src/compiler/scala/tools/reflect
parent5d54cf9e375d796c59b1dd488c15f88f4bfb14d6 (diff)
downloadscala-9bc17e7779f878f17b97130359940b0d0b30f243.tar.gz
scala-9bc17e7779f878f17b97130359940b0d0b30f243.tar.bz2
scala-9bc17e7779f878f17b97130359940b0d0b30f243.zip
SI-6725 `f` interpolator now supports %n tokens
Currently the `f` interpolator supports format specifiers which specify conversions for formatted arguments. However Java formatting is not limited to argument-related conversions as explained in: http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#detail. Conversions which don't correspond to any arguments are `%` (used to emit verbatim `'%'` characters) and `n` (used to emit platform-specific line separators). Of those only the former is supported, and this patch fixes the oversight.
Diffstat (limited to 'src/compiler/scala/tools/reflect')
-rw-r--r--src/compiler/scala/tools/reflect/MacroImplementations.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/reflect/MacroImplementations.scala b/src/compiler/scala/tools/reflect/MacroImplementations.scala
index 86cd845c54..ae13cc561f 100644
--- a/src/compiler/scala/tools/reflect/MacroImplementations.scala
+++ b/src/compiler/scala/tools/reflect/MacroImplementations.scala
@@ -118,7 +118,8 @@ abstract class MacroImplementations {
if (!strIsEmpty) {
val len = str.length
while (idx < len) {
- if (str(idx) == '%') {
+ def notPercentN = str(idx) != '%' || (idx + 1 < len && str(idx + 1) != 'n')
+ if (str(idx) == '%' && notPercentN) {
bldr append (str substring (start, idx)) append "%%"
start = idx + 1
}