FUEL: Correct font-lock for string literals (no multiline).

db4
Jose A. Ortega Ruiz 2009-01-13 01:44:22 +01:00
parent 104b052e7e
commit a70018bcc4
2 changed files with 10 additions and 5 deletions

View File

@ -66,7 +66,8 @@
(symbol variable-name "name of symbol being defined") (symbol variable-name "name of symbol being defined")
(type-name type "type names") (type-name type "type names")
(vocabulary-name constant "vocabulary names") (vocabulary-name constant "vocabulary names")
(word function-name "word, generic or method being defined"))) (word function-name "word, generic or method being defined")
(invalid-syntax warning "syntactically invalid constructs")))
;;; Font lock: ;;; Font lock:
@ -92,8 +93,8 @@
(,fuel-syntax--constructor-regex . 'factor-font-lock-constructor) (,fuel-syntax--constructor-regex . 'factor-font-lock-constructor)
(,fuel-syntax--setter-regex . 'factor-font-lock-setter-word) (,fuel-syntax--setter-regex . 'factor-font-lock-setter-word)
(,fuel-syntax--getter-regex . 'factor-font-lock-getter-word) (,fuel-syntax--getter-regex . 'factor-font-lock-getter-word)
(,fuel-syntax--symbol-definition-regex 2 'factor-font-lock-symbol)) (,fuel-syntax--symbol-definition-regex 2 'factor-font-lock-symbol)
"Font lock keywords definition for Factor mode.") (,fuel-syntax--bad-string-regex . 'factor-font-lock-invalid-syntax)))
(defun fuel-font-lock--font-lock-setup (&optional keywords no-syntax) (defun fuel-font-lock--font-lock-setup (&optional keywords no-syntax)
(set (make-local-variable 'comment-start) "! ") (set (make-local-variable 'comment-start) "! ")

View File

@ -93,6 +93,9 @@
(defconst fuel-syntax--float-regex (defconst fuel-syntax--float-regex
"\\_<-?[0-9]+\\.[0-9]*\\([eE][+-]?[0-9]+\\)?\\_>") "\\_<-?[0-9]+\\.[0-9]*\\([eE][+-]?[0-9]+\\)?\\_>")
(defconst fuel-syntax--bad-string-regex
"\"[^\"]*$")
(defconst fuel-syntax--word-definition-regex (defconst fuel-syntax--word-definition-regex
(fuel-syntax--second-word-regex (fuel-syntax--second-word-regex
'(":" "::" "GENERIC:" "DEFER:" "HOOK:" "MAIN:" "MATH:" "POSTPONE:" '(":" "::" "GENERIC:" "DEFER:" "HOOK:" "MAIN:" "MATH:" "POSTPONE:"
@ -211,8 +214,7 @@
(modify-syntax-entry ?\ " " table) (modify-syntax-entry ?\ " " table)
(modify-syntax-entry ?\n " " table) (modify-syntax-entry ?\n " " table)
;; Strings ;; Char quote
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?\\ "/" table) (modify-syntax-entry ?\\ "/" table)
table)) table))
@ -223,6 +225,8 @@
("\\_<\\(#?!\\)\\(\n\\|$\\)" (1 "<") (2 ">")) ("\\_<\\(#?!\\)\\(\n\\|$\\)" (1 "<") (2 ">"))
;; CHARs: ;; CHARs:
("CHAR: \\(.\\)\\( \\|$\\)" (1 "w")) ("CHAR: \\(.\\)\\( \\|$\\)" (1 "w"))
;; Strings
("\\(\"\\)[^\n\r\f]*\\(\"\\)" (1 "\"") (2 "\""))
;; Let and lambda: ;; Let and lambda:
("\\_<\\(!(\\) .* \\()\\)" (1 "<") (2 ">")) ("\\_<\\(!(\\) .* \\()\\)" (1 "<") (2 ">"))
("\\(\\[\\)\\(let\\|wlet\\|let\\*\\)\\( \\|$\\)" (1 "(]")) ("\\(\\[\\)\\(let\\|wlet\\|let\\*\\)\\( \\|$\\)" (1 "(]"))