change comment

This commit is contained in:
zongor 2025-06-14 20:03:05 -04:00
parent b512575cf7
commit cb7840d258
1 changed files with 16 additions and 18 deletions

View File

@ -16,17 +16,16 @@
;;; ;;;
(defvar zre-keywords (defvar zre-keywords
'("fn" "to" "in" "is" "as" "use" "if" "else" "default" '("fn" "to" "in" "is" "as" "use" "if" "else"
"for" "try" "catch" "while" "do" "exit" "switch" "for" "try" "catch" "while" "do" "exit"
"return" "const" "type" "this" "yield" "case" "return" "const" "type" "this" "yield"
"assert" "break" "mod" "not" "and" "or" "print" "let" "break" "mod" "not" "and" "or" "print" "let")
"band" "bor" "bxor" "srl" "sll")
"Keywords in Zre.") "Keywords in Zre.")
(defvar zre-types (defvar zre-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 Zre.")
@ -70,24 +69,23 @@
(defvar zre-mode-syntax-table (defvar zre-mode-syntax-table
(let ((st (make-syntax-table))) (let ((st (make-syntax-table)))
(modify-syntax-entry ?/ ". 124" st) ;; '/' starts a comment
(modify-syntax-entry ?* ". 23" st) (modify-syntax-entry ?! "<" st)
(modify-syntax-entry ?\n ">" st)
;; Strings
(modify-syntax-entry ?\" "\"" st) (modify-syntax-entry ?\" "\"" st)
(modify-syntax-entry ?` "\"" st)) (modify-syntax-entry ?` "\"" st)
st)
"Syntax table for Zre mode.") "Syntax table for Zre mode.")
(define-derived-mode zre-mode prog-mode "Zre" (define-derived-mode zre-mode prog-mode "ZRE"
"Major mode for editing Zre code." "Major mode for editing Zre code."
:syntax-table zre-mode-syntax-table :syntax-table zre-mode-syntax-table
(setq-local font-lock-defaults '(zre-font-lock-keywords)) (setq-local font-lock-defaults '(zre-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))
(setq-local syntax-propertize-function
(syntax-propertize-rules
;; Line comments starting with //
("\\(//\\)\\(?:[^\n]*\\)" (1 "<")))))
;;;###autoload ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.zre\\'" . zre-mode)) (add-to-list 'auto-mode-alist '("\\.zre\\'" . zre-mode))