mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
73bc3418a2
GitOrigin-RevId: fcc88a362c3e97c9fddf85d47c3a83a0a0b89432
28 lines
585 B
JavaScript
28 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 }
|
|
},
|
|
}
|