Upgrade parser.

This commit is contained in:
Shane Kilkelly 2016-03-10 16:01:54 +00:00
parent 9281d8029d
commit 170d3f646b

View file

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.10.0
define(function() {
var BibLogParser, LINE_SPLITTER_REGEX, MESSAGE_LEVELS, MULTILINE_ERROR_REGEX, MULTILINE_WARNING_REGEX, SINGLELINE_WARNING_REGEX, consume;
var BAD_CROSS_REFERENCE_REGEX, BibLogParser, LINE_SPLITTER_REGEX, MESSAGE_LEVELS, MULTILINE_ERROR_REGEX, MULTILINE_WARNING_REGEX, SINGLELINE_WARNING_REGEX, consume;
LINE_SPLITTER_REGEX = /^\[(\d+)].*>\s(INFO|WARN|ERROR)\s-\s(.*)$/;
MESSAGE_LEVELS = {
"INFO": "info",
@ -35,9 +35,10 @@ define(function() {
MULTILINE_WARNING_REGEX = /^Warning--(.+)\n--line (\d+) of file (.+)$/m;
SINGLELINE_WARNING_REGEX = /^Warning--(.+)$/m;
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;
(function() {
this.parseBibtex = function() {
var multiLineErrors, multiLineWarnings, ref, ref1, ref2, remainingText, result, singleLineWarnings;
var crossReferenceErrors, multiLineErrors, multiLineWarnings, ref, ref1, ref2, ref3, remainingText, result, singleLineWarnings;
result = {
all: [],
errors: [],
@ -84,6 +85,19 @@ define(function() {
}), multiLineErrors = ref2[0], remainingText = ref2[1];
result.all = result.all.concat(multiLineErrors);
result.errors = multiLineErrors;
ref3 = consume(remainingText, BAD_CROSS_REFERENCE_REGEX, function(match) {
var fullMatch, message;
fullMatch = match[0], message = match[1];
return {
file: null,
level: "error",
message: message,
line: null,
raw: fullMatch
};
}), crossReferenceErrors = ref3[0], remainingText = ref3[1];
result.all = result.all.concat(crossReferenceErrors);
result.errors = result.errors.concat(crossReferenceErrors);
return result;
};
this.parseBiber = function() {