Skip to content

Commit

Permalink
Merge pull request #107 from tpapp/tp/1.6-error-locations
Browse files Browse the repository at this point in the history
add regex for 1.6 code locations
  • Loading branch information
tpapp authored Apr 8, 2021
2 parents 2c25fe2 + 49363bb commit 79e686e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions julia-repl-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
10 changes: 9 additions & 1 deletion julia-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 79e686e

Please sign in to comment.