PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/frontend/node_modules/highlight.js/lib/languages/autohotkey.js

https://gitlab.com/sogeta_albazi/books-and-movies
JavaScript | 84 lines | 64 code | 3 blank | 17 comment | 0 complexity | 3644d14c8283d423c6d086453fd1e5bf MD5 | raw file
  1. /*
  2. Language: AutoHotkey
  3. Author: Seongwon Lee <dlimpid@gmail.com>
  4. Description: AutoHotkey language definition
  5. Category: scripting
  6. */
  7. /** @type LanguageFn */
  8. function autohotkey(hljs) {
  9. const BACKTICK_ESCAPE = {
  10. begin: '`[\\s\\S]'
  11. };
  12. return {
  13. name: 'AutoHotkey',
  14. case_insensitive: true,
  15. aliases: ['ahk'],
  16. keywords: {
  17. keyword: 'Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group',
  18. literal: 'true false NOT AND OR',
  19. built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel'
  20. },
  21. contains: [
  22. BACKTICK_ESCAPE,
  23. hljs.inherit(hljs.QUOTE_STRING_MODE, {
  24. contains: [BACKTICK_ESCAPE]
  25. }),
  26. hljs.COMMENT(';', '$', {
  27. relevance: 0
  28. }),
  29. hljs.C_BLOCK_COMMENT_MODE,
  30. {
  31. className: 'number',
  32. begin: hljs.NUMBER_RE,
  33. relevance: 0
  34. },
  35. {
  36. // subst would be the most accurate however fails the point of
  37. // highlighting. variable is comparably the most accurate that actually
  38. // has some effect
  39. className: 'variable',
  40. begin: '%[a-zA-Z0-9#_$@]+%'
  41. },
  42. {
  43. className: 'built_in',
  44. begin: '^\\s*\\w+\\s*(,|%)'
  45. // I don't really know if this is totally relevant
  46. },
  47. {
  48. // symbol would be most accurate however is highlighted just like
  49. // built_in and that makes up a lot of AutoHotkey code meaning that it
  50. // would fail to highlight anything
  51. className: 'title',
  52. variants: [
  53. {
  54. begin: '^[^\\n";]+::(?!=)'
  55. },
  56. {
  57. begin: '^[^\\n";]+:(?!=)',
  58. // zero relevance as it catches a lot of things
  59. // followed by a single ':' in many languages
  60. relevance: 0
  61. }
  62. ]
  63. },
  64. {
  65. className: 'meta',
  66. begin: '^\\s*#\\w+',
  67. end: '$',
  68. relevance: 0
  69. },
  70. {
  71. className: 'built_in',
  72. begin: 'A_[a-zA-Z0-9]+'
  73. },
  74. {
  75. // consecutive commas, not for highlighting but just for relevance
  76. begin: ',\\s*,'
  77. }
  78. ]
  79. };
  80. }
  81. module.exports = autohotkey;