source: node_modules/highlight.js/lib/languages/nim.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

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