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

75 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Go
Author: Stephan Kountso aka StepLg <steplg@gmail.com>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>
Description: Google go language (golang). For info about language
Website: http://golang.org/
Category: common, system
*/
function go(hljs) {
const GO_KEYWORDS = {
2023-12-18 13:12:25 +08:00
keyword:
'break default func interface select case map struct chan else goto package switch ' +
'const fallthrough if range type continue for import return var go defer ' +
'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
'uint16 uint32 uint64 int uint uintptr rune',
literal:
'true false iota nil',
built_in:
'append cap close complex copy imag len make new panic print println real recover delete'
};
return {
2024-01-16 21:26:16 +08:00
name: 'Go',
2023-12-18 13:12:25 +08:00
aliases: ['golang'],
keywords: GO_KEYWORDS,
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'string',
variants: [
hljs.QUOTE_STRING_MODE,
2024-01-16 21:26:16 +08:00
hljs.APOS_STRING_MODE,
{
begin: '`',
end: '`'
}
2023-12-18 13:12:25 +08:00
]
},
{
className: 'number',
variants: [
2024-01-16 21:26:16 +08:00
{
begin: hljs.C_NUMBER_RE + '[i]',
relevance: 1
},
2023-12-18 13:12:25 +08:00
hljs.C_NUMBER_MODE
]
},
{
begin: /:=/ // relevance booster
},
{
className: 'function',
2024-01-16 21:26:16 +08:00
beginKeywords: 'func',
end: '\\s*(\\{|$)',
excludeEnd: true,
2023-12-18 13:12:25 +08:00
contains: [
hljs.TITLE_MODE,
{
className: 'params',
2024-01-16 21:26:16 +08:00
begin: /\(/,
end: /\)/,
2023-12-18 13:12:25 +08:00
keywords: GO_KEYWORDS,
illegal: /["']/
}
]
}
]
};
2024-01-16 21:26:16 +08:00
}
module.exports = go;