Parse inlining location information.

This commit is contained in:
Vincent St-Amour 2011-10-11 17:03:40 -04:00
parent 2b739bd0ff
commit a71565e77a

View File

@ -51,25 +51,35 @@
;; Attempt at making this thing readable. ;; Attempt at making this thing readable.
any-inlining-event-regexp any-inlining-event-regexp
"involving: " "involving: "
;; _What_ gets inlined (or not).
(string-append ; either a vector with name and source info, or just name (string-append ; either a vector with name and source info, or just name
"(" "("
"#\\(([^ ]+) #<path:(.+)> ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) [^ ]+\\)" "#\\(([^ ]+) #<path:(.+)> ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) [^ ]+\\)"
"|" "|"
"([^ ]+)" "([^ ]+)" ; just name, we won't be able to do much with it
")"))) ")")
;; _Where_ this happens (in which function, can't get more precise info).
(string-append
;; maybe full path info: path, line, col, name
"( in: (([^ :]+):([^ :]+):([^ :]+): )?([^ ]+))?"
;; module info, useless to us (at least for now)
" in module: [^ ]+")
"$"))
(define (inlining-event->forged-stx l) (define (inlining-event->forged-stx l)
(match (regexp-match inlining-event-regexp l) (match (regexp-match inlining-event-regexp l)
[`(,all ,pre ,vec ,name ,path ,line ,col ,pos ,span #f) [`(,all ,kind
(datum->syntax #'here (string->symbol name) ,what ,name ,path ,line ,col ,pos ,span
(list path ,only-name
(string->number line) ,where ,where-loc ,where-path ,where-line ,where-col ,where-name)
(string->number col) (datum->syntax #'here (string->symbol (or name only-name))
(string->number pos) (if only-name
(string->number span)))] #f ; no source location
[`(,all ,pre ,name #f #f #f #f #f #f ,name) (list path
;; We only know the name. there's not much we can do with that. (string->number line)
(datum->syntax #'here (string->symbol name) #f)] (string->number col)
(string->number pos)
(string->number span))))]
[_ (error "ill-formed inlining log entry" l)])) [_ (error "ill-formed inlining log entry" l)]))
(define success-kind "Inlining") (define success-kind "Inlining")