Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #189 fixes regexp failure bug #192

Merged
merged 1 commit into from Jul 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## version 1.6.2 (2017-07-08)

* Fixes another bug with match groups outside the correct range in `Parsimmon.regexp(regexp, group)`.

## version 1.6.1 (2017-07-01)

* **100% unit test coverage!** This does not mean bugs won't exist, but it keeps us much safer against regressions in the future.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "parsimmon",
"version": "1.6.1",
"version": "1.6.2",
"description": "A monadic LL(infinity) parser combinator library",
"keywords": [
"parsing",
Expand Down
6 changes: 3 additions & 3 deletions src/parsimmon.js
Expand Up @@ -595,9 +595,9 @@ function regexp(re, group) {
var groupMatch = match[group];
return makeSuccess(i + fullMatch.length, groupMatch);
}
return makeFailure(
'valid match group (0 to ' + match.length + ') in ' + expected
);
var message =
'valid match group (0 to ' + match.length + ') in ' + expected;
return makeFailure(i, message);
}
return makeFailure(i, expected);
});
Expand Down
6 changes: 5 additions & 1 deletion test/core/regexp.test.js
Expand Up @@ -47,7 +47,11 @@ suite('Parsimmon.regexp', function() {
assert.strictEqual(parser0.parse('a1').value, 'a1');
assert.strictEqual(parser1.parse('a1').value, 'a');
assert.strictEqual(parser2.parse('a1').value, '1');
assert.strictEqual(parser3.parse('a1').status, false);
assert.deepStrictEqual(parser3.parse('a1'), {
status: false,
expected: ['valid match group (0 to 3) in /(\\w)(\\d)/'],
index: {column: 1, line: 1, offset: 0},
});
});

});