Skip to content

Commit

Permalink
Merge 7ea26a4 into 10ac76e
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Mock committed Jul 9, 2017
2 parents 10ac76e + 7ea26a4 commit a5d36de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/parsimmon.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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},
});
});

});

0 comments on commit a5d36de

Please sign in to comment.