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

74 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Awk
Author: Matthew Daly <matthewbdaly@gmail.com>
Website: https://www.gnu.org/software/gawk/manual/gawk.html
Description: language definition for Awk scripts
*/
/** @type LanguageFn */
function awk(hljs) {
const VARIABLE = {
2023-12-18 13:12:25 +08:00
className: 'variable',
variants: [
2024-01-16 21:26:16 +08:00
{
begin: /\$[\w\d#@][\w\d_]*/
},
{
begin: /\$\{(.*?)\}/
}
2023-12-18 13:12:25 +08:00
]
};
2024-01-16 21:26:16 +08:00
const KEYWORDS = 'BEGIN END if else while do for in break continue delete next nextfile function func exit|10';
const STRING = {
2023-12-18 13:12:25 +08:00
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE],
variants: [
{
2024-01-16 21:26:16 +08:00
begin: /(u|b)?r?'''/,
end: /'''/,
2023-12-18 13:12:25 +08:00
relevance: 10
},
{
2024-01-16 21:26:16 +08:00
begin: /(u|b)?r?"""/,
end: /"""/,
2023-12-18 13:12:25 +08:00
relevance: 10
},
{
2024-01-16 21:26:16 +08:00
begin: /(u|r|ur)'/,
end: /'/,
2023-12-18 13:12:25 +08:00
relevance: 10
},
{
2024-01-16 21:26:16 +08:00
begin: /(u|r|ur)"/,
end: /"/,
2023-12-18 13:12:25 +08:00
relevance: 10
},
{
2024-01-16 21:26:16 +08:00
begin: /(b|br)'/,
end: /'/
2023-12-18 13:12:25 +08:00
},
{
2024-01-16 21:26:16 +08:00
begin: /(b|br)"/,
end: /"/
2023-12-18 13:12:25 +08:00
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]
};
return {
2024-01-16 21:26:16 +08:00
name: 'Awk',
keywords: {
keyword: KEYWORDS
2023-12-18 13:12:25 +08:00
},
contains: [
VARIABLE,
STRING,
hljs.REGEXP_MODE,
hljs.HASH_COMMENT_MODE,
hljs.NUMBER_MODE
]
2024-01-16 21:26:16 +08:00
};
}
module.exports = awk;