[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nasm-mode 4b06918 02/67: Allow labels without colons.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nasm-mode 4b06918 02/67: Allow labels without colons. |
Date: |
Sun, 29 Aug 2021 11:23:41 -0400 (EDT) |
branch: elpa/nasm-mode
commit 4b0691844efd68833fd09b74b2fadb60cbcd3c9f
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Allow labels without colons.
---
nasm-mode.el | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/nasm-mode.el b/nasm-mode.el
index fcacdcc..71029fa 100644
--- a/nasm-mode.el
+++ b/nasm-mode.el
@@ -379,17 +379,17 @@
"NASM preprocessor directives (pptok.c) for `nasm-mode'.")
(defconst nasm-label-regexp
- "^\\s-*[a-zA-Z0-9_.?][a-zA-Z0-9_$#@~.?]*:"
+ "^\\s-*[a-zA-Z0-9_.?][a-zA-Z0-9_$#@~.?]*:?\\>"
"Regexp for `nasm-mode'.")
(defconst nasm-font-lock-keywords
`(("\\<\\.[a-zA-Z0-9_$#@~.?]+\\>" . font-lock-type-face)
- (,nasm-label-regexp . font-lock-function-name-face)
(,(regexp-opt nasm-registers 'words) . font-lock-variable-name-face)
(,(regexp-opt nasm-instructions 'words) . font-lock-keyword-face)
(,(regexp-opt nasm-prefix 'words) . font-lock-keyword-face)
(,(regexp-opt nasm-directives 'words) . font-lock-builtin-face)
- (,(regexp-opt nasm-pp-directives 'words) . font-lock-preprocessor-face))
+ (,(regexp-opt nasm-pp-directives 'words) . font-lock-preprocessor-face)
+ (,nasm-label-regexp . font-lock-function-name-face))
"Keywords for `nasm-mode'.")
(defconst nasm-mode-syntax-table
@@ -404,15 +404,20 @@
table)
"Syntax table for `nasm-mode'.")
+(defmacro nasm--opt (keywords)
+ "Prepare KEYWORDS for `looking-at'."
+ `(eval-when-compile (concat "\\s-*" (regexp-opt ,keywords t))))
+
(defun nasm-indent-line ()
"Indent current line as NASM assembly code."
(interactive)
(let ((orig (- (point-max) (point))))
(beginning-of-line)
- (if (or (looking-at (concat "\\s-*" (regexp-opt nasm-directives t)))
- (looking-at (concat "\\s-*" (regexp-opt nasm-pp-directives t)))
- (looking-at nasm-label-regexp)
- (looking-at "^\\s-*[[;]"))
+ (if (or (looking-at (nasm--opt nasm-directives))
+ (looking-at (nasm--opt nasm-pp-directives))
+ (looking-at "^\\s-*[[;]")
+ (and (looking-at nasm-label-regexp)
+ (not (looking-at (nasm--opt nasm-instructions)))))
(indent-line-to 0)
(indent-line-to nasm-basic-offset))
(when (> (- (point-max) orig) (point))
- [nongnu] elpa/nasm-mode 78818f1 39/67: Remove a few more garbage "instructions.", (continued)
- [nongnu] elpa/nasm-mode 78818f1 39/67: Remove a few more garbage "instructions.", ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 1127620 44/67: Fix breakage caused by recent regexp changes., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e7fa960 49/67: make indent-line-function local, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 7131afb 63/67: Change nasm-use-tabs to nasm-after-mnemonic-whitespace, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode c0a002b 13/67: Add minimal imenu support., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode dbfb995 17/67: Add a couple TODO items., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 4b28c7d 37/67: Update header comment., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 3047d7c 41/67: Add nasm-join-line., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode d990ed9 51/67: Bump to 1.1.1., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 63d4433 62/67: allow for customization of tabs/spaces behaviour, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 4b06918 02/67: Allow labels without colons.,
ELPA Syncer <=
- [nongnu] elpa/nasm-mode 9e8e7c9 15/67: Add constant syntax highlighting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode ac9ce5d 18/67: Require imenu (to ensure automatic buffer-local)., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode ca9d65f 26/67: Default nasm-basic-offset to tab-width., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode fa44b36 38/67: Remove some junk from nasm-instructions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 694160a 46/67: Add README note., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e8ca8b9 50/67: Make comment-start local., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 1ec7d0a 53/67: Add a LIMIT argument to looking-back call, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 9a5f989 57/67: Fix docstring indentation for nasm-font-lock-keywords, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 832caad 59/67: Make semicolons behave when typed into strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode af3d935 61/67: Allow directive names as labels (font-locking), ELPA Syncer, 2021/08/29