llvm.org GIT mirror llvm / 1763c0a
Improvements to emacs packages for llvm and tablegen mode. * Both files have valid package headers and footers (you can verify with M-x checkdoc). * Fixed style warnings generated by checkdoc. * Fixed a byte-compiler warning in llvm-mode.el. * Ensure that the modes are autoloaded, so users do not need to (require 'llvm-mode) to use them. Patch by Wilfred Hughes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225356 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 64 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
0 ;;; llvm-mode.el --- Major mode for the LLVM assembler language.
1
2 ;; Maintainer: The LLVM team, http://llvm.org/
1 ;; Description: Major mode for the LLVM assembler language.
2 ;; Updated: 2007-09-19
33
4 ;; Create mode-specific tables.
4 ;;; Commentary:
5
6 ;; Major mode for editing LLVM IR files.
7
8 ;;; Code:
9
510 (defvar llvm-mode-syntax-table nil
611 "Syntax table used while in LLVM mode.")
712 (defvar llvm-font-lock-keywords
5156 `(,(regexp-opt '("uselistorder" "uselistorder_bb") 'words) . font-lock-keyword-face)
5257
5358 )
54 "Syntax highlighting for LLVM"
59 "Syntax highlighting for LLVM."
5560 )
5661
5762 ;; ---------------------- Syntax table ---------------------------
6166 (if (not llvm-mode-syntax-table)
6267 (progn
6368 (setq llvm-mode-syntax-table (make-syntax-table))
64 (mapcar (function (lambda (n)
65 (modify-syntax-entry (aref n 0)
66 (aref n 1)
67 llvm-mode-syntax-table)))
68 '(
69 ;; whitespace (` ')
70 [?\^m " "]
71 [?\f " "]
72 [?\n " "]
73 [?\t " "]
74 [?\ " "]
75 ;; word constituents (`w')
76 ;;[?< "w"]
77 ;;[?> "w"]
78 [?\% "w"]
79 ;;[?_ "w "]
80 ;; comments
81 [?\; "< "]
82 [?\n "> "]
83 ;;[?\r "> "]
84 ;;[?\^m "> "]
85 ;; symbol constituents (`_')
86 ;; punctuation (`.')
87 ;; open paren (`(')
88 [?\( "("]
89 [?\[ "("]
90 [?\{ "("]
91 ;; close paren (`)')
92 [?\) ")"]
93 [?\] ")"]
94 [?\} ")"]
95 ;; string quote ('"')
96 [?\" "\""]
97 ))))
69 (mapc (function (lambda (n)
70 (modify-syntax-entry (aref n 0)
71 (aref n 1)
72 llvm-mode-syntax-table)))
73 '(
74 ;; whitespace (` ')
75 [?\^m " "]
76 [?\f " "]
77 [?\n " "]
78 [?\t " "]
79 [?\ " "]
80 ;; word constituents (`w')
81 ;;[?< "w"]
82 ;;[?> "w"]
83 [?\% "w"]
84 ;;[?_ "w "]
85 ;; comments
86 [?\; "< "]
87 [?\n "> "]
88 ;;[?\r "> "]
89 ;;[?\^m "> "]
90 ;; symbol constituents (`_')
91 ;; punctuation (`.')
92 ;; open paren (`(')
93 [?\( "("]
94 [?\[ "("]
95 [?\{ "("]
96 ;; close paren (`)')
97 [?\) ")"]
98 [?\] ")"]
99 [?\} ")"]
100 ;; string quote ('"')
101 [?\" "\""]
102 ))))
98103
99104 ;; --------------------- Abbrev table -----------------------------
100105
112117 (define-key llvm-mode-map "\es" 'center-line)
113118 (define-key llvm-mode-map "\eS" 'center-paragraph))
114119
115
120 ;;;###autoload
116121 (defun llvm-mode ()
117122 "Major mode for editing LLVM source files.
118 \\{llvm-mode-map}
119 Runs llvm-mode-hook on startup."
123 \\{llvm-mode-map}
124 Runs `llvm-mode-hook' on startup."
120125 (interactive)
121126 (kill-all-local-variables)
122127 (use-local-map llvm-mode-map) ; Provides the local keymap.
135140 ; customize the mode with a hook.
136141
137142 ;; Associate .ll files with llvm-mode
138 (setq auto-mode-alist
139 (append '(("\\.ll$" . llvm-mode)) auto-mode-alist))
143 ;;;###autoload
144 (add-to-list 'auto-mode-alist (cons (purecopy "\\.ll\\'") 'llvm-mode))
140145
141146 (provide 'llvm-mode)
142 ;; end of llvm-mode.el
147
148 ;;; llvm-mode.el ends here
0 ;;; tablegen-mode.el --- Major mode for TableGen description files (part of LLVM project)
1
2 ;; Maintainer: The LLVM team, http://llvm.org/
1 ;; Description: Major mode for TableGen description files (part of LLVM project)
2 ;; Updated: 2007-12-18
3
4 ;;; Commentary:
5 ;; A major mode for TableGen description files in LLVM.
36
47 (require 'comint)
58 (require 'custom)
69 (require 'ansi-color)
710
811 ;; Create mode-specific tables.
12 ;;; Code:
13
914 (defvar td-decorators-face 'td-decorators-face
1015 "Face method decorators.")
1116 (make-face 'td-decorators-face)
9297 (define-key tablegen-mode-map "\es" 'center-line)
9398 (define-key tablegen-mode-map "\eS" 'center-paragraph))
9499
100 ;;;###autoload
95101 (defun tablegen-mode ()
96102 "Major mode for editing TableGen description files.
97 \\{tablegen-mode-map}
98 Runs tablegen-mode-hook on startup."
103 \\{tablegen-mode-map}
104 Runs `tablegen-mode-hook' on startup."
99105 (interactive)
100106 (kill-all-local-variables)
101107 (use-local-map tablegen-mode-map) ; Provides the local keymap.
116122 ; customize the mode with a hook.
117123
118124 ;; Associate .td files with tablegen-mode
119 (setq auto-mode-alist (append '(("\\.td$" . tablegen-mode)) auto-mode-alist))
125 ;;;###autoload
126 (add-to-list 'auto-mode-alist (cons (purecopy "\\.td\\'") 'tablegen-mode))
120127
121128 (provide 'tablegen-mode)
122 ;; end of tablegen-mode.el
129
130 ;;; tablegen-mode.el ends here