Implement JSON superset (#4099)

JSON strings can contain unescaped LINE SEPARATOR and PARAGRAPH SEPARATOR in ES11

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-08-04 16:56:08 +02:00
committed by GitHub
parent 621a5ddb8f
commit 019dd03fcc
5 changed files with 57 additions and 14 deletions
+12 -10
View File
@@ -1185,6 +1185,14 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
column--;
}
#if ENABLED (JERRY_ESNEXT)
else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
{
source_p += 3;
length += 3;
line++;
column = 1;
continue;
}
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
{
/* Newline (without backslash) is part of the string.
@@ -1212,19 +1220,13 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
column = 1;
continue;
}
else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
{
source_p += 3;
length += 3;
line++;
column = 1;
continue;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
else if (*source_p == LIT_CHAR_CR
|| *source_p == LIT_CHAR_LF
|| (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p)))
#if !ENABLED (JERRY_ESNEXT)
|| (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
#endif /* !ENABLED (JERRY_ESNEXT) */
|| *source_p == LIT_CHAR_LF)
{
context_p->token.line = line;
context_p->token.column = column;