Merge pull request #3002 from overleaf/hb-parse-bst-errors

Adds parser for bst file bibtex errors

GitOrigin-RevId: 6481b0ca7cf6ab4522827ed5c6161b84472ccc19
This commit is contained in:
Hugh O'Brien 2020-07-14 09:59:07 +01:00 committed by Copybot
parent ad7af82c53
commit d4d6e2c45d

View file

@ -37,6 +37,8 @@ define(function() {
MULTILINE_ERROR_REGEX = /^(.*)---line (\d+) of file (.*)\n([^]+?)\nI'm skipping whatever remains of this entry$/m;
BAD_CROSS_REFERENCE_REGEX = /^(A bad cross reference---entry ".+?"\nrefers to entry.+?, which doesn't exist)$/m;
MULTILINE_COMMAND_ERROR_REGEX = /^(.*)\n?---line (\d+) of file (.*)\n([^]+?)\nI'm skipping whatever remains of this command$/m;
// Errors hit in BST file have a slightly different format
BST_ERROR_REGEX = /^(.*?)\nwhile executing---line (\d+) of file (.*)/m;
warningParsers = [
[
MULTILINE_WARNING_REGEX, function(match) {
@ -101,8 +103,21 @@ define(function() {
raw: fullMatch
};
}
],[
BST_ERROR_REGEX, function(match) {
var fileName, firstMessage, fullMatch, lineNumber, secondMessage;
fullMatch = match[0], firstMessage = match[1], lineNumber = match[2], fileName = match[3];
return {
file: fileName,
level: "error",
message: firstMessage,
line: lineNumber,
raw: fullMatch
};
}
]
];
(function() {
this.parseBibtex = function() {
var allErrors, allWarnings, ref, ref1, remainingText, result;