PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/files/highlight.js/8.0/languages/autohotkey.js

https://gitlab.com/Mirros/jsdelivr
JavaScript | 65 lines | 56 code | 2 blank | 7 comment | 0 complexity | bb1ed6537ae1f417029314b76d404ff4 MD5 | raw file
  1. /*
  2. Language: AutoHotkey
  3. Author: Seongwon Lee <dlimpid@gmail.com>
  4. Description: AutoHotkey language definition
  5. */
  6. function(hljs) {
  7. var BACKTICK_ESCAPE = {
  8. className: 'escape',
  9. begin: '`[\\s\\S]'
  10. };
  11. var COMMENTS = {
  12. className: 'comment',
  13. begin: ';', end: '$',
  14. relevance: 0
  15. };
  16. var BUILT_IN = [
  17. {
  18. className: 'built_in',
  19. begin: 'A_[a-zA-Z0-9]+'
  20. },
  21. {
  22. className: 'built_in',
  23. beginKeywords: 'ComSpec Clipboard ClipboardAll ErrorLevel'
  24. }
  25. ];
  26. return {
  27. case_insensitive: true,
  28. keywords: {
  29. keyword: 'Break Continue Else Gosub If Loop Return While',
  30. literal: 'A true false NOT AND OR'
  31. },
  32. contains: BUILT_IN.concat([
  33. BACKTICK_ESCAPE,
  34. hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [BACKTICK_ESCAPE]}),
  35. COMMENTS,
  36. {
  37. className: 'number',
  38. begin: hljs.NUMBER_RE,
  39. relevance: 0
  40. },
  41. {
  42. className: 'var_expand', // FIXME
  43. begin: '%', end: '%',
  44. illegal: '\\n',
  45. contains: [BACKTICK_ESCAPE]
  46. },
  47. {
  48. className: 'label',
  49. contains: [BACKTICK_ESCAPE],
  50. variants: [
  51. {begin: '^[^\\n";]+::(?!=)'},
  52. {begin: '^[^\\n";]+:(?!=)', relevance: 0} // zero relevance as it catches a lot of things
  53. // followed by a single ':' in many languages
  54. ]
  55. },
  56. {
  57. // consecutive commas, not for highlighting but just for relevance
  58. begin: ',\\s*,',
  59. relevance: 10
  60. }
  61. ])
  62. }
  63. }