OLD | NEW |
1 ;;; protobuf-mode.el --- major mode for editing protocol buffers. | 1 ;;; protobuf-mode.el --- major mode for editing protocol buffers. |
2 | 2 |
3 ;; Author: Alexandre Vassalotti <alexandre@peadrop.com> | 3 ;; Author: Alexandre Vassalotti <alexandre@peadrop.com> |
4 ;; Created: 23-Apr-2009 | 4 ;; Created: 23-Apr-2009 |
5 ;; Version: 0.3 | 5 ;; Version: 0.3 |
6 ;; Keywords: google protobuf languages | 6 ;; Keywords: google protobuf languages |
7 | 7 |
8 ;; Redistribution and use in source and binary forms, with or without | 8 ;; Redistribution and use in source and binary forms, with or without |
9 ;; modification, are permitted provided that the following conditions are | 9 ;; modification, are permitted provided that the following conditions are |
10 ;; met: | 10 ;; met: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ;; - Make highlighting for enum values work properly. | 57 ;; - Make highlighting for enum values work properly. |
58 ;; - Fix the parser to recognize extensions as identifiers and not | 58 ;; - Fix the parser to recognize extensions as identifiers and not |
59 ;; as casts. | 59 ;; as casts. |
60 ;; - Improve the parsing of option assignment lists. For example: | 60 ;; - Improve the parsing of option assignment lists. For example: |
61 ;; optional int32 foo = 1 [(my_field_option) = 4.5]; | 61 ;; optional int32 foo = 1 [(my_field_option) = 4.5]; |
62 ;; - Add support for fully-qualified identifiers (e.g., with a leading "."). | 62 ;; - Add support for fully-qualified identifiers (e.g., with a leading "."). |
63 | 63 |
64 ;;; Code: | 64 ;;; Code: |
65 | 65 |
66 (require 'cc-mode) | 66 (require 'cc-mode) |
| 67 (require 'cl) |
67 | 68 |
68 (eval-when-compile | 69 (eval-when-compile |
69 (require 'cc-langs) | 70 (require 'cc-langs) |
70 (require 'cc-fonts)) | 71 (require 'cc-fonts)) |
71 | 72 |
72 ;; This mode does not inherit properties from other modes. So, we do not use | 73 ;; This mode does not inherit properties from other modes. So, we do not use |
73 ;; the usual `c-add-language' function. | 74 ;; the usual `c-add-language' function. |
74 (eval-and-compile | 75 (eval-and-compile |
75 (put 'protobuf-mode 'c-mode-prefix "protobuf-")) | 76 (put 'protobuf-mode 'c-mode-prefix "protobuf-")) |
76 | 77 |
77 ;; The following code uses of the `c-lang-defconst' macro define syntactic | 78 ;; The following code uses of the `c-lang-defconst' macro define syntactic |
78 ;; features of protocol buffer language. Refer to the documentation in the | 79 ;; features of protocol buffer language. Refer to the documentation in the |
79 ;; cc-langs.el file for information about the meaning of the -kwds variables. | 80 ;; cc-langs.el file for information about the meaning of the -kwds variables. |
80 | 81 |
81 (c-lang-defconst c-primitive-type-kwds | 82 (c-lang-defconst c-primitive-type-kwds |
82 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32" | 83 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 (c-make-emacs-variables-local)) | 212 (c-make-emacs-variables-local)) |
212 (c-init-language-vars protobuf-mode) | 213 (c-init-language-vars protobuf-mode) |
213 (c-common-init 'protobuf-mode) | 214 (c-common-init 'protobuf-mode) |
214 (easy-menu-add protobuf-menu) | 215 (easy-menu-add protobuf-menu) |
215 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook) | 216 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook) |
216 (c-update-modeline)) | 217 (c-update-modeline)) |
217 | 218 |
218 (provide 'protobuf-mode) | 219 (provide 'protobuf-mode) |
219 | 220 |
220 ;;; protobuf-mode.el ends here | 221 ;;; protobuf-mode.el ends here |
OLD | NEW |