Lines Matching refs:protobuf
0 ;;; protobuf-mode.el --- major mode for editing protocol buffers.
6 ;; Keywords: google protobuf languages
37 ;; - Put `protobuf-mode.el' in your Emacs load-path.
39 ;; (require 'protobuf-mode)
42 ;; you want to add customizations specific to protobuf-mode, you can use the
43 ;; `protobuf-mode-hook'. For example, the following would make protocol-mode
46 ;; (defconst my-protobuf-style
50 ;; (add-hook 'protobuf-mode-hook
51 ;; (lambda () (c-add-style "my-style" my-protobuf-style t)))
75 (put 'protobuf-mode 'c-mode-prefix "protobuf-"))
82 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32"
87 protobuf '("required" "optional" "repeated"))
90 protobuf '("message" "enum" "service"))
93 protobuf '("true" "false"))
96 protobuf '("package" "import"))
99 protobuf '("default" "max"))
102 ;; Handle extended identifiers like google.protobuf.MessageOptions
103 protobuf '((left-assoc ".")))
109 protobuf '("extensions" "to" "reserved"))
112 protobuf '("extend" "rpc" "option" "returns"))
120 protobuf nil)
124 protobuf nil)
128 protobuf nil)
132 protobuf nil)
136 protobuf nil)
140 protobuf nil)
144 protobuf nil)
148 protobuf nil)
153 protobuf "\\([\{\};,]+\\)")
158 (defconst protobuf-font-lock-keywords-1 (c-lang-const c-matchers-1 protobuf)
159 "Minimal highlighting for protobuf-mode.")
161 (defconst protobuf-font-lock-keywords-2 (c-lang-const c-matchers-2 protobuf)
162 "Fast normal highlighting for protobuf-mode.")
164 (defconst protobuf-font-lock-keywords-3 (c-lang-const c-matchers-3 protobuf)
165 "Accurate normal highlighting for protobuf-mode.")
167 (defvar protobuf-font-lock-keywords protobuf-font-lock-keywords-3
168 "Default expressions to highlight in protobuf-mode.")
172 (defvar protobuf-mode-syntax-table nil
173 "Syntax table used in protobuf-mode buffers.")
174 (or protobuf-mode-syntax-table
175 (setq protobuf-mode-syntax-table
176 (funcall (c-lang-const c-make-mode-syntax-table protobuf))))
178 (defvar protobuf-mode-abbrev-table nil
179 "Abbreviation table used in protobuf-mode buffers.")
181 (defvar protobuf-mode-map nil
182 "Keymap used in protobuf-mode buffers.")
183 (or protobuf-mode-map
184 (setq protobuf-mode-map (c-make-inherited-keymap)))
186 (easy-menu-define protobuf-menu protobuf-mode-map
188 (cons "Protocol Buffers" (c-lang-const c-mode-menu protobuf)))
190 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.proto\\'" . protobuf-mode))
193 (defun protobuf-mode ()
197 initialization, then `protobuf-mode-hook'.
200 \\{protobuf-mode-map}"
203 (set-syntax-table protobuf-mode-syntax-table)
204 (setq major-mode 'protobuf-mode
206 local-abbrev-table protobuf-mode-abbrev-table
208 (use-local-map protobuf-mode-map)
212 (c-init-language-vars protobuf-mode)
213 (c-common-init 'protobuf-mode)
214 (easy-menu-add protobuf-menu)
215 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook)
218 (provide 'protobuf-mode)
220 ;;; protobuf-mode.el ends here