]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/applescript.js
1 /*! `applescript` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Authors: Nathan Grigg <nathan@nathanamy.org>, Dr. Drang <drdrang@gmail.com>
10 Website: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
14 /** @type LanguageFn */
15 function applescript(hljs
) {
16 const regex
= hljs
.regex
;
17 const STRING
= hljs
.inherit(
18 hljs
.QUOTE_STRING_MODE
, { illegal: null });
29 const COMMENT_MODE_1
= hljs
.COMMENT(/--/, /$/);
30 const COMMENT_MODE_2
= hljs
.COMMENT(
34 'self', // allow nesting
41 hljs
.HASH_COMMENT_MODE
44 const KEYWORD_PATTERNS
= [
50 /isn
't|(doesn't
|does not
) (equal
|come before
|come after
|contain
)/,
51 /(greater
|less
) than( or equal
)?/,
52 /(starts
?|ends
|begins
?) with/,
54 /comes (before
|after
)/,
61 const BUILT_IN_PATTERNS
= [
65 /list (disks
|folder
)/,
68 /(close
|open
for) access
/,
72 /get volume settings
/,
78 /(load
|run
|store
) script
/,
79 /scripting components
/,
80 /ASCII (character
|number
)/,
82 /choose (application
|color
|file
|file name
|folder
|from list
|remote application
|URL
)/,
83 /display (alert
|dialog
)/
88 aliases: [ 'osascript' ],
91 'about above after against and around as at back before beginning '
92 + 'behind below beneath beside between but by considering '
93 + 'contain contains continue copy div does eighth else end equal '
94 + 'equals error every exit fifth first for fourth from front '
95 + 'get given global if ignoring in into is it its last local me '
96 + 'middle mod my ninth not of on onto or over prop property put ref '
97 + 'reference repeat returning script second set seventh since '
98 + 'sixth some tell tenth that the|0 then third through thru '
99 + 'timeout times to transaction try until where while whose with '
102 'AppleScript false linefeed return pi quote result space tab true',
104 'alias application boolean class constant date file integer list '
105 + 'number real record string text '
106 + 'activate beep count delay launch log offset read round '
107 + 'run say summarize write '
108 + 'character characters contents day frontmost id item length '
109 + 'month name|0 paragraph paragraphs rest reverse running time version '
110 + 'weekday word words year'
116 className: 'built_in',
119 regex
.either(...BUILT_IN_PATTERNS
),
124 className: 'built_in',
125 begin: /^\s*return\b/
128 className: 'literal',
130 /\b(text item delimiters
|current application
|missing value
)\b/
133 className: 'keyword',
136 regex
.either(...KEYWORD_PATTERNS
),
144 hljs
.UNDERSCORE_TITLE_MODE
,
150 illegal: /\/\/|->|=>|\[\[/
158 hljs
.registerLanguage('applescript', hljsGrammar
);