// Copyright 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: > Named groups in Unicode RegExps have some syntax errors and some compatibility escape fallback behavior. esid: prod-GroupSpecifier features: [regexp-named-groups] includes: [compareArray.js] ---*/ assert.throws(SyntaxError, () => eval("/(?<>a)/")); assert.throws(SyntaxError, () => eval("/(? eval("/(?<42a>a)/")); assert.throws(SyntaxError, () => eval("/(?<:a>a)/")); assert.throws(SyntaxError, () => eval("/(?a)/")); assert.throws(SyntaxError, () => eval("/(?a)(?a)/")); assert.throws(SyntaxError, () => eval("/(?a)(?b)(?a)/")); assert.throws(SyntaxError, () => eval("/(?.)\\k/")); assert.throws(SyntaxError, () => eval("/(?.)\\k eval("/(?.)\\k<>/")); assert.throws(SyntaxError, () => eval("/(?.)\\k/")); assert.throws(SyntaxError, () => eval("/(?a)\\k/")); assert.throws(SyntaxError, () => eval("/(?a)\\k/")); assert.throws(SyntaxError, () => eval("/\\k(?a)/")); assert.throws(SyntaxError, () => eval("/\\ka)/")); // A couple of corner cases around '\k' as named back-references vs. identity // escapes. assert(/\k(?x)/.test("x")); assert.throws(SyntaxError, () => eval("/\\k(?x)/")); assert.throws(SyntaxError, () => eval("/\\k.)/")); assert.throws(SyntaxError, () => eval("/\\k(?.)/"));