(message: string, isInPlural = false)
| 98 | } |
| 99 | |
| 100 | function printEscapedMessage(message: string, isInPlural = false): string { |
| 101 | let result = '' |
| 102 | let literalStart = 0 |
| 103 | |
| 104 | function quoteToken(start: number, end: number) { |
| 105 | result += message.slice(literalStart, start) |
| 106 | result += quoteSyntaxToken(message.slice(start, end)) |
| 107 | literalStart = end |
| 108 | } |
| 109 | |
| 110 | for (let i = 0; i < message.length; i++) { |
| 111 | const ch = message[i] |
| 112 | if (ch === '{') { |
| 113 | const end = findBraceSyntaxEnd(message, i) |
| 114 | quoteToken(i, end) |
| 115 | i = end - 1 |
| 116 | } else if (ch === '}') { |
| 117 | quoteToken(i, i + 1) |
| 118 | } else if (isTagSyntaxStart(message, i)) { |
| 119 | const end = findTagSyntaxEnd(message, i) |
| 120 | quoteToken(i, end) |
| 121 | i = end - 1 |
| 122 | } else if (isInPlural && ch === '#') { |
| 123 | quoteToken(i, i + 1) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | return result + message.slice(literalStart) |
| 128 | } |
| 129 | |
| 130 | function printLiteralElement( |
| 131 | {value}: LiteralElement, |
no test coverage detected