mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
29 lines
585 B
JavaScript
29 lines
585 B
JavaScript
|
export const ChkTeXParser = {
|
||
|
parse(log) {
|
||
|
const errors = []
|
||
|
const warnings = []
|
||
|
|
||
|
for (const line of log.split('\n')) {
|
||
|
const m = line.match(/^(\S+):(\d+):(\d+): (Error|Warning): (.*)/)
|
||
|
|
||
|
if (m) {
|
||
|
const result = {
|
||
|
file: m[1],
|
||
|
line: m[2],
|
||
|
column: m[3],
|
||
|
level: m[4].toLowerCase(),
|
||
|
message: `${m[4]}: ${m[5]}`,
|
||
|
}
|
||
|
|
||
|
if (result.level === 'error') {
|
||
|
errors.push(result)
|
||
|
} else {
|
||
|
warnings.push(result)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return { errors, warnings }
|
||
|
},
|
||
|
}
|