nimrod.js 1.9 KB

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