aboutsummaryrefslogtreecommitdiff
path: root/lib/milan-mode.el
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 06:49:14 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 06:49:14 +0000
commit0e856ca15d8aa1499edc33c7302d4d97be404290 (patch)
treed2bb840d13c57aa17f643e6039af370255e38379 /lib/milan-mode.el
downloadlab-04-0e856ca15d8aa1499edc33c7302d4d97be404290.tar.gz
publishHEADmaster
Diffstat (limited to 'lib/milan-mode.el')
-rw-r--r--lib/milan-mode.el44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/milan-mode.el b/lib/milan-mode.el
new file mode 100644
index 0000000..b5df550
--- /dev/null
+++ b/lib/milan-mode.el
@@ -0,0 +1,44 @@
1;;; milan-mode.el --- simple major mode for MiLan -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2025 Michalec Martin
4
5;; Author: Michalec Martin <martin@michalec.dev>
6;; Keywords: convenience, faces, extensions
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;; reference: http://xahlee.info/emacs/emacs/elisp_syntax_coloring.html
24
25;;; Code:
26
27(defvar-local milan-mode-fontlock
28 '(("/\\*\\(\\*[^/]\\|[^\\*]\\)*\\*/" . 'font-lock-comment-face)
29 ((string-join '("BEGIN" "END" "IF" "THEN" "ELSE" "FI" "WHILE" "DO"
30 "OD" "WRITE" "READ" "FUNC" "RETURNS?" "LOCALS") "\\|")
31 . 'font-lock-keyword-face)
32 (":=\\|+\\|-\\|\\*\\|/\\|<\\|<=\\|=\\|!=\\|>\\|>=" . 'font-lock-operator-face)
33 ("\\(\\|\\)" . 'font-lock-bracket-face)
34 ;; ("[_a-z][_a-z0-9]*\s*\\(" . 'font-lock-function-name-face)
35 ;; ("[_a-z][_a-z0-9]*" . 'font-lock-variable-name-face)
36 ))
37
38(define-derived-mode milan-mode prog-mode "MiLan"
39 "Major mode for editing milan grammars."
40 (setq font-lock-defaults '(milan-mode-fontlock)))
41
42(provide 'milan-mode)
43
44;;; milan-mode.el ends here