Libraryless. Click here for Pure Java version (5231L/30K).
/* Example: ---------- 1. ERROR in /home/stefan/JavaX-Caches/Temp/1642773472353/UserCode_1642773470538.java (at line 26) xg.fillRect(10, 10, 10, 10); ^^ xg cannot be resolved ---------- */ sclass ECJError { S file, error; int lineNr; S codeLine; IntRange colRange; toString { ret "Error on line " + lineNr + ": " + error; } } static L<ECJError> parseECJOutputForErrors(S text) { new L<ECJError> errors; LS lines = lines(text); for i over lines: { if (startsWith(lines.get(i), "---")) { S line = get(lines, i+1); //print(line); LS groups = regexpFirstGroups("^\\d+\\. ERROR in (.*?) \\(at line (\\d+)\\)$", line); if (groups != null) { //print(+groups); S codeLine = get(lines, i+2); S markLine = get(lines, i+3); S errorLine = get(lines, i+4); //print(+markLine); LS markGroups = regexpFirstGroups("^( *)(\\^+)", markLine); //print(+markGroups); new ECJError e; e.file = groups.get(0); e.error = errorLine; e.lineNr = parseInt(groups.get(1)); e.codeLine = codeLine; int col1 = l(first(markGroups)); int cols = l(second(markGroups)); e.colRange = intRangeWithLength(col1+1, cols); errors.add(e); } } } ret errors; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034084 |
Snippet name: | parseECJOutputForErrors [OK] |
Eternal ID of this version: | #1034084/17 |
Text MD5: | 7518cf3ea97b971486d29b71ce1d44b7 |
Transpilation MD5: | 0a2b8194545b956e9a20a3eea00b9172 |
Author: | stefan |
Category: | javax / compiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-21 16:47:16 |
Source code size: | 1361 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 148 / 224 |
Version history: | 16 change(s) |
Referenced in: | [show references] |