[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/poke-mode 3e6ac23c61 06/16: poke-mode: few improvements
From: |
ELPA Syncer |
Subject: |
[elpa] externals/poke-mode 3e6ac23c61 06/16: poke-mode: few improvements in font-lock |
Date: |
Tue, 5 Apr 2022 15:02:54 -0400 (EDT) |
branch: externals/poke-mode
commit 3e6ac23c61cf0a3a6737cfaa0b3897364bdf5838
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Commit: Jose E. Marchesi <jose.marchesi@oracle.com>
poke-mode: few improvements in font-lock
2020-11-07 Jose E. Marchesi <jemarch@gnu.org>
* etc/poke-mode.el (poke-builtin-types): Remove "offset".
(poke-type-constructor-integral): New face.
(poke-type-constructor-offset): Likewise.
(poke-declaration-name): Likewise.
(poke-font-lock-keywords): Font-lock string literals, integral
constructors, offset constructors and the names of declared
entities.
---
poke-mode.el | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/poke-mode.el b/poke-mode.el
index 7a77be4f12..0b4c561ef7 100644
--- a/poke-mode.el
+++ b/poke-mode.el
@@ -53,6 +53,14 @@
'((t (:inherit font-lock-type-face)))
"Face used to highlight builtin types.")
+(defface poke-type-constructor-integral
+ '((t (:inherit font-lock-type-face)))
+ "Face used to highlight type constructors.")
+
+(defface poke-type-constructor-offset
+ '((t (:inherit poke-unit)))
+ "Face used to highlight offset type constructors")
+
(defface poke-function
'((t (:inherit font-lock-function-name-face)))
"Face used to highlight builtin functions.")
@@ -65,6 +73,10 @@
'((t (:inherit error)))
"Face used to highlight builtin exceptions.")
+(defface poke-declaration-name
+ '((t (:inherit font-lock-variable-name-face)))
+ "Face used to highlight declaration names.")
+
;; from libpoke/pkl-lex.l
(defconst poke-keywords
'("pinned" "struct" "union" "else" "while" "until" "for" "in" "where" "if"
@@ -76,7 +88,7 @@
;; from libpoke/pkl-lex.l
;; from perl -nE 'say qq{"$1"} if /^type (\S+)/' libpoke/*.pk
(defconst poke-builtin-types
- '("string" "void" "int" "uint" "offset"
+ '("string" "void" "int" "uint"
"Exception"
"bit" "nibble" "byte" "char"
"ushort" "short"
@@ -168,12 +180,36 @@
(: "\\" (repeat 1 3 (any "01234567"))))
"'")
0 'font-lock-string-face)
+ ;; string
+ `("\"[^\"]*\"" 0 'font-lock-string-face)
+ ;; Names of declared entities
+ `(,(rx (regexp (regexp-opt '("type" "unit" "fun" "var" "method")))
+ (+ space)
+ (group (any "A-Z" "a-z" "_") (* (any "A-Z" "a-z" "_" "0-9")))
+ (+ space)
+ "=")
+ 1 'poke-declaration-name)
;; attributes
`(,(rx "'" (group (any "A-Z" "a-z" "_") (* (any "A-Z" "a-z" "0-9" "_"))))
0 'poke-attribute)
;; keywords
`(,(rx symbol-start (regexp (regexp-opt poke-keywords)) symbol-end)
0 'font-lock-keyword-face)
+ ;; offset type constructors
+ `(,(rx "offset<"
+ (* space)
+ (+ (not ","))
+ (* space)
+ ","
+ (* space)
+ (+ (any "A-Z" "a-z" "_" "0-9"))
+ (* space)
+ ">")
+ 0 'poke-type-constructor-offset)
+ ;; integral type constructors
+ `(,(rx (regexp (regexp-opt '("int" "uint"))) "<"
+ (* space) (+ (any "0-9")) (* space) ">")
+ (0 'poke-type-constructor-integral t))
;; builtin types
`(,(rx symbol-start (regexp (regexp-opt poke-builtin-types)) symbol-end)
0 'poke-type)
- [elpa] branch externals/poke-mode created (now 083a39eeb4), ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode b42c22fedd 01/16: etc/poke-mode.el: add Emacs mode for .pk files, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 8126eb0a77 02/16: etc/poke-mode.el: add experimental SMIE-based indent, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 7a05c56b44 03/16: syntax-check fixes, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 2266bd2d8f 04/16: Change keywords defFOO to FOO., ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode f83bb37aa7 08/16: poke-mode: highlight chained declaration lines with type constructors, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 66799d3eef 07/16: poke-mode: font-lock entity names in chained declarations, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 3e6ac23c61 06/16: poke-mode: few improvements in font-lock,
ELPA Syncer <=
- [elpa] externals/poke-mode d0de4cfa52 09/16: poke-mode: highlight many field names, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 0920fd9e9e 11/16: poke-mode: some SMIE attempts, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 50a37cc296 15/16: Initial commit, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 289835acc8 05/16: poke-mode: indent chained declarations properly, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode c5fa74b6cc 10/16: poke-mode: fix font lock on string literals, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 2db5ae7dc0 12/16: update copyright years, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode ec4771c083 13/16: Remove IOS_F_TRUNCATE, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 083a39eeb4 16/16: Recover the file's history from Poke's main repository, ELPA Syncer, 2022/04/05
- [elpa] externals/poke-mode 588a88c8e4 14/16: poke-mode: fix syntax of //-like comments, ELPA Syncer, 2022/04/05