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