From cb7840d258078e00e7e544573586b31a4aebb398 Mon Sep 17 00:00:00 2001 From: zongor Date: Sat, 14 Jun 2025 20:03:05 -0400 Subject: [PATCH] change comment --- zre-mode.el | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/zre-mode.el b/zre-mode.el index 7291e3a..5c6c7e1 100644 --- a/zre-mode.el +++ b/zre-mode.el @@ -16,17 +16,16 @@ ;;; (defvar zre-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") + '("fn" "to" "in" "is" "as" "use" "if" "else" + "for" "try" "catch" "while" "do" "exit" + "return" "const" "type" "this" "yield" + "break" "mod" "not" "and" "or" "print" "let") "Keywords in Zre.") (defvar zre-types - '("byte" "str" "real" "bool" - "int" "nat" "f32" "f64" - "u8" "u16" "u32" "u64" + '("byte" "str" "real" "bool" + "int" "nat" "f32" "f64" + "u8" "u16" "u32" "u64" "i8" "i16" "i32" "i64") "Types in Zre.") @@ -70,24 +69,23 @@ (defvar zre-mode-syntax-table (let ((st (make-syntax-table))) - (modify-syntax-entry ?/ ". 124" st) - (modify-syntax-entry ?* ". 23" st) + ;; '/' starts a comment + (modify-syntax-entry ?! "<" st) + (modify-syntax-entry ?\n ">" st) + ;; Strings (modify-syntax-entry ?\" "\"" st) - (modify-syntax-entry ?` "\"" st)) + (modify-syntax-entry ?` "\"" st) + st) "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." :syntax-table zre-mode-syntax-table (setq-local font-lock-defaults '(zre-font-lock-keywords)) - (setq-local comment-start "// ") + (setq-local comment-start "! ") (setq-local comment-end "") (setq-local parse-sexp-ignore-comments t) - (setq-local indent-line-function 'c-indent-line) - (setq-local syntax-propertize-function - (syntax-propertize-rules - ;; Line comments starting with // - ("\\(//\\)\\(?:[^\n]*\\)" (1 "<"))))) + (setq-local indent-line-function 'c-indent-line)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.zre\\'" . zre-mode))