mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Upgrade parser.
This commit is contained in:
parent
9281d8029d
commit
170d3f646b
1 changed files with 16 additions and 2 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue