1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/highlight.js/lib/languages/thrift.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Thrift
Author: Oleg Efimov <efimovov@gmail.com>
Description: Thrift message definition format
Website: https://thrift.apache.org
Category: protocols
*/
function thrift(hljs) {
const BUILT_IN_TYPES = 'bool byte i16 i32 i64 double string binary';
2023-12-18 13:12:25 +08:00
return {
2024-01-16 21:26:16 +08:00
name: 'Thrift',
2023-12-18 13:12:25 +08:00
keywords: {
keyword:
'namespace const typedef struct enum service exception void oneway set list map required optional',
built_in:
BUILT_IN_TYPES,
literal:
'true false'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'class',
2024-01-16 21:26:16 +08:00
beginKeywords: 'struct enum service exception',
end: /\{/,
2023-12-18 13:12:25 +08:00
illegal: /\n/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
2024-01-16 21:26:16 +08:00
// hack: eating everything after the first title
starts: {
endsWithParent: true,
excludeEnd: true
}
2023-12-18 13:12:25 +08:00
})
]
},
{
2024-01-16 21:26:16 +08:00
begin: '\\b(set|list|map)\\s*<',
end: '>',
2023-12-18 13:12:25 +08:00
keywords: BUILT_IN_TYPES,
2024-01-16 21:26:16 +08:00
contains: [ 'self' ]
2023-12-18 13:12:25 +08:00
}
]
};
2024-01-16 21:26:16 +08:00
}
module.exports = thrift;