Upgrade parser.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.10.0
|
||||
define(function() {
|
||||
var BAD_CROSS_REFERENCE_REGEX, 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_COMMAND_ERROR_REGEX, MULTILINE_ERROR_REGEX, MULTILINE_WARNING_REGEX, SINGLELINE_WARNING_REGEX, consume, errorParsers, warningParsers;
|
||||
LINE_SPLITTER_REGEX = /^\[(\d+)].*>\s(INFO|WARN|ERROR)\s-\s(.*)$/;
|
||||
MESSAGE_LEVELS = {
|
||||
"INFO": "info",
|
||||
@@ -36,17 +36,10 @@ define(function() {
|
||||
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 crossReferenceErrors, multiLineErrors, multiLineWarnings, ref, ref1, ref2, ref3, remainingText, result, singleLineWarnings;
|
||||
result = {
|
||||
all: [],
|
||||
errors: [],
|
||||
warnings: [],
|
||||
files: [],
|
||||
typesetting: []
|
||||
};
|
||||
ref = consume(this.text, MULTILINE_WARNING_REGEX, function(match) {
|
||||
MULTILINE_COMMAND_ERROR_REGEX = /^(.*)\n---line (\d+) of file (.*)\n([^]+?)\nI'm skipping whatever remains of this command$/m;
|
||||
warningParsers = [
|
||||
[
|
||||
MULTILINE_WARNING_REGEX, function(match) {
|
||||
var fileName, fullMatch, lineNumber, message;
|
||||
fullMatch = match[0], message = match[1], lineNumber = match[2], fileName = match[3];
|
||||
return {
|
||||
@@ -56,10 +49,9 @@ define(function() {
|
||||
line: lineNumber,
|
||||
raw: fullMatch
|
||||
};
|
||||
}), multiLineWarnings = ref[0], remainingText = ref[1];
|
||||
result.all = multiLineWarnings;
|
||||
result.warnings = multiLineWarnings;
|
||||
ref1 = consume(remainingText, SINGLELINE_WARNING_REGEX, function(match) {
|
||||
}
|
||||
], [
|
||||
SINGLELINE_WARNING_REGEX, function(match) {
|
||||
var fullMatch, message;
|
||||
fullMatch = match[0], message = match[1];
|
||||
return {
|
||||
@@ -69,10 +61,12 @@ define(function() {
|
||||
line: null,
|
||||
raw: fullMatch
|
||||
};
|
||||
}), singleLineWarnings = ref1[0], remainingText = ref1[1];
|
||||
result.all = result.all.concat(singleLineWarnings);
|
||||
result.warnings = result.warnings.concat(singleLineWarnings);
|
||||
ref2 = consume(remainingText, MULTILINE_ERROR_REGEX, function(match) {
|
||||
}
|
||||
]
|
||||
];
|
||||
errorParsers = [
|
||||
[
|
||||
MULTILINE_ERROR_REGEX, function(match) {
|
||||
var fileName, firstMessage, fullMatch, lineNumber, secondMessage;
|
||||
fullMatch = match[0], firstMessage = match[1], lineNumber = match[2], fileName = match[3], secondMessage = match[4];
|
||||
return {
|
||||
@@ -82,10 +76,9 @@ define(function() {
|
||||
line: lineNumber,
|
||||
raw: fullMatch
|
||||
};
|
||||
}), multiLineErrors = ref2[0], remainingText = ref2[1];
|
||||
result.all = result.all.concat(multiLineErrors);
|
||||
result.errors = multiLineErrors;
|
||||
ref3 = consume(remainingText, BAD_CROSS_REFERENCE_REGEX, function(match) {
|
||||
}
|
||||
], [
|
||||
BAD_CROSS_REFERENCE_REGEX, function(match) {
|
||||
var fullMatch, message;
|
||||
fullMatch = match[0], message = match[1];
|
||||
return {
|
||||
@@ -95,9 +88,48 @@ define(function() {
|
||||
line: null,
|
||||
raw: fullMatch
|
||||
};
|
||||
}), crossReferenceErrors = ref3[0], remainingText = ref3[1];
|
||||
result.all = result.all.concat(crossReferenceErrors);
|
||||
result.errors = result.errors.concat(crossReferenceErrors);
|
||||
}
|
||||
], [
|
||||
MULTILINE_COMMAND_ERROR_REGEX, function(match) {
|
||||
var fileName, firstMessage, fullMatch, lineNumber, secondMessage;
|
||||
fullMatch = match[0], firstMessage = match[1], lineNumber = match[2], fileName = match[3], secondMessage = match[4];
|
||||
return {
|
||||
file: fileName,
|
||||
level: "error",
|
||||
message: firstMessage + '\n' + secondMessage,
|
||||
line: lineNumber,
|
||||
raw: fullMatch
|
||||
};
|
||||
}
|
||||
]
|
||||
];
|
||||
(function() {
|
||||
this.parseBibtex = function() {
|
||||
var allErrors, allWarnings, ref, ref1, remainingText, result;
|
||||
result = {
|
||||
all: [],
|
||||
errors: [],
|
||||
warnings: [],
|
||||
files: [],
|
||||
typesetting: []
|
||||
};
|
||||
ref = warningParsers.reduce(function(accumulator, parser) {
|
||||
var _remainingText, currentWarnings, process, ref, regex, text, warnings;
|
||||
currentWarnings = accumulator[0], text = accumulator[1];
|
||||
regex = parser[0], process = parser[1];
|
||||
ref = consume(text, regex, process), warnings = ref[0], _remainingText = ref[1];
|
||||
return [currentWarnings.concat(warnings), _remainingText];
|
||||
}, [[], this.text]), allWarnings = ref[0], remainingText = ref[1];
|
||||
ref1 = errorParsers.reduce(function(accumulator, parser) {
|
||||
var _remainingText, currentErrors, errors, process, ref1, regex, text;
|
||||
currentErrors = accumulator[0], text = accumulator[1];
|
||||
regex = parser[0], process = parser[1];
|
||||
ref1 = consume(text, regex, process), errors = ref1[0], _remainingText = ref1[1];
|
||||
return [currentErrors.concat(errors), _remainingText];
|
||||
}, [[], remainingText]), allErrors = ref1[0], remainingText = ref1[1];
|
||||
result.warnings = allWarnings;
|
||||
result.errors = allErrors;
|
||||
result.all = allWarnings.concat(allErrors);
|
||||
return result;
|
||||
};
|
||||
this.parseBiber = function() {
|
||||
|
||||
Reference in New Issue
Block a user