Merge pull request #431 from Golmote/prism-applescript Add AppleScript language
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/components.js b/components.js
index 8ecccd3..e49a3e4 100644
--- a/components.js
+++ b/components.js
@@ -245,6 +245,10 @@ var components = {
"pascal": {
"title": "Pascal",
"owner": "Golmote"
+ },
+ "applescript": {
+ "title": "AppleScript",
+ "owner": "Golmote"
}
},
"plugins": {
diff --git a/components/prism-applescript.js b/components/prism-applescript.js
new file mode 100644
index 0000000..9dd52bc
--- /dev/null
+++ b/components/prism-applescript.js
@@ -0,0 +1,23 @@
+/* TODO
+ Add support for nested block comments...
+*/
+
+Prism.languages.applescript = {
+ 'comment': [
+ /\(\*[\w\W]*?\*\)/,
+ /--.+/,
+ /#.+/
+ ],
+ 'string': /"(?:\\?.)*?"/,
+ 'operator': [
+ /[&=≠≤≥*+\-\/÷^]|[<>]=?/,
+ /\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/
+ ],
+ 'keyword': /\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,
+ 'class': {
+ pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,
+ alias: 'builtin'
+ },
+ 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/,
+ 'punctuation': /[{}():,¬«»《》]/
+};
\ No newline at end of file
diff --git a/components/prism-applescript.min.js b/components/prism-applescript.min.js
new file mode 100644
index 0000000..4b52d13
--- /dev/null
+++ b/components/prism-applescript.min.js
@@ -0,0 +1 @@
+Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=\u2260\u2264\u2265*+\-\/\xf7^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,\xac\xab\xbb\u300a\u300b]/};
\ No newline at end of file