0
This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
highlight_js-rails/vendor/assets/javascripts/highlight_js/languages/protobuf.js
2015-01-25 16:00:01 +01:00

44 lines
1.1 KiB
JavaScript

/*
Language: Protocol Buffers
Author: Dan Tao <daniel.tao@gmail.com>
Description: Protocol buffer message definition format
Category: protocols
*/
function(hljs) {
return {
keywords: {
keyword: 'package import option optional required repeated group',
built_in: 'double float int32 int64 uint32 uint64 sint32 sint64 ' +
'fixed32 fixed64 sfixed32 sfixed64 bool string bytes',
literal: 'true false'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
{
className: 'class',
beginKeywords: 'message enum service', end: /\{/,
illegal: /\n/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
})
]
},
{
className: 'function',
beginKeywords: 'rpc',
end: /;/, excludeEnd: true,
keywords: 'rpc returns'
},
{
className: 'constant',
begin: /^\s*[A-Z_]+/,
end: /\s*=/, excludeEnd: true
}
]
};
}