FUEL: better font lock highlighting for some factor constructs

Also a fix so that ! in filter! isn't wrongly interpreted as a comment.
db4
Björn Lindqvist 2015-04-24 11:40:06 +02:00
parent bfc1bccbfd
commit b497800f03
1 changed files with 14 additions and 14 deletions

View File

@ -224,7 +224,7 @@ these lines in your .emacs:
'(":" "::" ";" "&:" "<<" "<PRIVATE" ">>" '(":" "::" ";" "&:" "<<" "<PRIVATE" ">>"
"ABOUT:" "AFTER:" "ALIAS:" "ALIEN:" "ARTICLE:" "ABOUT:" "AFTER:" "ALIAS:" "ALIEN:" "ARTICLE:"
"B" "BEFORE:" "B" "BEFORE:"
"C:" "C-GLOBAL:" "C-TYPE:" "CHAR:" "COLOR:" "COM-INTERFACE:" "CONSTANT:" "C-GLOBAL:" "C-TYPE:" "CHAR:" "COLOR:" "COM-INTERFACE:"
"CONSULT:" "call-next-method" "CONSULT:" "call-next-method"
"DEFER:" "DEFER:"
"EBNF:" ";EBNF" "ENUM:" "ERROR:" "EBNF:" ";EBNF" "ENUM:" "ERROR:"
@ -242,7 +242,7 @@ these lines in your .emacs:
"SINGLETON:" "SINGLETONS:" "SLOT:" "SPECIALIZED-ARRAY:" "SINGLETON:" "SINGLETONS:" "SLOT:" "SPECIALIZED-ARRAY:"
"SPECIALIZED-ARRAYS:" "STRING:" "SYNTAX:" "SPECIALIZED-ARRAYS:" "STRING:" "SYNTAX:"
"TYPEDEF:" "TYPED:" "TYPED::" "TYPEDEF:" "TYPED:" "TYPED::"
"UNIFORM-TUPLE:" "UNION:" "USE:" "UNIFORM-TUPLE:" "USE:"
"VARIANT:" "VERTEX-FORMAT:")) "VARIANT:" "VERTEX-FORMAT:"))
(defconst factor-parsing-words-regex (defconst factor-parsing-words-regex
@ -255,7 +255,7 @@ these lines in your .emacs:
(regexp-opt factor-constant-words 'symbols)) (regexp-opt factor-constant-words 'symbols))
(defconst factor-bracer-words (defconst factor-bracer-words
'("B" "BV" "C" "CS" "H" "T" "V" "W")) '("B" "BV" "C" "CS" "H" "HS" "T" "V" "W"))
(defconst factor-brace-words-regex (defconst factor-brace-words-regex
(format "%s{" (regexp-opt factor-bracer-words t))) (format "%s{" (regexp-opt factor-bracer-words t)))
@ -323,7 +323,7 @@ these lines in your .emacs:
(defconst factor-symbol-definition-regex (defconst factor-symbol-definition-regex
(factor-second-word-regex (factor-second-word-regex
'("&:" "CONSTANT:" "DESTRUCTOR:" "FORGET:" "HELP:" "LIBRARY:" '("&:" "CONSTANT:" "DESTRUCTOR:" "FORGET:" "HELP:" "LIBRARY:"
"SYMBOL:" "VAR:"))) "STRING:" "SYMBOL:" "VAR:")))
(defconst factor-symbols-lines-regex "^\\(SYMBOLS\\):[ \n]+\\([^;\t]*\\);") (defconst factor-symbols-lines-regex "^\\(SYMBOLS\\):[ \n]+\\([^;\t]*\\);")
@ -333,7 +333,7 @@ these lines in your .emacs:
(defconst factor-type-definition-regex (defconst factor-type-definition-regex
(factor-second-word-regex (factor-second-word-regex
'("C-STRUCT:" "C-UNION:" "COM-INTERFACE:" "MIXIN:" "SINGLETON:" '("C-STRUCT:" "C-UNION:" "COM-INTERFACE:" "MIXIN:" "SINGLETON:"
"SPECIALIZED-ARRAY:" "STRUCT:" "UNION:" "UNION-STRUCT:"))) "SPECIALIZED-ARRAY:" "STRUCT:" "UNION-STRUCT:")))
(defconst factor-error-regex (defconst factor-error-regex
(factor-second-word-regex '("ERROR:"))) (factor-second-word-regex '("ERROR:")))
@ -391,7 +391,7 @@ these lines in your .emacs:
(defconst factor-single-liner-regex (defconst factor-single-liner-regex
(regexp-opt '("ABOUT:" (regexp-opt '("ABOUT:"
"ALIAS:" "ALIAS:"
"CONSTANT:" "C:" "C-GLOBAL:" "C-TYPE:" "CONSTANT:" "C-GLOBAL:" "C-TYPE:"
"DEFER:" "DESTRUCTOR:" "DEFER:" "DESTRUCTOR:"
"FORGET:" "FORGET:"
"GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:" "GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:"
@ -429,7 +429,7 @@ these lines in your .emacs:
"M[^:]*: [^ ]+ [^ ]+")) "M[^:]*: [^ ]+ [^ ]+"))
(defconst factor-constructor-decl-regex (defconst factor-constructor-decl-regex
"\\_<C: +\\(\\w+\\) +\\(\\w+\\)\\( .*\\)?$") "\\_<\\(C:\\)[ \n]+\\([^ ]+\\)[ \n]+\\([^ ]+\\)")
(defconst factor-typedef-regex (defconst factor-typedef-regex
(format "\\_<TYPEDEF: +%s +%s\\( .*\\)?$" symbol symbol)) (format "\\_<TYPEDEF: +%s +%s\\( .*\\)?$" symbol symbol))
@ -459,9 +459,10 @@ these lines in your .emacs:
(2 'factor-font-lock-vocabulary-name) (2 'factor-font-lock-vocabulary-name)
(3 'factor-font-lock-word)) (3 'factor-font-lock-word))
(,factor-constructor-decl-regex (,factor-constructor-decl-regex
(1 'factor-font-lock-word) (1 'factor-font-lock-parsing-word)
(2 'factor-font-lock-type-name) (2 'factor-font-lock-word)
(3 'factor-font-lock-invalid-syntax nil t)) (3 'factor-font-lock-type-name))
(,"\\(^\\| \\|\t\\)\\(![^\n]+\\)\n" 2 'factor-font-lock-comment)
(,factor-typedef-regex (1 'factor-font-lock-type-name) (,factor-typedef-regex (1 'factor-font-lock-type-name)
(2 'factor-font-lock-type-name) (2 'factor-font-lock-type-name)
(3 'factor-font-lock-invalid-syntax nil t)) (3 'factor-font-lock-invalid-syntax nil t))
@ -498,8 +499,8 @@ these lines in your .emacs:
;; that are slot names which are highlighted with the face ;; that are slot names which are highlighted with the face
;; factor-font-lock-symbol. ;; factor-font-lock-symbol.
(,(format (,(format
"\\(%s\\):[ \n]+%s\\(?:[ \n]+<[ \n]+%s\\)?" "\\(%s:\\)[ \n]+%s\\(?:[ \n]+<[ \n]+%s\\)?"
(regexp-opt '("ENUM" "PROTOCOL" "STRUCT" "TUPLE" "UNION-STRUCT")) (regexp-opt '("ENUM" "PROTOCOL" "STRUCT" "TUPLE" "UNION" "UNION-STRUCT"))
symbol symbol
symbol) symbol)
(1 'factor-font-lock-parsing-word) (1 'factor-font-lock-parsing-word)
@ -880,9 +881,8 @@ With prefix, non-existing files will be created."
(defvar factor-mode-syntax-table (defvar factor-mode-syntax-table
(let ((table (make-syntax-table prog-mode-syntax-table))) (let ((table (make-syntax-table prog-mode-syntax-table)))
(modify-syntax-entry ?\" "\"" table) (modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?! "< 2b" table)
(modify-syntax-entry ?\n "> b" table)
(modify-syntax-entry ?# "_ 1b" table) (modify-syntax-entry ?# "_ 1b" table)
(modify-syntax-entry ?! "_" table)
(modify-syntax-entry ?$ "_" table) (modify-syntax-entry ?$ "_" table)
(modify-syntax-entry ?@ "_" table) (modify-syntax-entry ?@ "_" table)
(modify-syntax-entry ?? "_" table) (modify-syntax-entry ?? "_" table)