branch: externals/a68-mode commit aecded089c066d689c0e3dac771d38ef519c409d Author: Jose E. Marchesi <jose.march...@oracle.com> Commit: Jose E. Marchesi <jose.march...@oracle.com>
Support for highlighting bits denotations --- a68-mode.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/a68-mode.el b/a68-mode.el index 0a8b2694c2..99da435567 100644 --- a/a68-mode.el +++ b/a68-mode.el @@ -73,7 +73,13 @@ :safe #'integerp) (defface a68-string-break-face '((t :inherit font-lock-string-face)) - "Face for printing Algol 64 string breaks.") + "Face for printing Algol 68 string breaks.") + +(defface a68-bits-radix-face '((t :weight bold)) + "Face for printing the radix of Algol 68 bits denotations.") + +(defface a68-bits-flip-face '((t :weight bold)) + "Face for printing set bits in binary Algol 68 bits denotations.") (defvar a68-mode-map (let ((map (make-sparse-keymap))) @@ -226,6 +232,11 @@ (defconst a68-font-lock-keywords-common (list + ;; Radix in bit denotations. + '("\\(\\(8\\|16\\|10\\)r\\)[ \t]*[0-9a-f]+" 1 ''a68-bits-radix-face) + ;; Binary bit denotations also highlight set bits. + '("\\<\\(2r\\)[ \t]*[01]+" (1 ''a68-bits-radix-face) + ("1" (re-search-backward "2r" nil t) nil (0 ''a68-bits-flip-face))) ;; String breaks. Apostrophe is not (currently) a worthy character ;; out of strings, so for now we can just match it anywhere. '(a68--string-break-matcher 0 ''a68-string-break-face t)