Skip to content

Clarify which regular expression production rule from the ECMA specification is intended #821

Closed
@Julian

Description

@Julian

Via @leadpony in json-schema-org/JSON-Schema-Test-Suite#309 [the context being "what behavior is expected if one uses \a, i.e. ASCII BEL, within a regular expression]:

There exist 2 regular expression patterns defined in the ECMA-262 specification.

21.2 RegExp (Regular Expression) Objects
B.1.4 Regular Expressions Patterns

Note that the latter pattern is a part of B. Additional ECMAScript Features for Web Browsers.

Both patterns do not allow a as a controll escape letter, but the final consequence seems to slightly differ.
In the latter pattern, \a is converted to a letter a, as Node.js does, because the letter is recognized as a part of IdentifyEscape.
In the former pattern, I believe a syntax error should be thrown, because a has an ID_CONTINUE Unicode property and cannot be handled as an IdentifyEscape.

IdentityEscape::
SourceCharacter but not UnicodeIDContinue

The JSON Schema Specification does not state which pattern should be followed, therefore we cannot make the test without some ambiguity.

We should clarify which behavior is intended, and therefore whether such a string is or is not a valid regex for the test suite.

Metadata

Metadata

Assignees

Labels

Priority: LowclarificationItems that need to be clarified in the specification

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions