nimrod.js 1.9 KB

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