-
Notifications
You must be signed in to change notification settings - Fork 72
/
flycheck-idris.el
101 lines (87 loc) · 3.36 KB
/
flycheck-idris.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
;;; flycheck-idris.el --- Major mode for editing Idris code -*- lexical-binding: t -*-
;; Copyright (C) 2022
;; Author:
;; URL: https://github.com/idris-hackers/idris-mode
;; Keywords: languages
;; Package-Requires: ((emacs "24") (prop-menu "0.1") (cl-lib "0.5"))
;; Version: 1.1.0
;;; Commentary:
;; FlyCheck checkers for Idris(2)
;;; Code:
(require 'flycheck)
(require 'idris-mode)
(flycheck-define-checker idris
"An Idris syntax and type checker."
:command ("idris"
"--check" "--nocolor" "--warnpartial"
;; Compute the command-line options similarly to inferior-idris
(eval (idris-compute-flags))
source-original)
:error-patterns
((warning line-start
(file-name)
":"
line
":"
column
"-"
end-column
":" line-end "\n"
(one-or-more blank) "|\n"
(one-or-more digit) (one-or-more blank) "|" (one-or-more not-newline) "\n"
(one-or-more blank) "|" (zero-or-more blank) (one-or-more "~") "\n"
"Warning - "(message (one-or-more not-newline)
(zero-or-more "\n" (one-or-more not-newline))))
(error line-start
(file-name)
":"
line
":"
column
"-"
end-column
":" line-end "\n"
(one-or-more blank) "|\n"
(one-or-more digit) (one-or-more blank) "|" (one-or-more not-newline) "\n"
(one-or-more blank) "|" (zero-or-more blank) (one-or-more "~") "\n"
(one-or-more not-newline) "\n"
(one-or-more blank) (one-or-more not-newline) "\n\n"
(message (one-or-more not-newline)
(zero-or-more "\n" (one-or-more not-newline)))))
:error-filter delete-dups
:modes idris-mode)
(flycheck-define-checker idris2
"An Idris2 syntax and type checker."
:command ("idris2"
"--check" "--no-colour"
;; Compute the command-line options similarly to inferior-idris
(eval (idris-compute-flags))
source-original)
:error-patterns ((warning line-start
"Warning: "
(message (one-or-more not-newline)
(zero-or-more "\n" (one-or-more not-newline))
"\n\n")
(one-or-more (not ":")) ;; (file-name)
":" line
":" column
"--" end-line
":" end-column)
(error line-start
(zero-or-one "Uncaught error: ")
"Error: "
(zero-or-one "While processing" (one-or-more (not ".")) ".")
(message (one-or-more not-newline)
(zero-or-more "\n" (one-or-more not-newline))
"\n\n")
(one-or-more (not ":")) ;; (file-name)
":" line
":" column
"--" end-line
":" end-column))
:modes idris-mode)
;;; ###autoload
(add-to-list 'flycheck-checkers 'idris)
(add-to-list 'flycheck-checkers 'idris2)
(provide 'flycheck-idris)
;;; flycheck-idris.el ends here