Поддержка экранирования символов \n \r
This commit is contained in:
parent
5cb777a80b
commit
a426a6dc2c
@ -178,8 +178,8 @@ public final class Lexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tokenizeText(char ch) {
|
private void tokenizeText(char ch) {
|
||||||
|
final int len = buffer.length();
|
||||||
if (ch == textStartChar) {
|
if (ch == textStartChar) {
|
||||||
final int len = buffer.length();
|
|
||||||
// Добавляем токен, если не было экранирования символа кавычки.
|
// Добавляем токен, если не было экранирования символа кавычки.
|
||||||
if (len == 0 ||
|
if (len == 0 ||
|
||||||
( (len > 0) && (buffer.charAt(len - 1) != '\\') )) {
|
( (len > 0) && (buffer.charAt(len - 1) != '\\') )) {
|
||||||
@ -192,6 +192,13 @@ public final class Lexer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Экранирование символов
|
||||||
|
if ( (len > 0) && (buffer.charAt(len - 1) == '\\') ) {
|
||||||
|
switch (ch) {
|
||||||
|
case 'n': buffer.setCharAt(len - 1, '\n'); return;
|
||||||
|
case 't': buffer.setCharAt(len - 1, '\t'); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
buffer.append(ch);
|
buffer.append(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user