[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode f3690a05d5 122/253: Fix highlighting of empty co
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode f3690a05d5 122/253: Fix highlighting of empty comment lines |
Date: |
Sat, 29 Jan 2022 08:28:47 -0500 (EST) |
branch: elpa/raku-mode
commit f3690a05d53fc82146bc286ebcafdd586e4dbc4d
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Fix highlighting of empty comment lines
---
perl6-font-lock.el | 67 ++++++++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 37 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index a748f60ff0..3f2dc59d82 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -287,19 +287,12 @@
(modify-syntax-entry ?> ")<" table)
(modify-syntax-entry ?« "(»" table)
(modify-syntax-entry ?» ")«" table)
- table)
- "Syntax table for bracketing constructs.")
-
-(defconst perl6-string-delimiter-syntax-table
- (let ((table (make-syntax-table perl6-mode-syntax-table)))
(modify-syntax-entry ?‘ "(’" table)
(modify-syntax-entry ?’ ")‘" table)
- (modify-syntax-entry ?「 "(」" table)
- (modify-syntax-entry ?」 ")「" table)
(modify-syntax-entry ?“ "(”" table)
(modify-syntax-entry ?” ")“" table)
table)
- "Syntax table for string delimiters.")
+ "Syntax table for bracketing constructs.")
(defun perl6-syntax-context (&optional state)
"Return the syntactic context at the parse state of STATE.
@@ -346,35 +339,35 @@ SYNTAX is the type of syntax to apply to the delimiters
\(such as \"!\"\).
OFFSET can be used to shift the starting position (relative to point) of the
opening delimiter."
- (when (and (following-char)
- (eq ?\( (char-syntax (following-char))))
- (let* ((delim-beg (+ (point) (or offset 0)))
- (open-delim (following-char))
- (close-delim (matching-paren open-delim)))
- (put-text-property delim-beg (1+ delim-beg)
- 'syntax-table (string-to-syntax syntax))
- (re-search-forward (rx-to-string `(1+ ,open-delim)))
- (let ((delim-length (length (match-string 0))))
- (perl6-forward-brackets open-delim close-delim delim-length)
- (let ((delim-end (point)))
- (put-text-property delim-beg delim-end 'syntax-multiline t)
- (put-text-property (- delim-end 1) delim-end
- 'syntax-table (string-to-syntax syntax)))))))
+ (with-syntax-table perl6-bracket-syntax-table
+ (when (and (following-char)
+ (eq ?\( (char-syntax (following-char))))
+ (let* ((delim-beg (+ (point) (or offset 0)))
+ (open-delim (following-char))
+ (close-delim (matching-paren open-delim)))
+ (put-text-property delim-beg (1+ delim-beg)
+ 'syntax-table (string-to-syntax syntax))
+ (re-search-forward (rx-to-string `(1+ ,open-delim)))
+ (let ((delim-length (length (match-string 0))))
+ (perl6-forward-brackets open-delim close-delim delim-length)
+ (let ((delim-end (point)))
+ (put-text-property delim-beg delim-end 'syntax-multiline t)
+ (put-text-property (- delim-end 1) delim-end
+ 'syntax-table (string-to-syntax syntax)))))
+ t)))
(defun perl6-syntax-propertize-comment (limit)
"Add syntax properties to comments."
- (with-syntax-table perl6-bracket-syntax-table
- (let ((comment-start (1- (point))))
- (if (and (re-search-forward "\\=[`|=]" (1+ (point)) 'noerror)
- (eq ?\( (char-syntax (following-char))))
- ;; embedded/multiline comment
- (perl6-syntax-propertize-delimiters "!" -2)
- ;; single-line comment
- (put-text-property comment-start (1+ comment-start)
- 'syntax-table (string-to-syntax "<"))
- (if (re-search-forward "\n" limit 'noerror)
- (put-text-property (1- (point)) (point)
- 'syntax-table (string-to-syntax ">")))))))
+ (unless (save-excursion
+ (and (re-search-forward "\\=[`|=]" (1+ (point)) t)
+ ;; embedded/multiline comment
+ (perl6-syntax-propertize-delimiters "!" -2)))
+ ;; single-line comment
+ (put-text-property (1- (point)) (point)
+ 'syntax-table (string-to-syntax "<"))
+ (if (re-search-forward "\n" limit 'noerror)
+ (put-text-property (1- (point)) (point)
+ 'syntax-table (string-to-syntax ">")))))
(defun perl6-syntax-propertize-angles (open-angles)
"Add syntax properties to angle-bracketed quotes (e.g. <foo> and «bar»).
@@ -451,9 +444,9 @@ Takes arguments START and END which delimit the region to
propertize."
(0 (ignore (perl6-syntax-propertize-backslash))))
;; unicode string quotes
((rx (any "‘「“"))
- (0 (ignore (progn (backward-char)
- (with-syntax-table perl6-string-delimiter-syntax-table
- (perl6-syntax-propertize-delimiters "|"))))))
+ (0 (ignore (when (eq (perl6-syntax-context) nil)
+ (backward-char)
+ (perl6-syntax-propertize-delimiters "|")))))
;; sigils and twigils are prefix characters
((perl6-rx variable)
(1 ".p")
- [nongnu] elpa/raku-mode ec9d721334 024/253: Simpler approach for double-quote-words, (continued)
- [nongnu] elpa/raku-mode ec9d721334 024/253: Simpler approach for double-quote-words, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 6e8b0fd8c4 032/253: Highlight "rule q {}" correctly, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode fbe23fa55d 014/253: Require whitespace after (my|our), ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 4556ff4e9b 038/253: Support non-ASCII identifiers, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode a349f9a7ff 076/253: Also highlight labels after loop control statements, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 1eaa1452bc 067/253: More robust highlighting of set operators, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 9339de70ac 074/253: Highlight labels, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode f376ce3cfa 035/253: Add MELPA badge, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode d017e51bd4 062/253: Set 'face property, not 'font-lock-face, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode bb9f553d91 079/253: Highlight solitary colon (:) operator, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode f3690a05d5 122/253: Fix highlighting of empty comment lines,
ELPA Syncer <=
- [nongnu] elpa/raku-mode e11d5b76fe 104/253: Remove superfluous space from syntax descriptor, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 456d718152 116/253: Add comments to perl6-font-lock-keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 564cbfa7a2 119/253: Remove unnecessary 'let', ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode b6410f9d4c 126/253: Fix highlighting of ::foo, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 60966ea875 133/253: Highlight function composition operator, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 601f37ef15 136/253: Bool type was added., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 72f21d4a91 171/253: Just forcing reload to use change in cask, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode e5ab8b0589 175/253: Reverting to original cask, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode cc28223bb7 182/253: add new name categories and other improvements, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 748d07ab7c 188/253: Add repl to perl6 major mode, ELPA Syncer, 2022/01/29