Skip to content

Commit a4d4c07

Browse files
committed
Use rx-to-string instead of eval, minor reformat
1 parent 356f4e0 commit a4d4c07

File tree

1 file changed

+65
-63
lines changed

1 file changed

+65
-63
lines changed

cider-eval.el

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -562,53 +562,55 @@ It delegates the actual error content to the eval or op handler."
562562
(t (cider-default-err-eval-print-handler))))
563563

564564

565-
(defconst cider-clojure-1.10--location `((or "at ("
566-
(sequence "at "
567-
(minimal-match (one-or-more anything)) ;; the fully-qualified name of the function that triggered the error
568-
" ("))
569-
(group-n 2 (minimal-match (zero-or-more anything)))
570-
":"
571-
(group-n 3 (one-or-more (any "-" digit))) ;; line numbers may be negative (#3687)
572-
(optional ":" (group-n 4 (one-or-more (any "-" digit))))
573-
")."))
574-
575-
(defconst cider-clojure-1.10-error (append `(sequence
576-
"Syntax error "
577-
(minimal-match (zero-or-more anything))
578-
(or "compiling "
579-
"macroexpanding "
580-
"reading source ")
581-
(minimal-match (zero-or-more anything)))
582-
cider-clojure-1.10--location))
583-
584-
(defconst cider-clojure-unexpected-error (append `(sequence
585-
"Unexpected error ("
586-
(minimal-match (one-or-more anything))
587-
") "
588-
(or "compiling "
589-
"macroexpanding "
590-
"reading source ")
591-
(minimal-match (one-or-more anything)))
592-
cider-clojure-1.10--location))
593-
594-
(defconst cider-clojure-warning `(sequence
595-
(minimal-match (zero-or-more anything))
596-
(group-n 1 "warning")
597-
", "
598-
(group-n 2 (minimal-match (zero-or-more anything)))
599-
":"
600-
(group-n 3 (one-or-more (any "-" digit)))
601-
(optional ":" (group-n 4 (one-or-more (any "-" digit))))
602-
" - "))
565+
(defconst cider-clojure-1.10--location
566+
'(sequence
567+
(or "at ("
568+
(sequence "at "
569+
(minimal-match (one-or-more anything)) ;; the fully-qualified name of the function that triggered the error
570+
" ("))
571+
(group-n 2 (minimal-match (zero-or-more anything))) ; source file
572+
":" (group-n 3 (one-or-more (any "-" digit))) ; line number, may be negative (#3687)
573+
(optional
574+
":" (group-n 4 (one-or-more (any "-" digit)))) ; column number
575+
")."))
576+
577+
(defconst cider-clojure-1.10-error
578+
`(sequence
579+
"Syntax error "
580+
(minimal-match (zero-or-more anything))
581+
(or "compiling "
582+
"macroexpanding "
583+
"reading source ")
584+
(minimal-match (zero-or-more anything))
585+
,cider-clojure-1.10--location))
586+
587+
(defconst cider-clojure-unexpected-error
588+
`(sequence
589+
"Unexpected error (" (minimal-match (one-or-more anything)) ") "
590+
(or "compiling "
591+
"macroexpanding "
592+
"reading source ")
593+
(minimal-match (one-or-more anything))
594+
,cider-clojure-1.10--location))
595+
596+
(defconst cider-clojure-warning
597+
`(sequence
598+
(minimal-match (zero-or-more anything))
599+
(group-n 1 "warning")
600+
", " (group-n 2 (minimal-match (zero-or-more anything)))
601+
":" (group-n 3 (one-or-more (any "-" digit)))
602+
(optional
603+
":" (group-n 4 (one-or-more (any "-" digit))))
604+
" - "))
603605

604606
;; Please keep this in sync with `cider-clojure-compilation-error-regexp',
605607
;; which is a subset of these regexes.
606608
(defconst cider-clojure-compilation-regexp
607-
(eval
608-
`(rx bol (or ,cider-clojure-warning
609-
,cider-clojure-1.10-error
610-
,cider-clojure-unexpected-error))
611-
t)
609+
(rx-to-string
610+
`(seq bol (or ,cider-clojure-warning
611+
,cider-clojure-1.10-error
612+
,cider-clojure-unexpected-error))
613+
'nogroup)
612614
"A few example values that will match:
613615
\"Reflection warning, /tmp/foo/src/foo/core.clj:14:1 - \"
614616
\"CompilerException java.lang.RuntimeException: Unable to resolve symbol: \\
@@ -617,10 +619,10 @@ lol in this context, compiling:(/foo/core.clj:10:1)\"
617619
\"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"")
618620

619621
(defconst cider-clojure-compilation-error-regexp
620-
(eval
621-
`(rx bol (or ,cider-clojure-1.10-error
622-
,cider-clojure-unexpected-error))
623-
t)
622+
(rx-to-string
623+
`(seq bol (or ,cider-clojure-1.10-error
624+
,cider-clojure-unexpected-error))
625+
'nogroup)
624626
"Like `cider-clojure-compilation-regexp',
625627
but excluding warnings such as reflection warnings.
626628
@@ -631,26 +633,26 @@ lol in this context, compiling:(/foo/core.clj:10:1)\"
631633
\"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"")
632634

633635
(defconst cider--clojure-execution-error-regexp
634-
(append `(sequence
635-
"Execution error "
636-
(or (sequence "("
637-
(minimal-match (one-or-more anything))
638-
")")
639-
(minimal-match (zero-or-more anything))))
640-
cider-clojure-1.10--location))
636+
`(sequence
637+
"Execution error "
638+
(or (sequence "("
639+
(minimal-match (one-or-more anything))
640+
")")
641+
(minimal-match (zero-or-more anything)))
642+
,cider-clojure-1.10--location))
641643

642644
(defconst cider--clojure-spec-execution-error-regexp
643-
(append `(sequence
644-
"Execution error - invalid arguments to "
645-
(minimal-match (one-or-more anything))
646-
" ")
647-
cider-clojure-1.10--location))
645+
`(sequence
646+
"Execution error - invalid arguments to "
647+
(minimal-match (one-or-more anything))
648+
" "
649+
,cider-clojure-1.10--location))
648650

649651
(defconst cider-clojure-runtime-error-regexp
650-
(eval
651-
`(rx bol (or ,cider--clojure-execution-error-regexp
652-
,cider--clojure-spec-execution-error-regexp))
653-
t)
652+
(rx-to-string
653+
`(seq bol (or ,cider--clojure-execution-error-regexp
654+
,cider--clojure-spec-execution-error-regexp))
655+
'nogroup)
654656
"Matches runtime errors, as oppsed to compile-time/macroexpansion-time errors.
655657
656658
A few example values that will match:

0 commit comments

Comments
 (0)