[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dart-mode 40f6741 150/192: Fontifies more keywords, builti
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dart-mode 40f6741 150/192: Fontifies more keywords, builtins, constants and types |
Date: |
Sun, 29 Aug 2021 11:02:07 -0400 (EDT) |
branch: elpa/dart-mode
commit 40f67413b21e8abbe3555a30000211356c51ba7e
Author: Brady Trainor <mail@bradyt.com>
Commit: Brady Trainor <mail@bradyt.com>
Fontifies more keywords, builtins, constants and types
- Adds: bool
- Changes font-lock face of: dynamic, false, null, true, void
- Removes typo: string
- Fixes regex for: numbers
- Adds regex for: async keywords, hex numbers, metadata/annotations,
upper camel case (types)
---
dart-mode.el | 65 ++++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 50 insertions(+), 15 deletions(-)
diff --git a/dart-mode.el b/dart-mode.el
index b8b0829..575f95e 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -365,23 +365,58 @@ Returns nil if `dart-sdk-path' is nil."
(setq dart--keywords
;; ECMA 408; Section: Reserved Words
'("assert" "break" "case" "catch" "class" "const" "continue"
- "default" "do" "else" "enum" "extends" "false" "final"
- "finally" "for" "if" "in" "is" "new" "null" "rethrow" "return"
- "super" "switch" "this" "throw" "true" "try" "var" "void"
- "while" "with"))
-
-(setq dart--types '("double" "int" "num" "string"))
-
-(setq dart--number-re
- (rx (and symbol-start
- (one-or-more digit)
- (zero-or-one (and "." (one-or-more digit))))))
+ "default" "do" "else" "enum" "extends" "final" "finally" "for"
+ "if" "in" "is" "new" "rethrow" "return" "super" "switch"
+ "this" "throw" "try" "var" "while" "with"))
+
+(setq dart--types '("bool" "double" "dynamic" "int" "num" "void"))
+
+(setq dart--constants '("false" "null" "true"))
+
+(setq dart--async-keywords-re (rx word-start
+ (or "async" "await" "sync" "yield")
+ word-end
+ (zero-or-one ?*)))
+
+(setq dart--number-re (rx symbol-start
+ (zero-or-one ?-)
+ (group (or (and (one-or-more digit)
+ (zero-or-one
+ (and ?. (one-or-more digit))))
+ (and ?. (one-or-more digit)))
+ (zero-or-one (and (or ?e ?E)
+ (zero-or-one (or ?+ ?-))
+ (one-or-more digit))))))
+
+(setq dart--hex-number-re (rx symbol-start
+ (zero-or-one ?-)
+ (group (or "0x" "0X")
+ (one-or-more (any (?a . ?f)
+ (?A . ?F)
+ digit)))))
+
+(defun dart--identifier (&optional case)
+ `(and (zero-or-one (or ?$ ?_))
+ bow
+ ,(if case
+ case
+ 'alnum)
+ (zero-or-more (or ?$ ?_ alnum))))
+
+(setq dart--metadata-re (rx ?@ (eval (dart--identifier))))
+
+(setq dart--types-re (rx (eval (dart--identifier 'upper))))
(setq dart-font-lock-defaults
- `((,(regexp-opt dart--keywords 'words)
- (,(regexp-opt dart--builtins 'words) . font-lock-builtin-face)
- (,dart--number-re . font-lock-constant-face)
- (,(regexp-opt dart--types 'words) . font-lock-type-face))))
+ `((,dart--async-keywords-re
+ ,(regexp-opt dart--keywords 'words)
+ (,(regexp-opt dart--builtins 'words) . font-lock-builtin-face)
+ (,(regexp-opt dart--constants 'words) . font-lock-constant-face)
+ (,dart--hex-number-re . (1 font-lock-constant-face))
+ (,dart--number-re . (1 font-lock-constant-face))
+ (,dart--metadata-re . font-lock-constant-face)
+ (,(regexp-opt dart--types 'words) . font-lock-type-face)
+ (,dart--types-re . font-lock-type-face))))
(defun dart-fontify-region (beg end)
"Use fontify the region between BEG and END as Dart.
- [nongnu] elpa/dart-mode ac14859 147/192: Normalize paths for dartanalyzer on Windows, (continued)
- [nongnu] elpa/dart-mode ac14859 147/192: Normalize paths for dartanalyzer on Windows, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 9d72469 169/192: Don't set variables globally, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 591b6fe 170/192: Improve handling of strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f20f895 164/192: Move docs from README to Wiki, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 36fe2ce 166/192: Fontify identifiers after multi-nested types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 57767bb 157/192: Makes current indentation logic more usable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 90f1120 162/192: Require subr-x for string-empty-p, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 8983e17 186/192: Code in font-lock tests were copied from dart.dev site, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 07a9e76 189/192: Add failing font-lock test, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 3c089f3 183/192: Fix font lock for abstract method, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 40f6741 150/192: Fontifies more keywords, builtins, constants and types,
ELPA Syncer <=
- [nongnu] elpa/dart-mode d5776f1 172/192: Fixes fontification of small strings containing only backslashes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 5989dca 180/192: Fontify operator declaration, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1c2cbe5 179/192: Add faceup tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 04fcd64 190/192: Treat angle brackets as puncutation syntax instead of symbol syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode e41f41e 174/192: Fontify untyped parameters in anonymous functions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 43975c9 192/192: Add syntax highlighting for keywords extension, late, required, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode ed80bc8 002/192: Set a bunch of CC-mode configuration vars., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 64eb399 003/192: Fix array literal indentation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 91cc86c 005/192: Make "var" a typeless decl keyword., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 8098454 006/192: Initialize the syntax table., ELPA Syncer, 2021/08/29