From 4f698db8fc4c54c6683eb7931e12f321e66ea368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 4 Dec 2015 12:43:01 +0100 Subject: [PATCH] FUEL: slightly improved font-locking for alien functions and aliases --- misc/fuel/factor-mode.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/misc/fuel/factor-mode.el b/misc/fuel/factor-mode.el index ce7f099cf8..cd79c8162c 100644 --- a/misc/fuel/factor-mode.el +++ b/misc/fuel/factor-mode.el @@ -220,19 +220,18 @@ these lines in your .emacs: "B" "COLOR:" "CONSULT:" "call-next-method" - "EBNF:" ";EBNF" "ENUM:" "ERROR:" + "EBNF:" ";EBNF" "FOREIGN-ATOMIC-TYPE:" "FOREIGN-ENUM-TYPE:" "FOREIGN-RECORD-TYPE:" "FUNCTION-ALIAS:" "GIR:" "GLSL-SHADER:" "GLSL-PROGRAM:" "HINTS:" "initial:" "INTERSECTION:" "IMPLEMENT-STRUCTS:" - "MACRO:" "MACRO::" "MATH:" + "MATH:" "METHOD:" "PRIVATE>" "PROTOCOL:" "PROVIDE:" "read-only" "REQUIRE:" "REQUIRES:" "SLOT:" "SPECIALIZED-ARRAYS:" "STRING:" "SYNTAX:" - "TYPED:" "TYPED::" "UNIFORM-TUPLE:" "VARIANT:" "VERTEX-FORMAT:")) @@ -246,7 +245,7 @@ these lines in your .emacs: (regexp-opt factor-constant-words 'symbols)) (defconst factor-bracer-words - '("B" "BV" "C" "CS" "H" "HS" "T" "V" "W")) + '("B" "BV" "C" "CS" "H" "HS" "S" "T" "V" "W")) (defconst factor-brace-words-regex (format "%s{" (regexp-opt factor-bracer-words t))) @@ -343,7 +342,7 @@ these lines in your .emacs: "FROM" "FUNCTION:" "FUNCTION-ALIAS:" "INTERSECTION:" "M" "M:" "MACRO" "MACRO:" - "MEMO" "MEMO:" "METHOD" + "MAIN-WINDOW:" "MEMO" "MEMO:" "METHOD" "SYNTAX" "PREDICATE" "PRIMITIVE" "PROTOCOL" "SINGLETONS" @@ -421,6 +420,17 @@ these lines in your .emacs: (defconst factor-predicate-regex (concat (syntax-begin '("PREDICATE")) ws+ symbol ws+ "\\(<\\)" ws+ symbol)) +(defconst factor-alien-function-regex + (concat (syntax-begin '("GL-FUNCTION" "FUNCTION" "GL-CALLBACK" "CALLBACK")) + ws+ symbol + ws+ symbol ws+)) + +(defconst factor-function-alias-regex + (concat (syntax-begin '("FUNCTION-ALIAS")) + ws+ symbol + ws+ symbol + ws+ symbol ws+)) + (defconst factor-group-name-to-face #s(hash-table test equal data ("C" 'factor-font-lock-comment @@ -505,7 +515,7 @@ these lines in your .emacs: ,(factor-syntax factor-predicate-regex '("P" "T" "P" "T")) ;; Highlights alien function definitions. Types in stack effect ;; declarations are given a bold face. - (,(format "\\(\\(?:GL-\\)?FUNCTION\\|CALLBACK\\):[ \n]+%s[ \n]+%s[ \n]+" symbol symbol) + (,factor-alien-function-regex (1 'factor-font-lock-parsing-word) (2 'factor-font-lock-type-name) (3 'factor-font-lock-word) @@ -519,8 +529,7 @@ these lines in your .emacs: (3 'factor-font-lock-stack-effect nil t))) ;; Almost identical to the previous one, but for function aliases. - (,(format "\\(FUNCTION-ALIAS\\):[ \n]+%s[ \n]+%s[ \n]+%s[ \n]+" - symbol symbol symbol) + (,factor-function-alias-regex (1 'factor-font-lock-parsing-word) (2 'factor-font-lock-word) (3 'factor-font-lock-type-name)