cucumber-expressions
Advanced tools
Comparing version 5.0.12 to 5.0.13
@@ -25,7 +25,3 @@ 'use strict'; | ||
this._re.source.split('').forEach(function (c, n) { | ||
if (escaping && isRegexpChar(c)) { | ||
escaping = false; | ||
} else if (c === '\\') { | ||
escaping = true; | ||
} else if (c === '(' && !escaping) { | ||
if (c === '(' && !escaping) { | ||
stack.push(new GroupBuilder()); | ||
@@ -50,2 +46,3 @@ groupStartStack.push(n + 1); | ||
} | ||
escaping = c === '\\' && !escaping; | ||
last = c; | ||
@@ -82,7 +79,2 @@ }); | ||
var REGEXP_CHARS = ['#', '$', '(', ')', '*', '+', '.', '/', '?', '[', '\\', '^', '{', '|']; | ||
function isRegexpChar(c) { | ||
return REGEXP_CHARS.indexOf(c) !== -1; | ||
} | ||
module.exports = TreeRegexp; |
{ | ||
"name": "cucumber-expressions", | ||
"version": "5.0.12", | ||
"version": "5.0.13", | ||
"description": "Cucumber Expressions - a simpler alternative to Regular Expressions", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -15,7 +15,3 @@ const Regex = require('becke-ch--regex--s0-0-v1--base--pl--lib') | ||
this._re.source.split('').forEach((c, n) => { | ||
if (escaping && isRegexpChar(c)) { | ||
escaping = false | ||
} else if (c === '\\') { | ||
escaping = true | ||
} else if (c === '(' && !escaping) { | ||
if (c === '(' && !escaping) { | ||
stack.push(new GroupBuilder()) | ||
@@ -40,2 +36,3 @@ groupStartStack.push(n + 1) | ||
} | ||
escaping = c === '\\' && !escaping | ||
last = c | ||
@@ -63,22 +60,2 @@ }) | ||
const REGEXP_CHARS = [ | ||
'#', | ||
'$', | ||
'(', | ||
')', | ||
'*', | ||
'+', | ||
'.', | ||
'/', | ||
'?', | ||
'[', | ||
'\\', | ||
'^', | ||
'{', | ||
'|', | ||
] | ||
function isRegexpChar(c) { | ||
return REGEXP_CHARS.indexOf(c) !== -1 | ||
} | ||
module.exports = TreeRegexp |
@@ -73,2 +73,8 @@ /* eslint-env mocha */ | ||
it('works with digit and word', () => { | ||
const tr = new TreeRegexp(/^(\d) (\w+)$/) | ||
const group = tr.match('2 you') | ||
assert.equal(group.children.length, 2) | ||
}) | ||
it('captures non capturing groups with capturing groups inside', () => { | ||
@@ -75,0 +81,0 @@ const tr = new TreeRegexp('the stdout(?: from "(.*?)")?') |
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
204077
2581