export default function (hljs) {
let BACKSLASH_ESCAPE = {
begin: '\\\\[\\s\\S]', relevance: 0
};
let APOS_STRING_MODE = {
className: 'string',
begin: '\'',
end: '\'',
illegal: '\\n',
contains: [BACKSLASH_ESCAPE]
};
let STRINGS = {
className: 'string',
variants: [
{
begin: '\'\'\'.*', end: '\'\'\''
},
APOS_STRING_MODE
]
};
let NUMBERS = {
className: 'number',
variants: [
{begin: '[1-9][0-9]*'},
{begin: '0x[0-9a-fA-F]+'},
{begin: '0[0-7]*'}
],
relevance: 0
};
let KEYWORDS = {
keyword:
'let in and or not ' +
'continue break if else foreach ' +
'i32 i64 u32 u64 string error void ',
built_in:
'project ' +
'module mod ' +
'executable bin binary ' +
'library lib ' +
'add_subdirectory subdir ' +
'print ',
literal: 'true false ',
};
return {
name: 'leafbuild',
aliases: ['build.leaf'],
case_insensitive: false,
contains: [
{
className: 'variable',
begin: hljs.IDENT_RE,
keywords: KEYWORDS
},
NUMBERS,
STRINGS,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
],
exports: {
strings: STRINGS,
}
};
}