]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/autohotkey.js
Initial commit.
[flow-web.git] / static / highlight / languages / autohotkey.js
1 /*! `autohotkey` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: AutoHotkey
8 Author: Seongwon Lee <dlimpid@gmail.com>
9 Description: AutoHotkey language definition
10 Category: scripting
11 */
12
13 /** @type LanguageFn */
14 function autohotkey(hljs) {
15 const BACKTICK_ESCAPE = { begin: '`[\\s\\S]' };
16
17 return {
18 name: 'AutoHotkey',
19 case_insensitive: true,
20 aliases: [ 'ahk' ],
21 keywords: {
22 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',
23 literal: 'true false NOT AND OR',
24 built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel'
25 },
26 contains: [
27 BACKTICK_ESCAPE,
28 hljs.inherit(hljs.QUOTE_STRING_MODE, { contains: [ BACKTICK_ESCAPE ] }),
29 hljs.COMMENT(';', '$', { relevance: 0 }),
30 hljs.C_BLOCK_COMMENT_MODE,
31 {
32 className: 'number',
33 begin: hljs.NUMBER_RE,
34 relevance: 0
35 },
36 {
37 // subst would be the most accurate however fails the point of
38 // highlighting. variable is comparably the most accurate that actually
39 // has some effect
40 className: 'variable',
41 begin: '%[a-zA-Z0-9#_$@]+%'
42 },
43 {
44 className: 'built_in',
45 begin: '^\\s*\\w+\\s*(,|%)'
46 // I don't really know if this is totally relevant
47 },
48 {
49 // symbol would be most accurate however is highlighted just like
50 // built_in and that makes up a lot of AutoHotkey code meaning that it
51 // would fail to highlight anything
52 className: 'title',
53 variants: [
54 { begin: '^[^\\n";]+::(?!=)' },
55 {
56 begin: '^[^\\n";]+:(?!=)',
57 // zero relevance as it catches a lot of things
58 // followed by a single ':' in many languages
59 relevance: 0
60 }
61 ]
62 },
63 {
64 className: 'meta',
65 begin: '^\\s*#\\w+',
66 end: '$',
67 relevance: 0
68 },
69 {
70 className: 'built_in',
71 begin: 'A_[a-zA-Z0-9]+'
72 },
73 {
74 // consecutive commas, not for highlighting but just for relevance
75 begin: ',\\s*,' }
76 ]
77 };
78 }
79
80 return autohotkey;
81
82 })();
83
84 hljs.registerLanguage('autohotkey', hljsGrammar);
85 })();