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:
@@ -1185,6 +1185,14 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
|||||||
column--;
|
column--;
|
||||||
}
|
}
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#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)
|
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
|
||||||
{
|
{
|
||||||
/* Newline (without backslash) is part of the string.
|
/* Newline (without backslash) is part of the string.
|
||||||
@@ -1212,19 +1220,13 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
|||||||
column = 1;
|
column = 1;
|
||||||
continue;
|
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) */
|
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||||
else if (*source_p == LIT_CHAR_CR
|
else if (*source_p == LIT_CHAR_CR
|
||||||
|| *source_p == LIT_CHAR_LF
|
#if !ENABLED (JERRY_ESNEXT)
|
||||||
|| (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p)))
|
|| (*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.line = line;
|
||||||
context_p->token.column = column;
|
context_p->token.column = column;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
assert(eval("'\u2028'") === "\u2028");
|
||||||
|
assert(eval("'\u2029'") === "\u2029");
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
try {
|
||||||
|
eval("'\u2028'");
|
||||||
|
assert(false);
|
||||||
|
} catch (e) {
|
||||||
|
assert(e instanceof SyntaxError);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
eval("'\u2029'");
|
||||||
|
assert(false);
|
||||||
|
} catch (e) {
|
||||||
|
assert(e instanceof SyntaxError);
|
||||||
|
}
|
||||||
@@ -320,6 +320,8 @@
|
|||||||
<test id="language/expressions/tagged-template/cache-identical-source.js"><reason></reason></test>
|
<test id="language/expressions/tagged-template/cache-identical-source.js"><reason></reason></test>
|
||||||
<test id="language/expressions/tagged-template/cache-identical-source-new-function.js"><reason></reason></test>
|
<test id="language/expressions/tagged-template/cache-identical-source-new-function.js"><reason></reason></test>
|
||||||
<test id="language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js"><reason></reason></test>
|
<test id="language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js"><reason></reason></test>
|
||||||
|
<test id="language/line-terminators/S7.3_A2.3.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||||
|
<test id="language/line-terminators/S7.3_A2.4.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||||
<test id="language/literals/string/7.8.4-1-s.js"><reason></reason></test>
|
<test id="language/literals/string/7.8.4-1-s.js"><reason></reason></test>
|
||||||
<test id="language/module-code/export-unresolvable.js"><reason></reason></test>
|
<test id="language/module-code/export-unresolvable.js"><reason></reason></test>
|
||||||
<test id="language/statements/class/definition/methods.js"><reason></reason></test>
|
<test id="language/statements/class/definition/methods.js"><reason></reason></test>
|
||||||
|
|||||||
@@ -6979,10 +6979,6 @@
|
|||||||
<test id="language/literals/numeric/numeric-separators/numeric-separator-literal-sign-plus-dds-nsl-dd.js"><reason></reason></test>
|
<test id="language/literals/numeric/numeric-separators/numeric-separator-literal-sign-plus-dds-nsl-dd.js"><reason></reason></test>
|
||||||
<test id="language/literals/regexp/named-groups/forward-reference.js"><reason></reason></test>
|
<test id="language/literals/regexp/named-groups/forward-reference.js"><reason></reason></test>
|
||||||
<test id="language/literals/string/legacy-octal-escape-sequence-prologue-strict.js"><reason></reason></test>
|
<test id="language/literals/string/legacy-octal-escape-sequence-prologue-strict.js"><reason></reason></test>
|
||||||
<test id="language/literals/string/line-separator-eval.js"><reason></reason></test>
|
|
||||||
<test id="language/literals/string/line-separator.js"><reason></reason></test>
|
|
||||||
<test id="language/literals/string/paragraph-separator-eval.js"><reason></reason></test>
|
|
||||||
<test id="language/literals/string/paragraph-separator.js"><reason></reason></test>
|
|
||||||
<test id="language/module-code/early-export-global.js"><reason></reason></test>
|
<test id="language/module-code/early-export-global.js"><reason></reason></test>
|
||||||
<test id="language/module-code/early-export-unresolvable.js"><reason></reason></test>
|
<test id="language/module-code/early-export-unresolvable.js"><reason></reason></test>
|
||||||
<test id="language/module-code/early-strict-mode.js"><reason></reason></test>
|
<test id="language/module-code/early-strict-mode.js"><reason></reason></test>
|
||||||
|
|||||||
Reference in New Issue
Block a user