diff --git a/julia-repl-tests.el b/julia-repl-tests.el index f91ebb0..cf6491f 100644 --- a/julia-repl-tests.el +++ b/julia-repl-tests.el @@ -37,3 +37,10 @@ (should (equal (julia-repl--symbol-extraction "Foo.bar.baz " 6) symbols)) (should (equal (julia-repl--symbol-extraction "Foo.bar.baz.( " 12) symbols)) (should (equal (julia-repl--symbol-extraction "Foo.bar.baz.( " 6) symbols)))) + +(ert-deftest julia-repl-location-rx () + (let ((str "@ Foo ~/code/Foo/src/Foo.jl:100")) + (string-match julia-repl--rx-at str) + (equal (match-string 1 str) "Foo") + (equal (match-string 2 str) "~/code/Foo/src/Foo.jl") + (equal (match-string 3 str) "100"))) diff --git a/julia-repl.el b/julia-repl.el index 4354b63..c056d25 100644 --- a/julia-repl.el +++ b/julia-repl.el @@ -231,13 +231,21 @@ When PASTE-P, “bracketed paste” mode will be used. When RET-P, terminate wit ;; global variables ;; +(defconst julia-repl--rx-at + (rx (seq "@" (syntax whitespace) + (? (group (+ alnum)) space) ; package name + (group (+ (not (any space ">" "<" "(" ")" "\t" "\n" "," "'" "\"" ";" ":")))) ; path + ":" (group (+ num)))) ; line + "Matches “@ Foo ~/code/Foo/src/Foo.jl:100”") + (defvar julia-repl--compilation-regexp-alist - '(;; matches "while loading /tmp/Foo.jl, in expression starting on line 2" + `(;; matches "while loading /tmp/Foo.jl, in expression starting on line 2" (julia-load-error . ("while loading \\([^ ><()\t\n,'\";:]+\\), in expression starting on line \\([0-9]+\\)" 1 2)) ;; matches "around /tmp/Foo.jl:2", also starting with "at" or "Revise" (julia-loc . ("\\(around\\|at\\|Revise\\) \\([^ ><()\t\n,'\";:]+\\):\\([0-9]+\\)" 2 3)) ;; matches "omitting file /tmp/Foo.jl due to parsing error near line 2", from Revise.parse_source! (julia-warn-revise . ("omitting file \\([^ ><()\t\n,'\";:]+\\) due to parsing error near line \\([0-9]+\\)" 1 2)) + (julia-error-at . (,julia-repl--rx-at 2 3)) ) "Specifications for highlighting error locations.