51 lines
2.0 KiB
JavaScript
51 lines
2.0 KiB
JavaScript
module.exports = function(hljs) {
|
|
return {
|
|
aliases: ['nim'],
|
|
keywords: {
|
|
keyword: 'addr and as asm bind block break|0 case|0 cast const|0 continue|0 converter discard distinct|10 div do elif else|0 end|0 enum|0 except export finally for from generic if|0 import|0 in include|0 interface is isnot|10 iterator|10 let|0 macro method|10 mixin mod nil not notin|10 object|0 of or out proc|10 ptr raise ref|10 return shl shr static template try|0 tuple type|0 using|0 var|0 when while|0 with without xor yield',
|
|
literal: 'shared guarded stdin stdout stderr result|10 true false'
|
|
},
|
|
contains: [ {
|
|
className: 'decorator', // Actually pragma
|
|
begin: /{\./,
|
|
end: /\.}/,
|
|
relevance: 10
|
|
}, {
|
|
className: 'string',
|
|
begin: /[a-zA-Z]\w*"/,
|
|
end: /"/,
|
|
contains: [{begin: /""/}]
|
|
}, {
|
|
className: 'string',
|
|
begin: /([a-zA-Z]\w*)?"""/,
|
|
end: /"""/
|
|
},
|
|
hljs.QUOTE_STRING_MODE,
|
|
{
|
|
className: 'type',
|
|
begin: /\b[A-Z]\w+\b/,
|
|
relevance: 0
|
|
}, {
|
|
className: 'type',
|
|
begin: /\b(int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|string|cstring|pointer|expr|stmt|void|auto|any|range|array|openarray|varargs|seq|set|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringarray|semistatic)\b/
|
|
}, {
|
|
className: 'number',
|
|
begin: /\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/,
|
|
relevance: 0
|
|
}, {
|
|
className: 'number',
|
|
begin: /\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/,
|
|
relevance: 0
|
|
}, {
|
|
className: 'number',
|
|
begin: /\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/,
|
|
relevance: 0
|
|
}, {
|
|
className: 'number',
|
|
begin: /\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/,
|
|
relevance: 0
|
|
},
|
|
hljs.HASH_COMMENT_MODE
|
|
]
|
|
}
|
|
}; |