]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/autohotkey.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / autohotkey.js
1 /*! `autohotkey` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: AutoHotkey
7 Author: Seongwon Lee <dlimpid@gmail.com>
8 Description: AutoHotkey language definition
9 Category: scripting
10 */
11
12 /** @type LanguageFn */
13 function autohotkey(hljs) {
14 const BACKTICK_ESCAPE = { begin: '`[\\s\\S]' };
15
16 return {
17 name: 'AutoHotkey',
18 case_insensitive: true,
19 aliases: [ 'ahk' ],
20 keywords: {
21 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',
22 literal: 'true false NOT AND OR',
23 built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel'
24 },
25 contains: [
26 BACKTICK_ESCAPE,
27 hljs.inherit(hljs.QUOTE_STRING_MODE, { contains: [ BACKTICK_ESCAPE ] }),
28 hljs.COMMENT(';', '$', { relevance: 0 }),
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 { begin: '^[^\\n";]+::(?!=)' },
54 {
55 begin: '^[^\\n";]+:(?!=)',
56 // zero relevance as it catches a lot of things
57 // followed by a single ':' in many languages
58 relevance: 0
59 }
60 ]
61 },
62 {
63 className: 'meta',
64 begin: '^\\s*#\\w+',
65 end: '$',
66 relevance: 0
67 },
68 {
69 className: 'built_in',
70 begin: 'A_[a-zA-Z0-9]+'
71 },
72 {
73 // consecutive commas, not for highlighting but just for relevance
74 begin: ',\\s*,' }
75 ]
76 };
77 }
78
79 return autohotkey;
80
81 })();
82 ;
83 export default hljsGrammar;