Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit c77ba318 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Bug fix to handle multi-line error in ACG emacs mode

parent ea8b0f41
......@@ -95,7 +95,8 @@
;; find the line of the error
(defconst acg-error-regexp
"^[^\0-@]+ \"\\([^\"\n]+\\)\", [^\0-@]+ \\([0-9]+\\)[-,:]"
;; "^[^\0-@]+ \"\\([^\"\n]+\\)\", [^\0-@]+ \\([0-9]+\\)[-,:]"
"^.*File \"\\([^\"]+\\)\",[^0-9]+\\([0-9]+\\),"
"Regular expression matching the error messages produced by acgc.")
(if (boundp 'compilation-error-regexp-alist)
......@@ -108,8 +109,14 @@
;; A regexp to extract the range info.
;; Needs to be augmented with the possible optional range info
;; (for instance in case of non linear application on linear variable
(defconst acg-error-chars-regexp
".*, .*, [^\0-@]+ \\([0-9]+\\)-\\([0-9]+\\)"
(defconst acg-error-chars-single-line-regexp
;; ".*, .*, [^\0-@]+ \\([0-9]+\\)-\\([0-9]+\\)"
".*line [0-9]+, characters \\([0-9]+\\)-\\([0-9]+\\)"
"Regexp matching the char numbers in an error message produced by acgc.")
(defconst acg-error-chars-multi-line-regexp
".*line [0-9]+, character \\([0-9]+\\) to line \\([0-9]+\\), character \\([0-9]+\\)"
"Regexp matching the char numbers in an error message produced by acgc.")
......@@ -125,18 +132,42 @@ Puts the point and the mark exactly around the erroneous program
fragment. The erroneous fragment is also temporarily highlighted if
(if (eq major-mode 'acg-mode)
(let ((beg nil) (end nil))
(let ((beg nil) (end nil) (line-end nil) (char-end nil))
(set-buffer compilation-last-buffer)
(goto-char (window-point (get-buffer-window (current-buffer) t)))
(if (looking-at acg-error-chars-regexp)
(if (looking-at acg-error-chars-single-line-regexp)
(setq beg (string-to-int (acg-match-string 1))
end (string-to-int (acg-match-string 2)))
(if (looking-at acg-error-chars-multi-line-regexp)
(setq beg (string-to-int (acg-match-string 1))
end (string-to-int (acg-match-string 2))))))
line-end (string-to-int (acg-match-string 2))
char-end (string-to-int (acg-match-string 3))
(if beg
(setq beg (+ (point) beg) end (+ (point) end))
(goto-char beg) (push-mark end t t))))))
(if end
(setq beg (+ (point) beg) end (+ (point) end))
(goto-char beg)
(push-mark (+ end 1) t t))
(setq beg (+ (point) beg))
(goto-char beg)
(setq current-position nil)
(point-to-register current-position)
(goto-line line-end)
(setq end (+ (point) char-end))
(push-mark (+ end 1) t t)
(jump-to-register current-position))
(ad-activate 'next-error)
......@@ -111,7 +111,7 @@ let compute_comment_for_position pos1 pos2 =
if line1=line2 then
Printf.sprintf "line %d, characters %d-%d" line2 col1 col2
Printf.sprintf "from l:%d, c:%d to l:%d,c:%d" line1 col1 line2 col2
Printf.sprintf "line %d, character %d to line %d, character %d" line1 col1 line2 col2
let lex_error_to_string = function
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment