llvm.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module.exports = function(hljs) {
  2. var identifier = '([-a-zA-Z$._][\\w\\-$.]*)';
  3. return {
  4. //lexemes: '[.%]?' + hljs.IDENT_RE,
  5. keywords:
  6. 'begin end true false declare define global ' +
  7. 'constant private linker_private internal ' +
  8. 'available_externally linkonce linkonce_odr weak ' +
  9. 'weak_odr appending dllimport dllexport common ' +
  10. 'default hidden protected extern_weak external ' +
  11. 'thread_local zeroinitializer undef null to tail ' +
  12. 'target triple datalayout volatile nuw nsw nnan ' +
  13. 'ninf nsz arcp fast exact inbounds align ' +
  14. 'addrspace section alias module asm sideeffect ' +
  15. 'gc dbg linker_private_weak attributes blockaddress ' +
  16. 'initialexec localdynamic localexec prefix unnamed_addr ' +
  17. 'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc ' +
  18. 'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ' +
  19. 'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func ' +
  20. 'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc ' +
  21. 'cc c signext zeroext inreg sret nounwind ' +
  22. 'noreturn noalias nocapture byval nest readnone ' +
  23. 'readonly inlinehint noinline alwaysinline optsize ssp ' +
  24. 'sspreq noredzone noimplicitfloat naked builtin cold ' +
  25. 'nobuiltin noduplicate nonlazybind optnone returns_twice ' +
  26. 'sanitize_address sanitize_memory sanitize_thread sspstrong ' +
  27. 'uwtable returned type opaque eq ne slt sgt ' +
  28. 'sle sge ult ugt ule uge oeq one olt ogt ' +
  29. 'ole oge ord uno ueq une x acq_rel acquire ' +
  30. 'alignstack atomic catch cleanup filter inteldialect ' +
  31. 'max min monotonic nand personality release seq_cst ' +
  32. 'singlethread umax umin unordered xchg add fadd ' +
  33. 'sub fsub mul fmul udiv sdiv fdiv urem srem ' +
  34. 'frem shl lshr ashr and or xor icmp fcmp ' +
  35. 'phi call trunc zext sext fptrunc fpext uitofp ' +
  36. 'sitofp fptoui fptosi inttoptr ptrtoint bitcast ' +
  37. 'addrspacecast select va_arg ret br switch invoke ' +
  38. 'unwind unreachable indirectbr landingpad resume ' +
  39. 'malloc alloca free load store getelementptr ' +
  40. 'extractelement insertelement shufflevector getresult ' +
  41. 'extractvalue insertvalue atomicrmw cmpxchg fence ' +
  42. 'argmemonly double',
  43. contains: [
  44. {
  45. className: 'keyword',
  46. begin: 'i\\d+'
  47. },
  48. hljs.COMMENT(
  49. ';', '\\n', {relevance: 0}
  50. ),
  51. // Double quote string
  52. hljs.QUOTE_STRING_MODE,
  53. {
  54. className: 'string',
  55. variants: [
  56. // Double-quoted string
  57. { begin: '"', end: '[^\\\\]"' },
  58. ],
  59. relevance: 0
  60. },
  61. {
  62. className: 'title',
  63. variants: [
  64. { begin: '@' + identifier },
  65. { begin: '@\\d+' },
  66. { begin: '!' + identifier },
  67. { begin: '!\\d+' + identifier }
  68. ]
  69. },
  70. {
  71. className: 'symbol',
  72. variants: [
  73. { begin: '%' + identifier },
  74. { begin: '%\\d+' },
  75. { begin: '#\\d+' },
  76. ]
  77. },
  78. {
  79. className: 'number',
  80. variants: [
  81. { begin: '0[xX][a-fA-F0-9]+' },
  82. { begin: '-?\\d+(?:[.]\\d+)?(?:[eE][-+]?\\d+(?:[.]\\d+)?)?' }
  83. ],
  84. relevance: 0
  85. },
  86. ]
  87. };
  88. };