diff --git a/spec/match-capturing-group.spec.js b/spec/match-capturing-group.spec.js index 5c31de1..90a0101 100644 --- a/spec/match-capturing-group.spec.js +++ b/spec/match-capturing-group.spec.js @@ -6,17 +6,16 @@ beforeEach(() => { }); // TODO: Add me +// describe('CapturingGroup', () => { +// describe('named', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); -describe('CapturingGroup', () => { - describe('named', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); - - describe('numbered', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); -}); +// describe('numbered', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); +// }); diff --git a/spec/match-char-class-intersection.spec.js b/spec/match-char-class-intersection.spec.js index 9ceedfe..5e432a8 100644 --- a/spec/match-char-class-intersection.spec.js +++ b/spec/match-char-class-intersection.spec.js @@ -6,10 +6,8 @@ beforeEach(() => { }); // TODO: Add me -// TODO: Test that it throws for target ES2018 - -describe('CharacterClassIntersection', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); -}); +// describe('CharacterClassIntersection', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); diff --git a/spec/match-char-class.spec.js b/spec/match-char-class.spec.js index 95d237a..7c0cac7 100644 --- a/spec/match-char-class.spec.js +++ b/spec/match-char-class.spec.js @@ -6,7 +6,7 @@ beforeEach(() => { }); describe('CharacterClass', () => { - // TODO: Move to `match-char.spec.js`? + // TODO: Move and mix into `match-char.spec.js`? describe('Character', () => { describe('escape', () => { it('should match supported letter escapes', () => { diff --git a/spec/match-directive.spec.js b/spec/match-directive.spec.js index da5efa2..d66bc8b 100644 --- a/spec/match-directive.spec.js +++ b/spec/match-directive.spec.js @@ -6,17 +6,16 @@ beforeEach(() => { }); // TODO: Add me +// describe('Directive', () => { +// describe('flags', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); -describe('Directive', () => { - describe('flags', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); - - describe('keep', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); -}); +// describe('keep', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); +// }); diff --git a/spec/match-flags.spec.js b/spec/match-flags.spec.js index 85982ad..e7aa7d4 100644 --- a/spec/match-flags.spec.js +++ b/spec/match-flags.spec.js @@ -6,9 +6,8 @@ beforeEach(() => { }); // TODO: Add me - -describe('Flags', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); -}); +// describe('Flags', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); diff --git a/spec/match-group.spec.js b/spec/match-group.spec.js index d1d6529..1f7d24f 100644 --- a/spec/match-group.spec.js +++ b/spec/match-group.spec.js @@ -6,23 +6,22 @@ beforeEach(() => { }); // TODO: Add me +// describe('Group', () => { +// describe('atomic', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); -describe('Group', () => { - describe('atomic', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); +// describe('flags', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); - describe('flags', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); - - describe('noncapturing', () => { - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); -}); +// describe('noncapturing', () => { +// it('should', () => { +// expect('').toExactlyMatch(r``); +// }); +// }); +// }); diff --git a/spec/match-quantifier.spec.js b/spec/match-quantifier.spec.js index d04acf6..20c3926 100644 --- a/spec/match-quantifier.spec.js +++ b/spec/match-quantifier.spec.js @@ -7,26 +7,26 @@ beforeEach(() => { }); describe('Quantifier', () => { - describe('greedy', () => { - // TODO: Add me - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); + // TODO: Add me + // describe('greedy', () => { + // it('should', () => { + // expect('').toExactlyMatch(r``); + // }); + // }); - describe('lazy', () => { - // TODO: Add me - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); + // TODO: Add me + // describe('lazy', () => { + // it('should', () => { + // expect('').toExactlyMatch(r``); + // }); + // }); - describe('possessive', () => { - // TODO: Add me - it('should', () => { - expect('').toExactlyMatch(r``); - }); - }); + // TODO: Add me + // describe('possessive', () => { + // it('should', () => { + // expect('').toExactlyMatch(r``); + // }); + // }); describe('quantifiability', () => { it('should throw at start of pattern, group, or alternative', () => { @@ -56,6 +56,7 @@ describe('Quantifier', () => { expect(() => toDetails(r`\K+`)).toThrow(); expect(() => toDetails(r`(?i)+`)).toThrow(); expect(() => toDetails(r`(?-i)+`)).toThrow(); + expect(() => toDetails(r`(?i-m)+`)).toThrow(); }); }); }); diff --git a/src/tokenize.js b/src/tokenize.js index b396edb..822ae67 100644 --- a/src/tokenize.js +++ b/src/tokenize.js @@ -66,8 +66,8 @@ const hexCharPattern = r`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`; const escapedNumPattern = r`\d{1,3}`; const charClassOpenPattern = r`\[\^?\]?`; // Even with flag x, Onig doesn't allow whitespace to separate a quantifier from the `?` or `+` -// that makes it lazy or possessive -const quantifierRe = /[?*+][?+]?|\{\d+(?:,\d*)?\}\??/; +// that makes it lazy or possessive. Possessive suffixes don't apply to interval quantifiers +const quantifierRe = /[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/; const tokenRe = new RegExp(r` \\ (?: ${controlCharPattern} @@ -596,7 +596,7 @@ function createTokenForFlagMod(raw, context) { function createTokenForQuantifier(raw) { const data = {}; if (raw[0] === '{') { - const {min, max} = /^\{(?\d+)(?:,(?\d*))?/.exec(raw).groups; + const {min, max} = /^\{(?\d*)(?:,(?\d*))?/.exec(raw).groups; const limit = 100_000; if (+min > limit || +max > limit) { throw new Error('Quantifier value unsupported in Oniguruma');