nim.js 2.2 KB

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