nim.js (2081B)
1 /* 2 Language: Nim 3 Description: Nim is a statically typed compiled systems programming language. 4 Website: https://nim-lang.org 5 Category: system 6 */ 7 8 function nim(hljs) { 9 return { 10 name: 'Nim', 11 aliases: ['nim'], 12 keywords: { 13 keyword: 14 'addr and as asm bind block break case cast const continue converter ' + 15 'discard distinct div do elif else end enum except export finally ' + 16 'for from func generic if import in include interface is isnot iterator ' + 17 'let macro method mixin mod nil not notin object of or out proc ptr ' + 18 'raise ref return shl shr static template try tuple type using var ' + 19 'when while with without xor yield', 20 literal: 21 'shared guarded stdin stdout stderr result true false', 22 built_in: 23 'int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float ' + 24 'float32 float64 bool char string cstring pointer expr stmt void ' + 25 'auto any range array openarray varargs seq set clong culong cchar ' + 26 'cschar cshort cint csize clonglong cfloat cdouble clongdouble ' + 27 'cuchar cushort cuint culonglong cstringarray semistatic' 28 }, 29 contains: [ { 30 className: 'meta', // Actually pragma 31 begin: /{\./, 32 end: /\.}/, 33 relevance: 10 34 }, { 35 className: 'string', 36 begin: /[a-zA-Z]\w*"/, 37 end: /"/, 38 contains: [{begin: /""/}] 39 }, { 40 className: 'string', 41 begin: /([a-zA-Z]\w*)?"""/, 42 end: /"""/ 43 }, 44 hljs.QUOTE_STRING_MODE, 45 { 46 className: 'type', 47 begin: /\b[A-Z]\w+\b/, 48 relevance: 0 49 }, { 50 className: 'number', 51 relevance: 0, 52 variants: [ 53 {begin: /\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/}, 54 {begin: /\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/}, 55 {begin: /\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/}, 56 {begin: /\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/} 57 ] 58 }, 59 hljs.HASH_COMMENT_MODE 60 ] 61 } 62 } 63 64 module.exports = nim;