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) | |
68 | 67 |
69 (eval-when-compile | 68 (eval-when-compile |
70 (require 'cc-langs) | 69 (require 'cc-langs) |
71 (require 'cc-fonts)) | 70 (require 'cc-fonts)) |
72 | 71 |
73 ;; This mode does not inherit properties from other modes. So, we do not use | 72 ;; This mode does not inherit properties from other modes. So, we do not use |
74 ;; the usual `c-add-language' function. | 73 ;; the usual `c-add-language' function. |
75 (eval-and-compile | 74 (eval-and-compile |
76 (put 'protobuf-mode 'c-mode-prefix "protobuf-")) | 75 (put 'protobuf-mode 'c-mode-prefix "protobuf-")) |
77 | 76 |
78 ;; The following code uses of the `c-lang-defconst' macro define syntactic | 77 ;; The following code uses of the `c-lang-defconst' macro define syntactic |
79 ;; features of protocol buffer language. Refer to the documentation in the | 78 ;; features of protocol buffer language. Refer to the documentation in the |
80 ;; cc-langs.el file for information about the meaning of the -kwds variables. | 79 ;; cc-langs.el file for information about the meaning of the -kwds variables. |
81 | 80 |
82 (c-lang-defconst c-primitive-type-kwds | 81 (c-lang-defconst c-primitive-type-kwds |
83 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32" | 82 protobuf '("double" "float" "int32" "int64" "uint32" "uint64" "sint32" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 (c-make-emacs-variables-local)) | 211 (c-make-emacs-variables-local)) |
213 (c-init-language-vars protobuf-mode) | 212 (c-init-language-vars protobuf-mode) |
214 (c-common-init 'protobuf-mode) | 213 (c-common-init 'protobuf-mode) |
215 (easy-menu-add protobuf-menu) | 214 (easy-menu-add protobuf-menu) |
216 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook) | 215 (c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook) |
217 (c-update-modeline)) | 216 (c-update-modeline)) |
218 | 217 |
219 (provide 'protobuf-mode) | 218 (provide 'protobuf-mode) |
220 | 219 |
221 ;;; protobuf-mode.el ends here | 220 ;;; protobuf-mode.el ends here |
OLD | NEW |