From 194d0cec41c35b049c150849c50e32c027a099ed Mon Sep 17 00:00:00 2001 From: "Jose A. Ortega Ruiz" Date: Thu, 18 Dec 2008 12:11:59 +0100 Subject: [PATCH] FUEL: Font lock for getters/setters fixed, with faces for both. --- misc/fuel/factor-mode.el | 17 ----------------- misc/fuel/fuel-font-lock.el | 20 ++++++++++++++++++-- misc/fuel/fuel-syntax.el | 6 ++++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/misc/fuel/factor-mode.el b/misc/fuel/factor-mode.el index 8cf578f090..2f6eef4f65 100644 --- a/misc/fuel/factor-mode.el +++ b/misc/fuel/factor-mode.el @@ -59,23 +59,6 @@ code in the buffer." :type 'hook :group 'factor-mode) - -;;; Faces: - -(fuel-font-lock--define-faces - factor-font-lock font-lock factor-mode - ((comment comment "comments") - (constructor type "constructors ()") - (declaration keyword "declaration words") - (parsing-word keyword "parsing words") - (setter-word function-name "setter words (>>foo)") - (stack-effect comment "stack effect specifications") - (string string "strings") - (symbol variable-name "name of symbol being defined") - (type-name type "type names") - (vocabulary-name constant "vocabulary names") - (word function-name "word, generic or method being defined"))) - ;;; Syntax table: diff --git a/misc/fuel/fuel-font-lock.el b/misc/fuel/fuel-font-lock.el index ba2a499b4b..616bff2def 100644 --- a/misc/fuel/fuel-font-lock.el +++ b/misc/fuel/fuel-font-lock.el @@ -13,8 +13,8 @@ ;;; Code: -(require 'fuel-base) (require 'fuel-syntax) +(require 'fuel-base) (require 'font-lock) @@ -39,6 +39,21 @@ ',faces))) (,setup)))) +(fuel-font-lock--define-faces + factor-font-lock font-lock factor-mode + ((comment comment "comments") + (constructor type "constructors ()") + (declaration keyword "declaration words") + (parsing-word keyword "parsing words") + (setter-word function-name "setter words (>>foo)") + (getter-word function-name "getter words (foo>>)") + (stack-effect comment "stack effect specifications") + (string string "strings") + (symbol variable-name "name of symbol being defined") + (type-name type "type names") + (vocabulary-name constant "vocabulary names") + (word function-name "word, generic or method being defined"))) + ;;; Font lock: @@ -59,7 +74,8 @@ (2 'factor-font-lock-word)) (,fuel-syntax--parent-type-regex 1 'factor-font-lock-type-name) (,fuel-syntax--constructor-regex . 'factor-font-lock-constructor) - (,fuel-syntax--setter-regex . 'factor-font-lock-setter-word) + (,fuel-syntax--setter-regex 2 'factor-font-lock-setter-word) + (,fuel-syntax--getter-regex 2 'factor-font-lock-getter-word) (,fuel-syntax--symbol-definition-regex 2 'factor-font-lock-symbol) (,fuel-syntax--use-line-regex 1 'factor-font-lock-vocabulary-name)) "Font lock keywords definition for Factor mode.") diff --git a/misc/fuel/fuel-syntax.el b/misc/fuel/fuel-syntax.el index 7785c043df..e810772bd0 100644 --- a/misc/fuel/fuel-syntax.el +++ b/misc/fuel/fuel-syntax.el @@ -64,7 +64,8 @@ '("flushable" "foldable" "inline" "parsing" "recursive")) (defconst fuel-syntax--declaration-words-regex - (regexp-opt fuel-syntax--declaration-words 'words)) + (format "%s\\($\\| \\)" + (regexp-opt fuel-syntax--declaration-words 'words))) (defsubst fuel-syntax--second-word-regex (prefixes) (format "^%s +\\([^ \r\n]+\\)" (regexp-opt prefixes t))) @@ -82,7 +83,8 @@ (defconst fuel-syntax--constructor-regex "<[^ >]+>") -(defconst fuel-syntax--setter-regex "\\W>>[^ ]+\\b") +(defconst fuel-syntax--getter-regex "\\( \\|^\\)\\([^ ]+>>\\)\\( \\|$\\)") +(defconst fuel-syntax--setter-regex "\\( \\|^\\)\\(>>[^ ]+\\)\\( \\|$\\)") (defconst fuel-syntax--symbol-definition-regex (fuel-syntax--second-word-regex '("SYMBOL:" "VAR:")))