in rsc/src/main/scala/rsc/scan/scala/Scanner.scala [548:608]
private def string(): Unit = {
nextChar()
if (ch == '"') {
nextChar()
if (ch == '"') {
nextChar()
val buf = new StringBuilder
while (ch != '\"' || ch1 != '\"' || ch2 != '\"' || ch3 == '\"') {
if (ch == SU) {
val message = reportOffset(offset, UnclosedString)
emit(ERROR, message.str)
return
}
if (ch == '\\') {
nextChar()
ch match {
case '\\' =>
buf += '\\'
buf += '\\'
nextChar()
case 'u' =>
val uoffset = offset
nextChar()
var unicode: Int = 0
var i = 0
while (i < 4) {
if (isHexadecimalDigit(ch)) {
unicode = (unicode << 4) + Integer.parseInt(ch.toString, 16)
} else {
reportOffset(uoffset, IllegalEscape)
}
nextChar()
i += 1
}
buf += unicode.toChar
case other =>
buf += '\\'
}
} else {
buf += ch
nextChar()
}
}
nextChar()
nextChar()
nextChar()
emit(LITSTRING, buf.toString)
} else {
emit(LITSTRING, "")
}
} else {
val result = quote('"')
if (ch == '"') {
nextChar()
emit(LITSTRING, result)
} else {
val message = reportOffset(offset, UnclosedString)
emit(ERROR, message.str)
}
}
}