regjsparser
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"name": "regjsparser", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"author": "'Julian Viereck' <julian.viereck@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "BSD-2-Clause", |
@@ -33,2 +33,4 @@ // regjsparser | ||
// ( ? ! Disjunction ) | ||
// ( ? < = Disjunction ) | ||
// ( ? < ! Disjunction ) | ||
// | ||
@@ -79,5 +81,3 @@ // Quantifier :: | ||
// IdentityEscape :: | ||
// SourceCharacter but not IdentifierPart | ||
// <ZWJ> | ||
// <ZWNJ> | ||
// SourceCharacter but not c | ||
// | ||
@@ -636,2 +636,7 @@ // DecimalEscape :: | ||
if (!res) { | ||
if (!hasUnicodeFlag && lookahead() == 'c') { | ||
// B.1.4 ExtendedAtom | ||
// \[lookahead = c] | ||
return createValue('symbol', 92, pos - 1, pos); | ||
} | ||
bail('atomEscape'); | ||
@@ -644,2 +649,5 @@ } | ||
} | ||
else if (features.lookbehind && (res = parseGroup('(?<=', 'lookbehind', '(?<!', 'negativeLookbehind'))) { | ||
return res; | ||
} | ||
else if (features.namedGroups && match("(?<")) { | ||
@@ -712,2 +720,6 @@ var name = parseIdentifier(); | ||
bail('\\B not possible inside of CharacterClass', '', from); | ||
} else if (!hasUnicodeFlag && (res = matchReg(/^c([0-9])/))) { | ||
// B.1.4 | ||
// c ClassControlLetter | ||
return createEscaped('controlLetter', res[1] + 16, res[1], 2); | ||
} | ||
@@ -814,2 +826,3 @@ } | ||
var res; | ||
var from = pos; | ||
if (res = matchReg(/^[fnrtv]/)) { | ||
@@ -833,2 +846,5 @@ // ControlEscape | ||
} else if (res = parseRegExpUnicodeEscapeSequence()) { | ||
if (!res || res.codePoint > 0x10FFFF) { | ||
bail('Invalid escape sequence', null, from, pos); | ||
} | ||
return res; | ||
@@ -853,5 +869,4 @@ } else if (features.unicodePropertyEscape && hasUnicodeFlag && (res = matchReg(/^([pP])\{([^\}]+)\}/))) { | ||
var from = pos; | ||
if (!check(ch.charCodeAt(0))) return; | ||
incr(); | ||
if (ch === '\\') { | ||
incr(); | ||
var esc = parseRegExpUnicodeEscapeSequence(); | ||
@@ -863,2 +878,4 @@ if (!esc || !check(esc.codePoint)) { | ||
} | ||
if (!check(ch.charCodeAt(0))) return; | ||
incr(); | ||
return ch; | ||
@@ -896,3 +913,3 @@ } | ||
} | ||
return addRaw({ | ||
@@ -912,4 +929,2 @@ type: 'identifier', | ||
(ch >= 97 && ch <= 122) || // a..z | ||
(ch >= 48 && ch <= 57) || // 0..9 | ||
(ch === 92) || // \ (backslash) | ||
((ch >= 0x80) && NonAsciiIdentifierStart.test(String.fromCharCode(ch))); | ||
@@ -924,2 +939,3 @@ } | ||
return isIdentifierStart(ch) || | ||
(ch >= 48 && ch <= 57) || // 0..9 | ||
((ch >= 0x80) && NonAsciiIdentifierPartOnly.test(String.fromCharCode(ch))); | ||
@@ -930,12 +946,7 @@ } | ||
// IdentityEscape :: | ||
// SourceCharacter but not IdentifierPart | ||
// <ZWJ> | ||
// <ZWNJ> | ||
// SourceCharacter but not c | ||
var ZWJ = '\u200C'; | ||
var ZWNJ = '\u200D'; | ||
var tmp; | ||
if (!isIdentifierPart(lookahead())) { | ||
if (lookahead() !== 'c') { | ||
tmp = incr(); | ||
@@ -945,10 +956,2 @@ return createEscaped('identifier', tmp.charCodeAt(0), tmp, 1); | ||
if (match(ZWJ)) { | ||
// <ZWJ> | ||
return createEscaped('identifier', 0x200C, ZWJ); | ||
} else if (match(ZWNJ)) { | ||
// <ZWNJ> | ||
return createEscaped('identifier', 0x200D, ZWNJ); | ||
} | ||
return null; | ||
@@ -955,0 +958,0 @@ } |
@@ -20,3 +20,3 @@ # RegJSParser | ||
// Toggle on/off additional features: | ||
var parseTree = parse('^a', { | ||
var parseTree = parse('^a', '', { | ||
// SEE: https://github.com/jviereck/regjsparser/pull/78 | ||
@@ -26,3 +26,6 @@ unicodePropertyEscape: true, | ||
// SEE: https://github.com/jviereck/regjsparser/pull/83 | ||
namedGroups: true | ||
namedGroups: true, | ||
// SEE: https://github.com/jviereck/regjsparser/pull/89 | ||
lookbehind: true | ||
}); | ||
@@ -29,0 +32,0 @@ console.log(parseTree); |
Sorry, the diff of this file is not supported yet
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
43586
1050
48