mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix whitespace ranges for ES.next profile (#4110)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
parent
3d44b26aeb
commit
25117ad56b
@ -137,14 +137,20 @@ lit_char_is_white_space (lit_code_point_t c) /**< code point */
|
||||
return (c == LIT_CHAR_SP || (c >= LIT_CHAR_TAB && c <= LIT_CHAR_CR));
|
||||
}
|
||||
|
||||
if (c == LIT_CHAR_NBSP || c == LIT_CHAR_BOM || c == LIT_CHAR_LS || c == LIT_CHAR_PS)
|
||||
if (c == LIT_CHAR_BOM
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
/* Mongolian Vowel Separator (u180e) used to be a whitespace character. */
|
||||
|| c == LIT_CHAR_MVS
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
|| c == LIT_CHAR_LS
|
||||
|| c == LIT_CHAR_PS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return (c <= LIT_UTF16_CODE_UNIT_MAX
|
||||
&& ((c >= lit_unicode_white_space_interval_starts[0]
|
||||
&& c < lit_unicode_white_space_interval_starts[0] + lit_unicode_white_space_interval_lengths[0])
|
||||
&& c <= lit_unicode_white_space_interval_starts[0] + lit_unicode_white_space_interval_lengths[0])
|
||||
|| lit_search_char_in_array ((ecma_char_t) c,
|
||||
lit_unicode_white_space_chars,
|
||||
NUM_OF_ELEMENTS (lit_unicode_white_space_chars))));
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
#define LIT_CHAR_FF ((ecma_char_t) 0x000C) /* form feed */
|
||||
#define LIT_CHAR_SP ((ecma_char_t) 0x0020) /* space */
|
||||
#define LIT_CHAR_NBSP ((ecma_char_t) 0x00A0) /* no-break space */
|
||||
#define LIT_CHAR_MVS ((ecma_char_t) 0x180E) /* mongolian vowel separator */
|
||||
/* LIT_CHAR_BOM is defined above */
|
||||
|
||||
bool lit_char_is_white_space (lit_code_point_t c);
|
||||
|
||||
@ -201,7 +201,6 @@ static const uint16_t lit_unicode_id_continue_chars[] JERRY_ATTR_CONST_DATA =
|
||||
0xaa43, 0xaab0, 0xaac1, 0xfb1e, 0xff3f
|
||||
};
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
/**
|
||||
* Character interval starting points for White_Space.
|
||||
*/
|
||||
@ -225,30 +224,3 @@ static const uint16_t lit_unicode_white_space_chars[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
0x00a0, 0x1680, 0x202f, 0x205f, 0x3000
|
||||
};
|
||||
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
/**
|
||||
* Character interval starting points for White_Space.
|
||||
*/
|
||||
static const uint16_t lit_unicode_white_space_interval_starts[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
0x2000
|
||||
};
|
||||
|
||||
/**
|
||||
* Character interval lengths for White_Space.
|
||||
*/
|
||||
static const uint8_t lit_unicode_white_space_interval_lengths[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
0x000b
|
||||
};
|
||||
|
||||
/**
|
||||
* Non-interval characters for White_Space.
|
||||
*/
|
||||
static const uint16_t lit_unicode_white_space_chars[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
0x1680, 0x180e, 0x202f, 0x205f, 0x3000
|
||||
};
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
@ -87,3 +87,5 @@ assert("\u0009\u000B\u000C\u0020\u00A01\u0009\u000B\u000C\u0020\u00A0".trim() ==
|
||||
assert("\u000A\u000D\u2028\u202911\u000A\u000D\u2028\u2029".trim() === "11");
|
||||
|
||||
assert ("\u200B".trim() === '\u200B')
|
||||
assert ("\u200A".trim() === '')
|
||||
assert ("\u00A0".trim() === '')
|
||||
|
||||
@ -1065,9 +1065,6 @@
|
||||
<test id="built-ins/NativeErrors/SyntaxError/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/NativeErrors/TypeError/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/NativeErrors/URIError/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/S9.3.1_A2.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/S9.3.1_A3_T1.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/S9.3.1_A3_T2.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/bigint-conversion.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/Number/prototype/toExponential/return-values.js"><reason></reason></test>
|
||||
@ -1384,7 +1381,6 @@
|
||||
<test id="built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/character-class-escape-non-whitespace.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/lookBehind/alternations.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/lookBehind/back-references-to-captures.js"><reason></reason></test>
|
||||
<test id="built-ins/RegExp/lookBehind/back-references.js"><reason></reason></test>
|
||||
@ -2029,11 +2025,6 @@
|
||||
<test id="built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/toLowerCase/special_casing_conditional.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/toString/non-generic-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trim/15.5.4.20-3-2.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trim/15.5.4.20-3-3.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trim/15.5.4.20-3-4.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trim/15.5.4.20-3-5.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trim/15.5.4.20-3-6.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trimEnd/length.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trimEnd/name.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/trimEnd/prop-desc.js"><reason></reason></test>
|
||||
@ -3091,8 +3082,6 @@
|
||||
<test id="built-ins/WeakSet/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/global/global-object.js"><reason></reason></test>
|
||||
<test id="built-ins/global/property-descriptor.js"><reason></reason></test>
|
||||
<test id="built-ins/parseFloat/S15.1.2.3_A2_T10.js"><reason></reason></test>
|
||||
<test id="built-ins/parseInt/S15.1.2.2_A2_T10.js"><reason></reason></test>
|
||||
<test id="harness/isConstructor.js"><reason></reason></test>
|
||||
<test id="intl402/BigInt/prototype/toLocaleString/de-DE.js"><reason></reason></test>
|
||||
<test id="intl402/BigInt/prototype/toLocaleString/default-options-object-prototype.js"><reason></reason></test>
|
||||
|
||||
@ -43,11 +43,6 @@ FOLDING_SUP_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-fol
|
||||
UNICODE_PLANE_TYPE_BASIC = 0
|
||||
UNICODE_PLANE_TYPE_SUPPLEMENTARY = 1
|
||||
|
||||
# For ES5.1 profile we use a predefined subset of whitespace characters
|
||||
ES5_1_WHITE_SPACE_UNITS = [0x1680, 0x180e]
|
||||
ES5_1_WHITE_SPACE_UNITS.extend(range(0x2000, 0x200c))
|
||||
ES5_1_WHITE_SPACE_UNITS.extend([0x202f, 0x205f, 0x3000])
|
||||
|
||||
# common code generation
|
||||
|
||||
class UnicodeBasicSource(object):
|
||||
@ -80,11 +75,7 @@ class UnicodeBasicSource(object):
|
||||
self._header.append("") # for an extra empty line
|
||||
|
||||
def add_whitepace_range(self, category, categorizer, units):
|
||||
self._data.append("#if ENABLED (JERRY_ESNEXT)")
|
||||
self.add_range(category, categorizer.create_tables(units))
|
||||
self._data.append("#else /* !ENABLED (JERRY_ESNEXT) */")
|
||||
self.add_range(category, categorizer.create_tables(ES5_1_WHITE_SPACE_UNITS))
|
||||
self._data.append("#endif /* ENABLED (JERRY_ESNEXT) */\n")
|
||||
|
||||
def add_range(self, category, tables):
|
||||
idx = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user