regjsparser
Advanced tools
Comparing version 0.8.2 to 0.8.3
{ | ||
"name": "regjsparser", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"author": "'Julian Viereck' <julian.viereck@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "BSD-2-Clause", |
@@ -301,3 +301,3 @@ // regjsparser | ||
var first = _char.charCodeAt(0); | ||
if (hasUnicodeFlag) { | ||
if (isUnicodeMode) { | ||
var second; | ||
@@ -577,3 +577,3 @@ if (_char.length === 1 && first >= 0xD800 && first <= 0xDBFF) { | ||
// ExtendedPatternCharacter | ||
if (!hasUnicodeFlag && (res = matchReg(/^{/))) { | ||
if (!isUnicodeMode && (res = matchReg(/^{/))) { | ||
atom = createCharacter(res); | ||
@@ -734,3 +734,3 @@ } else { | ||
} | ||
else if (!hasUnicodeFlag && (res = matchReg(/^(?:]|})/))) { | ||
else if (!isUnicodeMode && (res = matchReg(/^(?:]|})/))) { | ||
// ExtendedPatternCharacter, first part. See parseTerm. | ||
@@ -747,3 +747,3 @@ return createCharacter(res); | ||
if (!res) { | ||
if (!hasUnicodeFlag && lookahead() == 'c') { | ||
if (!isUnicodeMode && lookahead() == 'c') { | ||
// B.1.4 ExtendedAtom | ||
@@ -778,3 +778,3 @@ // \[lookahead = c] | ||
function parseUnicodeSurrogatePairEscape(firstEscape) { | ||
if (hasUnicodeFlag) { | ||
if (isUnicodeMode) { | ||
var first, second; | ||
@@ -832,7 +832,7 @@ if (firstEscape.kind == 'unicodeEscape' && | ||
bail('\\B not possible inside of CharacterClass', '', from); | ||
} else if (!hasUnicodeFlag && (res = matchReg(/^c([0-9])/))) { | ||
} else if (!isUnicodeMode && (res = matchReg(/^c([0-9])/))) { | ||
// B.1.4 | ||
// c ClassControlLetter, ClassControlLetter = DecimalDigit | ||
return createEscaped('controlLetter', res[1] + 16, res[1], 2); | ||
} else if (!hasUnicodeFlag && (res = matchReg(/^c_/))) { | ||
} else if (!isUnicodeMode && (res = matchReg(/^c_/))) { | ||
// B.1.4 | ||
@@ -843,3 +843,3 @@ // c ClassControlLetter, ClassControlLetter = _ | ||
// [+U] - | ||
if (hasUnicodeFlag && match('-')) { | ||
if (isUnicodeMode && match('-')) { | ||
return createEscaped('singleEscape', 0x002d, '\\-'); | ||
@@ -928,3 +928,3 @@ } | ||
function bailOctalEscapeIfUnicode(from, pos) { | ||
if (hasUnicodeFlag || hasUnicodeSetFlag) { | ||
if (isUnicodeMode) { | ||
bail("Invalid decimal escape in unicode mode", null, from, pos); | ||
@@ -939,3 +939,3 @@ } | ||
return createCharacterClassEscape(res[0]); | ||
} else if (features.unicodePropertyEscape && (hasUnicodeFlag || hasUnicodeSetFlag) && (res = matchReg(/^([pP])\{([^\}]+)\}/))) { | ||
} else if (features.unicodePropertyEscape && isUnicodeMode && (res = matchReg(/^([pP])\{([^\}]+)\}/))) { | ||
// https://github.com/jviereck/regjsparser/issues/77 | ||
@@ -970,3 +970,3 @@ return addRaw({ | ||
); | ||
} else if (hasUnicodeFlag && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) { | ||
} else if (isUnicodeMode && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) { | ||
// RegExpUnicodeEscapeSequence (ES6 Unicode code point escape) | ||
@@ -1111,4 +1111,4 @@ return createEscaped('unicodeCodePointEscape', parseInt(res[1], 16), res[1], 4); | ||
if ( | ||
(hasUnicodeFlag && /[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(l)) || | ||
(!hasUnicodeFlag && l !== "c") | ||
(isUnicodeMode && /[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/.test(l)) || | ||
(!isUnicodeMode && l !== "c") | ||
) { | ||
@@ -1186,3 +1186,3 @@ if (l === "k" && features.lookbehind) { | ||
if (!('codePoint' in atom) || !('codePoint' in atomTo)) { | ||
if (!hasUnicodeFlag) { | ||
if (!isUnicodeMode) { | ||
// If not, don't create a range but treat them as | ||
@@ -1380,3 +1380,3 @@ // `atom` `-` `atom` instead. | ||
// \ CharacterClassEscape[+U, +V] | ||
if (res = parseCharacterClassEscape()) { | ||
if (res = parseClassEscape()) { | ||
start = res; | ||
@@ -1528,2 +1528,3 @@ } else if (res = parseClassCharacterEscapedHelper()) { | ||
var hasUnicodeSetFlag = (flags || "").indexOf("v") !== -1; | ||
var isUnicodeMode = hasUnicodeFlag || hasUnicodeSetFlag; | ||
var pos = 0; | ||
@@ -1530,0 +1531,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1586
63172