Expand description
Early-error validation of a JavaScript regular-expression pattern.
crate::regexp translates a pattern into fancy-regex syntax and lets that
engine reject what it cannot compile — which accepts patterns JavaScript
refuses (/{/u, /\-/u, a duplicate group name) and words the ones it does
refuse in its own vocabulary. This module is the pattern GRAMMAR of
ECMA-262 22.2.1 (with the Annex B.1.2 relaxations outside unicode mode),
walked once before translation, reporting V8’s wording
(src/regexp/regexp-error.h) for the first early error.
It only ever REJECTS: a pattern it accepts still goes through translate
and the engine, so a gap here costs a worse message, never a wrong match.
v (unicodeSets) class bodies nest and use set operators that this walk
does not model; their brackets are balanced and their contents left to the
engine.
Functions§
- validate
- The first early error in
pat, with V8’s reason text.