Skip to content

Commit e01e3fd

Browse files
authored
Merge pull request #35 from laelath/clang-error-parsing
fix parsing of clang assembler errors
2 parents 53a0427 + 140ab1e commit e01e3fd

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

a86/interp.rkt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,22 @@
220220

221221
(define (assembly-offending-line msg)
222222
(match (regexp-match
223-
"(.*):([0-9]+): error: " msg)
224-
[(list _ (app string->path file) (app string->number line))
225-
(format
226-
"\noffending line: ~a"
223+
"(.*):([0-9]+):([0-9]+): error: " msg)
224+
[(list _ (app string->path file) (app string->number line) (app string->number offset))
225+
(define line-text
227226
(with-input-from-file file
228227
(thunk
229228
(let loop ([l (read-line)]
230229
[i line])
231230
(if (= i 1)
232231
l
233-
(loop (read-line) (sub1 i)))))))]
232+
(loop (read-line) (sub1 i)))))))
233+
(match (regexp-match "[ ]*(.*)" line-text)
234+
[(list _ trimmed-line)
235+
(format
236+
"\noffending line: ~a\n ~a^"
237+
trimmed-line
238+
(make-string offset #\space))])]
234239
[_ ""]))
235240

236241

0 commit comments

Comments
 (0)