• Home
  • Raw
  • Download

Lines Matching full:protobuf

1 ;;; protobuf-mode.el --- major mode for editing protocol buffers.  -*- lexical-binding: t; -*-
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)))
78 (put 'protobuf-mode 'c-mode-prefix "protobuf-"))
85 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32"
90 protobuf '("required" "optional" "repeated"))
93 protobuf '("message" "enum" "service"))
96 protobuf '("true" "false"))
99 protobuf '("package" "import"))
102 protobuf '("default" "max"))
105 ;; Handle extended identifiers like google.protobuf.MessageOptions
106 protobuf '((left-assoc ".")))
112 protobuf '("extensions" "to" "reserved"))
115 protobuf '("extend" "rpc" "option" "returns"))
123 protobuf nil)
127 protobuf nil)
131 protobuf nil)
135 protobuf nil)
139 protobuf nil)
143 protobuf nil)
147 protobuf nil)
151 protobuf nil)
156 protobuf "\\([\{\};,]+\\)")
161 (defconst protobuf-font-lock-keywords-1 (c-lang-const c-matchers-1 protobuf)
162 "Minimal highlighting for protobuf-mode.")
164 (defconst protobuf-font-lock-keywords-2 (c-lang-const c-matchers-2 protobuf)
165 "Fast normal highlighting for protobuf-mode.")
167 (defconst protobuf-font-lock-keywords-3 (c-lang-const c-matchers-3 protobuf)
168 "Accurate normal highlighting for protobuf-mode.")
170 (defvar protobuf-font-lock-keywords protobuf-font-lock-keywords-3
171 "Default expressions to highlight in protobuf-mode.")
175 (defvar protobuf-mode-syntax-table nil
176 "Syntax table used in protobuf-mode buffers.")
177 (or protobuf-mode-syntax-table
178 (setq protobuf-mode-syntax-table
179 (funcall (c-lang-const c-make-mode-syntax-table protobuf))))
181 (defvar protobuf-mode-abbrev-table nil
182 "Abbreviation table used in protobuf-mode buffers.")
184 (defvar protobuf-mode-map nil
185 "Keymap used in protobuf-mode buffers.")
186 (or protobuf-mode-map
187 (setq protobuf-mode-map (c-make-inherited-keymap)))
189 (easy-menu-define protobuf-menu protobuf-mode-map
191 (cons "Protocol Buffers" (c-lang-const c-mode-menu protobuf)))
193 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.proto\\'" . protobuf-mode))
196 (defun protobuf-mode ()
200 initialization, then `protobuf-mode-hook'.
203 \\{protobuf-mode-map}"
206 (set-syntax-table protobuf-mode-syntax-table)
207 (setq major-mode 'protobuf-mode
209 local-abbrev-table protobuf-mode-abbrev-table
211 (use-local-map protobuf-mode-map)
215 (c-init-language-vars protobuf-mode)
216 (c-common-init 'protobuf-mode)
217 (easy-menu-add protobuf-menu)
218 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook)
225 (provide 'protobuf-mode)
227 ;;; protobuf-mode.el ends here