[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode c0b40f2ad5 140/253: Correctly highlight custom s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode c0b40f2ad5 140/253: Correctly highlight custom sub/grammar/etc names that clash with keywords |
Date: |
Sat, 29 Jan 2022 08:28:49 -0500 (EST) |
branch: elpa/raku-mode
commit c0b40f2ad5c2c31a0cb0e7535d7ff1a4c04f9780
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Correctly highlight custom sub/grammar/etc names that clash with keywords
---
perl6-font-lock.el | 63 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 22 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 0f77f6dec0..94c8da5dcf 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -42,12 +42,8 @@
"Face for exception keywords in Perl 6."
:group 'perl6-faces)
-(defface perl6-module '((t :inherit font-lock-keyword-face))
- "Face for module keywords in Perl 6."
- :group 'perl6-faces)
-
-(defface perl6-routine '((t :inherit font-lock-keyword-face))
- "Face for routine keywords in Perl 6."
+(defface perl6-declare '((t :inherit font-lock-keyword-face))
+ "Face for declaration keywords in Perl 6."
:group 'perl6-faces)
(defface perl6-include '((t :inherit font-lock-keyword-face))
@@ -153,12 +149,12 @@
(and (regex "[^[:digit:]\[\{\('\",:[:space:]]")
(0+ (regex "[^\[\{\('\",:[:space:]]"))
(or "«" "<<")))))
- (routine
- . ,(rx (or "macro" "sub" "submethod" "method" "multi" "proto" "only"
- "category")))
- (module
- . ,(rx (or "module" "class" "role" "package" "enum" "grammar" "slang"
- "subset")))
+ (pre-declare
+ . ,(rx (or "multi" "proto" "only")))
+ (declare
+ . ,(rx (or "macro" "sub" "submethod" "method" "category"
+ "module" "class" "role" "package" "enum" "grammar"
+ "slang" "subset")))
(rule . ,(rx (or "regex" "rule" "token")))
(include . ,(rx (or "use" "require unit")))
(conditional . ,(rx (or "if" "else" "elsif" "unless")))
@@ -568,12 +564,20 @@ LIMIT can be used to bound the search."
(,(perl6-rx (group (symbol identifier)) (1+ space) (group "=>"))
(1 'perl6-string)
(2 'perl6-operator))
- ;; regex/rule/token keywords
- (,(perl6-rx symbol-start rule)
- (0 'perl6-routine)
- ;; anything immediately following it (even Q) is just an identifier
- (,(perl6-rx (1+ space) (group identifier))
- nil nil (1 'perl6-identifier)))
+ ;; "proto foo", "proto sub foo", etc
+ (,(perl6-rx symbol-start
+ (group pre-declare)
+ (opt (1+ space) (group declare))
+ (opt (1+ space) (group identifier)))
+ (1 'perl6-declare)
+ (2 'perl6-declare nil t)
+ (3 'perl6-identifier nil t))
+ ;; "sub foo"
+ (,(perl6-rx symbol-start
+ (group declare)
+ (opt (1+ space) (group identifier)))
+ (1 'perl6-declare)
+ (2 'perl6-identifier nil t))
;; high-level types (Scalar, Class, Str, etc)
(,(perl6-rx (group symbol-start high-type) "(") 1 'perl6-type)
;; anything preceding an open-paren is just an identifier
@@ -596,20 +600,35 @@ LIMIT can be used to bound the search."
(,(perl6-rx (symbol phaser)) 0 'perl6-phaser)
;; die, fail, try...
(,(perl6-rx (symbol exception)) 0 'perl6-exception)
- ;; module, class, role...
- (,(perl6-rx (symbol module)) 0 'perl6-module)
;; let, my, our...
(,(perl6-rx (symbol scope)) 0 'perl6-scope)
;; if, else, elsif...
(,(perl6-rx (symbol conditional)) 0 'perl6-conditional)
- ;; macro, sub, method...
- (,(perl6-rx (symbol routine)) 0 'perl6-routine)
;; use, require...
(,(perl6-rx (symbol include)) 0 'perl6-include)
;; for, loop, repeat...
(,(perl6-rx (symbol loop)) 0 'perl6-loop)
;; take, do, when...
(,(perl6-rx (symbol flow-control)) 0 'perl6-flow-control)
+ ;;(,(perl6-rx symbol-start
+ ;; (opt (group pre-declare) (1+ space))
+ ;; (group declare)
+ ;; (opt (1+ space) (group identifier)))
+ ;; (0 'perl6-declare nil t)
+ ;; (1 'perl6-declare)
+ ;; (2 'perl6-identifier nil t))
+ ;;(,(perl6-rx symbol-start (group pre-declare) (opt (1+ space) (group
identifier)))
+ ;; (0 'perl6-declare)
+ ;; (1 'perl6-identifier nil t))
+
+ ;;(,(perl6-rx symbol-start pre-declare)
+ ;; (0 'perl6-declare)
+ ;; (,(perl6-rx (1+ space) (group declare))
+ ;; nil nil
+ ;; (1 'perl6-declare))
+ ;; (,(perl6-rx (1+ space) (group identifier))
+ ;; nil nil
+ ;; (1 'perl6-identifier)))
;; oo, fatal...
(,(perl6-rx (symbol pragma)) 0 'perl6-pragma)
;; special numbers
- [nongnu] elpa/raku-mode 1d2f63b715 083/253: Highlight [RSXZ] on their own, (continued)
- [nongnu] elpa/raku-mode 1d2f63b715 083/253: Highlight [RSXZ] on their own, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 7e60f137ce 095/253: Fix highlighting of some reduce ops, like [<], ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode c91c403320 123/253: Fix highlighting of infix:<<lt>> and friends, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 155abadb6a 124/253: Improve highlighting of numbers, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 1277ec749e 097/253: Fix highlighting of words in identifers, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode d8c1ae4d87 089/253: Move context-checking into a function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode c5f3d072e5 120/253: Don't highlight string delimiters inside comments, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 19f4243934 125/253: Remove unnecessary check for syntactic context, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 6c97f87fd8 135/253: Correctly highlight ::*Foo::Bar, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 309720c98a 148/253: correct indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode c0b40f2ad5 140/253: Correctly highlight custom sub/grammar/etc names that clash with keywords,
ELPA Syncer <=
- [nongnu] elpa/raku-mode 89d6145859 149/253: use proper name for a multi sub or method, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode a594f53e09 141/253: Highlight with/orwith/without, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode a0cd586520 170/253: Following this advice http://stackoverflow.com/questions/26108655/error-updating-emacs-packages-failed-to-download-gnu-archive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 4a018be623 172/253: Adds BagHash to check again, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 992d8af9de 164/253: add test for private methods, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 27b90214e3 211/253: Auto insert skeletons., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 04f458529e 206/253: Rename perl6 -> raku in test files, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode ed816f0ce3 214/253: Add a new item, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 0968a528bb 216/253: Fix wrong slashes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 21af6e8398 224/253: Add comment-style highlighting to POD., ELPA Syncer, 2022/01/29