rename
This commit is contained in:
parent
a214b1e7f2
commit
2d833b3a77
|
@ -1,7 +1,7 @@
|
|||
#+OPTIONS: toc:nil
|
||||
|
||||
* zre-mode
|
||||
* zrl-mode
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: zre-mode
|
||||
:CUSTOM_ID: zrl-mode
|
||||
:END:
|
||||
ZRE mode for Emacs
|
||||
ZRL mode for Emacs
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; zre-mode.el --- Major mode for editing Zre code -*- lexical-binding: t; -*-
|
||||
;;; zrl-mode.el --- Major mode for editing Zrl code -*- lexical-binding: t; -*-
|
||||
;; Copyright (C) 2025 zongor
|
||||
;;
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
|
@ -15,35 +15,35 @@
|
|||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;;
|
||||
|
||||
(defvar zre-keywords
|
||||
(defvar zrl-keywords
|
||||
'("fn" "to" "in" "is" "as" "use" "if" "else" "default"
|
||||
"for" "try" "catch" "while" "do" "exit" "switch"
|
||||
"return" "const" "type" "this" "yield" "case"
|
||||
"assert" "break" "mod" "not" "and" "or" "print" "let"
|
||||
"band" "bor" "bxor" "srl" "sll")
|
||||
"Keywords in Zre.")
|
||||
"Keywords in Zrl.")
|
||||
|
||||
(defvar zre-types
|
||||
(defvar zrl-types
|
||||
'("byte" "str" "real" "bool"
|
||||
"int" "nat" "f32" "f64"
|
||||
"u8" "u16" "u32" "u64"
|
||||
"i8" "i16" "i32" "i64")
|
||||
"Types in Zre.")
|
||||
"Types in Zrl.")
|
||||
|
||||
(defvar zre-constants
|
||||
(defvar zrl-constants
|
||||
'("true" "false" "nil")
|
||||
"Constants in Zre.")
|
||||
"Constants in Zrl.")
|
||||
|
||||
(defvar zre-font-lock-keywords
|
||||
(defvar zrl-font-lock-keywords
|
||||
`(
|
||||
;; Keywords
|
||||
(,(regexp-opt zre-keywords 'words) . font-lock-keyword-face)
|
||||
(,(regexp-opt zrl-keywords 'words) . font-lock-keyword-face)
|
||||
|
||||
;; Types
|
||||
(,(regexp-opt zre-types 'words) . font-lock-type-face)
|
||||
(,(regexp-opt zrl-types 'words) . font-lock-type-face)
|
||||
|
||||
;; Constants
|
||||
(,(regexp-opt zre-constants 'words) . font-lock-constant-face)
|
||||
(,(regexp-opt zrl-constants 'words) . font-lock-constant-face)
|
||||
|
||||
;; Structs: CamelCase identifiers
|
||||
("\\b[A-Z][a-zA-Z0-9_]*\\b" . font-lock-type-face)
|
||||
|
@ -66,9 +66,9 @@
|
|||
;; Strings with backticks
|
||||
("`[^`]*`" . font-lock-string-face))
|
||||
|
||||
"Font lock keywords for Zre mode.")
|
||||
"Font lock keywords for Zrl mode.")
|
||||
|
||||
(defvar zre-mode-syntax-table
|
||||
(defvar zrl-mode-syntax-table
|
||||
(let ((st (make-syntax-table)))
|
||||
;; '/' starts a comment
|
||||
(modify-syntax-entry ?! "<" st)
|
||||
|
@ -77,19 +77,19 @@
|
|||
(modify-syntax-entry ?\" "\"" st)
|
||||
(modify-syntax-entry ?` "\"" st)
|
||||
st)
|
||||
"Syntax table for Zre mode.")
|
||||
"Syntax table for Zrl mode.")
|
||||
|
||||
(define-derived-mode zre-mode prog-mode "ZRE"
|
||||
"Major mode for editing Zre code."
|
||||
:syntax-table zre-mode-syntax-table
|
||||
(setq-local font-lock-defaults '(zre-font-lock-keywords))
|
||||
(define-derived-mode zrl-mode prog-mode "ZRL"
|
||||
"Major mode for editing Zrl code."
|
||||
:syntax-table zrl-mode-syntax-table
|
||||
(setq-local font-lock-defaults '(zrl-font-lock-keywords))
|
||||
(setq-local comment-start "! ")
|
||||
(setq-local comment-end "")
|
||||
(setq-local parse-sexp-ignore-comments t)
|
||||
(setq-local indent-line-function 'c-indent-line))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.zre\\'" . zre-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.zrl\\'" . zrl-mode))
|
||||
|
||||
(provide 'zre-mode)
|
||||
;;; zre-mode.el ends here
|
||||
(provide 'zrl-mode)
|
||||
;;; zrl-mode.el ends here
|
Loading…
Reference in New Issue