20 ;; |
20 ;; |
21 ;; (add-to-list 'auto-mode-alist (cons "\\.gadict$" 'gadict-mode)) |
21 ;; (add-to-list 'auto-mode-alist (cons "\\.gadict$" 'gadict-mode)) |
22 |
22 |
23 ;;; Code: |
23 ;;; Code: |
24 |
24 |
|
25 (defconst gadict--art-lang-regex (regexp-opt '("en" "ru" "uk" "la"))) |
|
26 (defconst gadict--art-rel-regex (regexp-opt '("ant" "syn" "rel" "topic"))) |
|
27 (defconst gadict--art-var-regex (regexp-opt '("v1" "v2" "v3" "s" "pl" "male" "female" "abbr" "comp" "super" "Am" "Br" "Au"))) |
|
28 (defconst gadict--art-pos-regex (regexp-opt '("n" "v" "adj" "adv" "pron" "prep" "num" "conj" "int" "phr" "phr\\.v" "contr" "abbr" "prefix"))) |
|
29 |
25 (defvar gadict-font-lock-keywords |
30 (defvar gadict-font-lock-keywords |
26 '( ("^\\(__\\)\n\n\\(\\w.*\\)$" (1 font-lock-function-name-face) (2 font-lock-keyword-face)) |
31 `( ("^\\(__\\)\n\n\\(\\w.*\\)$" (1 font-lock-function-name-face) (2 font-lock-keyword-face)) |
27 ("^ .*\n\\(\\w.*\\)" (1 font-lock-keyword-face)) |
32 ("^ .*\n\\(\\w.*\\)" (1 font-lock-keyword-face)) |
28 ("^#.*" . font-lock-comment-face) |
33 ("^#.*" . font-lock-comment-face) |
29 ("^ +\\[[^]\n]+]" . font-lock-type-face) |
34 ("^ +\\[[^]\n]+]" . font-lock-type-face) |
30 ("^\\(?:en\\|ru\\|uk\\|la\\): " . font-lock-type-face) |
35 (,(format "^%s: " gadict--art-lang-regex) . font-lock-type-face) |
31 ("^\\(?:en\\|ru\\|uk\\|la\\)> " . font-lock-doc-face) |
36 (,(format "^%s> " gadict--art-lang-regex) . font-lock-doc-face) |
32 ("^\\(?:topic\\|ant\\|syn\\): " . font-lock-doc-face) |
37 (,(format "^%s= " gadict--art-lang-regex) . font-lock-constant-face) |
33 ("^ +\\(?:v1\\|v2\\|v3\\|s\\|pl\\|male\\|female\\|abbr\\|comp\\|super\\|Am\\|Br\\|Au\\)$" . font-lock-doc-face) |
38 (,(format "^%s: " gadict--art-rel-regex) . font-lock-doc-face) |
34 ("^\\(?:n\\|v\\|adj\\|adv\\|pron\\|prep\\|num\\|conj\\|int\\|phr\\|phr\\.v\\|contr\\|abbr\\|prefix\\)$" . font-lock-type-face) )) |
39 (,(format "^ +%s$" gadict--art-var-regex) . font-lock-doc-face) |
|
40 (,(format "^%s$" gadict--art-pos-regex) . font-lock-warning-face) )) |
35 |
41 |
36 (defun gadict-setup-fontlock () |
42 (defun gadict-setup-fontlock () |
37 "Setup gadict fontlock." |
43 "Setup gadict fontlock." |
38 (setq font-lock-defaults |
44 (setq font-lock-defaults |
39 '(gadict-font-lock-keywords |
45 '(gadict-font-lock-keywords |