Add syntax highlighter to view
parent
cc7891ada3
commit
13b4225ae0
@ -0,0 +1,6 @@
|
||||
define(['prism'], function (Prism) {
|
||||
return function (text, language) {
|
||||
language = language || 'javascript';
|
||||
return Prism.highlight(text, Prism.languages[language]);
|
||||
};
|
||||
});
|
@ -1,4 +1,2 @@
|
||||
<div class="copy"></div>
|
||||
<code code="language-javascript"><pre class="language-javascript">
|
||||
{{code}}
|
||||
</pre></code>
|
||||
<pre><code class="language-javascript"></code></pre>
|
||||
|
@ -0,0 +1,9 @@
|
||||
define(['jquery', 'lib/syntax'], function ($, syntax) {
|
||||
describe('syntax', function () {
|
||||
it('→ converts javascript to html', function () {
|
||||
var src = 'function () {console.log("hi");}';
|
||||
var actual = syntax(src);
|
||||
expect($(actual).text()).toBe(src);
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "prism",
|
||||
"main": [
|
||||
"prism.js",
|
||||
"themes/prism.css"
|
||||
],
|
||||
"homepage": "http://prismjs.com",
|
||||
"authors": "Lea Verou",
|
||||
"description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"img",
|
||||
"templates",
|
||||
"CNAME",
|
||||
"*.html",
|
||||
"style.css",
|
||||
"favicon.png",
|
||||
"logo.svg",
|
||||
"download.js",
|
||||
"prefixfree.min.js",
|
||||
"utopia.js",
|
||||
"code.js"
|
||||
],
|
||||
"_release": "e147458ad2",
|
||||
"_resolution": {
|
||||
"type": "branch",
|
||||
"branch": "gh-pages",
|
||||
"commit": "e147458ad2befc0cdd4072d5c0805c11496ce958"
|
||||
},
|
||||
"_source": "git@github.com:LeaVerou/prism.git",
|
||||
"_target": "gh-pages",
|
||||
"_originalSource": "git@github.com:LeaVerou/prism.git",
|
||||
"_direct": true
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
MIT LICENSE
|
||||
|
||||
Copyright (c) 2012-2013 Lea Verou
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "prism",
|
||||
"version": "0.0.1",
|
||||
"main": [
|
||||
"prism.js",
|
||||
"themes/prism.css"
|
||||
],
|
||||
"homepage": "http://prismjs.com",
|
||||
"authors": "Lea Verou",
|
||||
"description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"img",
|
||||
"templates",
|
||||
"CNAME",
|
||||
"*.html",
|
||||
"style.css",
|
||||
"favicon.png",
|
||||
"logo.svg",
|
||||
"download.js",
|
||||
"prefixfree.min.js",
|
||||
"utopia.js",
|
||||
"code.js"
|
||||
]
|
||||
}
|
@ -0,0 +1,334 @@
|
||||
var components = {
|
||||
"core": {
|
||||
"meta": {
|
||||
"path": "components/prism-core.js",
|
||||
"option": "mandatory"
|
||||
},
|
||||
"core": "Core"
|
||||
},
|
||||
"themes": {
|
||||
"meta": {
|
||||
"path": "themes/{id}.css",
|
||||
"link": "index.html?theme={id}",
|
||||
"exclusive": true
|
||||
},
|
||||
"prism": {
|
||||
"title": "Default",
|
||||
"option": "default"
|
||||
},
|
||||
"prism-dark": "Dark",
|
||||
"prism-funky": "Funky",
|
||||
"prism-okaidia": {
|
||||
"title": "Okaidia",
|
||||
"owner": "ocodia"
|
||||
},
|
||||
"prism-twilight": {
|
||||
"title": "Twilight",
|
||||
"owner": "remybach"
|
||||
},
|
||||
"prism-coy": {
|
||||
"title": "Coy",
|
||||
"owner": "tshedor"
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
"meta": {
|
||||
"path": "components/prism-{id}",
|
||||
"noCSS": true,
|
||||
"examplesPath": "examples/prism-{id}"
|
||||
},
|
||||
"markup": {
|
||||
"title": "Markup",
|
||||
"option": "default"
|
||||
},
|
||||
"twig": {
|
||||
"title": "Twig",
|
||||
"require": "markup",
|
||||
"owner": "brandonkelly"
|
||||
},
|
||||
"css": {
|
||||
"title": "CSS",
|
||||
"option": "default"
|
||||
},
|
||||
"css-extras": {
|
||||
"title": "CSS Extras",
|
||||
"require": "css",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"clike": {
|
||||
"title": "C-like",
|
||||
"option": "default"
|
||||
},
|
||||
"eiffel": {
|
||||
"title": "Eiffel",
|
||||
"owner": "Conaclos"
|
||||
},
|
||||
"javascript": {
|
||||
"title": "JavaScript",
|
||||
"option": "default",
|
||||
"require": "clike"
|
||||
},
|
||||
"java": {
|
||||
"title": "Java",
|
||||
"require": "clike",
|
||||
"owner": "sherblot"
|
||||
},
|
||||
"php": {
|
||||
"title": "PHP",
|
||||
"require": "clike",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"php-extras": {
|
||||
"title": "PHP Extras",
|
||||
"require": "php",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"coffeescript": {
|
||||
"title": "CoffeeScript",
|
||||
"require": "javascript",
|
||||
"owner": "R-osey"
|
||||
},
|
||||
"scss": {
|
||||
"title": "Sass (Scss)",
|
||||
"require": "css",
|
||||
"owner": "MoOx"
|
||||
},
|
||||
"bash": {
|
||||
"title": "Bash",
|
||||
"require": "clike",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"c": {
|
||||
"title": "C",
|
||||
"require": "clike",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"cpp": {
|
||||
"title": "C++",
|
||||
"require": "c",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"python": {
|
||||
"title": "Python",
|
||||
"owner": "multipetros"
|
||||
},
|
||||
"julia": {
|
||||
"title": "julia",
|
||||
"owner": "cdagnino"
|
||||
},
|
||||
"sql": {
|
||||
"title": "SQL",
|
||||
"owner": "multipetros"
|
||||
},
|
||||
"groovy": {
|
||||
"title": "Groovy",
|
||||
"require": "clike",
|
||||
"owner": "robfletcher"
|
||||
},
|
||||
"http": {
|
||||
"title": "HTTP",
|
||||
"owner": "danielgtaylor"
|
||||
},
|
||||
"ruby": {
|
||||
"title": "Ruby",
|
||||
"require": "clike",
|
||||
"owner": "samflores"
|
||||
},
|
||||
"rip": {
|
||||
"title": "Rip",
|
||||
"owner": "ravinggenius"
|
||||
},
|
||||
"gherkin": {
|
||||
"title": "Gherkin",
|
||||
"owner": "mvalipour"
|
||||
},
|
||||
"csharp": {
|
||||
"title": "C#",
|
||||
"require": "clike",
|
||||
"owner": "mvalipour"
|
||||
},
|
||||
"go": {
|
||||
"title": "Go",
|
||||
"require": "clike",
|
||||
"owner": "arnehormann"
|
||||
},
|
||||
"nsis": {
|
||||
"title": "NSIS",
|
||||
"owner": "idleberg"
|
||||
},
|
||||
"aspnet": {
|
||||
"title": "ASP.NET (C#)",
|
||||
"require": "markup",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"scala": {
|
||||
"title": "Scala",
|
||||
"require": "java",
|
||||
"owner": "jozic"
|
||||
},
|
||||
"haskell": {
|
||||
"title": "Haskell",
|
||||
"owner": "bholst"
|
||||
},
|
||||
"swift": {
|
||||
"title": "Swift",
|
||||
"require": "clike",
|
||||
"owner": "chrischares"
|
||||
},
|
||||
"objectivec": {
|
||||
"title": "Objective-C",
|
||||
"require": "c",
|
||||
"owner": "uranusjr"
|
||||
},
|
||||
"autohotkey": {
|
||||
"title": "AutoHotkey",
|
||||
"owner": "aviaryan"
|
||||
},
|
||||
"ini": {
|
||||
"title": "Ini",
|
||||
"owner": "aviaryan"
|
||||
},
|
||||
"latex": {
|
||||
"title": "LaTeX",
|
||||
"owner": "japborst"
|
||||
},
|
||||
"apacheconf": {
|
||||
"title": "Apache Configuration",
|
||||
"owner": "GuiTeK"
|
||||
},
|
||||
"git": {
|
||||
"title": "Git",
|
||||
"owner": "lgiraudel"
|
||||
},
|
||||
"scheme" : {
|
||||
"title": "Scheme",
|
||||
"owner" : "bacchus123"
|
||||
},
|
||||
"nasm": {
|
||||
"title": "NASM",
|
||||
"owner": "rbmj"
|
||||
},
|
||||
"perl": {
|
||||
"title": "Perl",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"handlebars": {
|
||||
"title": "Handlebars",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"matlab": {
|
||||
"title": "MATLAB",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"less": {
|
||||
"title": "Less",
|
||||
"require": "css",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"r": {
|
||||
"title": "R",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"lolcode": {
|
||||
"title": "LOLCODE",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"fortran": {
|
||||
"title": "Fortran",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"erlang": {
|
||||
"title": "Erlang",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"haml": {
|
||||
"title": "Haml",
|
||||
"require": "ruby",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"jade": {
|
||||
"title": "Jade",
|
||||
"require": "javascript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"pascal": {
|
||||
"title": "Pascal",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"applescript": {
|
||||
"title": "AppleScript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"rust": {
|
||||
"title": "Rust",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"dart": {
|
||||
"title": "Dart",
|
||||
"require": "clike",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"powershell": {
|
||||
"title": "PowerShell",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"smarty": {
|
||||
"title": "Smarty",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"actionscript": {
|
||||
"title": "ActionScript",
|
||||
"require": "javascript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"markdown": {
|
||||
"title": "Markdown",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"jsx":{
|
||||
"title": "React JSX",
|
||||
"require": ["markup", "javascript"],
|
||||
"owner": "vkbansal"
|
||||
},
|
||||
"typescript":{
|
||||
"title": "TypeScript",
|
||||
"require": "javascript",
|
||||
"owner": "vkbansal"
|
||||
},
|
||||
"fsharp": {
|
||||
"title": "F#",
|
||||
"require": "clike",
|
||||
"owner": "simonreynolds7"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"meta": {
|
||||
"path": "plugins/{id}/prism-{id}",
|
||||
"link": "plugins/{id}/"
|
||||
},
|
||||
"line-highlight": "Line Highlight",
|
||||
"line-numbers": {
|
||||
"title": "Line Numbers",
|
||||
"owner": "kuba-kubula"
|
||||
},
|
||||
"show-invisibles": "Show Invisibles",
|
||||
"autolinker": "Autolinker",
|
||||
"wpd": "WebPlatform Docs",
|
||||
"file-highlight": {
|
||||
"title": "File Highlight",
|
||||
"noCSS": true
|
||||
},
|
||||
"show-language": {
|
||||
"title": "Show Language",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"highlight-keywords": {
|
||||
"title": "Highlight Keywords",
|
||||
"owner": "vkbansal",
|
||||
"noCSS": true
|
||||
}
|
||||
}
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
/* TODO
|
||||
Fix XML highlighting
|
||||
*/
|
||||
|
||||
Prism.languages.actionscript = Prism.languages.extend('javascript', {
|
||||
'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,
|
||||
'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=)=?|[=~?@]/
|
||||
});
|
||||
Prism.languages.actionscript['class-name'].alias = 'function';
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('actionscript', 'operator', {
|
||||
'xml': {
|
||||
pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -0,0 +1 @@
|
||||
Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=)=?|[=~?@]/}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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': /[{}():,¬«»《》]/
|
||||
};
|
@ -0,0 +1 @@
|
||||
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:/[{}():,¬«»《》]/};
|
@ -0,0 +1,49 @@
|
||||
Prism.languages.aspnet = Prism.languages.extend('markup', {
|
||||
'page-directive tag': {
|
||||
pattern: /<%\s*@.*%>/gi,
|
||||
inside: {
|
||||
'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master|MasterType|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/ig,
|
||||
rest: Prism.languages.markup.tag.inside
|
||||
}
|
||||
},
|
||||
'directive tag': {
|
||||
pattern: /<%.*%>/gi,
|
||||
inside: {
|
||||
'directive tag': /<%\s*?[$=%#:]{0,2}|%>/gi,
|
||||
rest: Prism.languages.csharp
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// match directives of attribute value foo="<% Bar %>"
|
||||
Prism.languages.insertBefore('inside', 'punctuation', {
|
||||
'directive tag': Prism.languages.aspnet['directive tag']
|
||||
}, Prism.languages.aspnet.tag.inside["attr-value"]);
|
||||
|
||||
Prism.languages.insertBefore('aspnet', 'comment', {
|
||||
'asp comment': /<%--[\w\W]*?--%>/g
|
||||
});
|
||||
|
||||
// script runat="server" contains csharp, not javascript
|
||||
Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', {
|
||||
'asp script': {
|
||||
pattern: /<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/ig,
|
||||
inside: {
|
||||
tag: {
|
||||
pattern: /<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,
|
||||
inside: Prism.languages.aspnet.tag.inside
|
||||
},
|
||||
rest: Prism.languages.csharp || {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Hacks to fix eager tag matching finishing too early: <script src="<% Foo.Bar %>"> => <script src="<% Foo.Bar %>
|
||||
if ( Prism.languages.aspnet.style ) {
|
||||
Prism.languages.aspnet.style.inside.tag.pattern = /<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi;
|
||||
Prism.languages.aspnet.style.inside.tag.inside = Prism.languages.aspnet.tag.inside;
|
||||
}
|
||||
if ( Prism.languages.aspnet.script ) {
|
||||
Prism.languages.aspnet.script.inside.tag.pattern = Prism.languages.aspnet['asp script'].inside.tag.pattern;
|
||||
Prism.languages.aspnet.script.inside.tag.inside = Prism.languages.aspnet.tag.inside;
|
||||
}
|
@ -0,0 +1 @@
|
||||
Prism.languages.aspnet=Prism.languages.extend("markup",{"page-directive tag":{pattern:/<%\s*@.*%>/gi,inside:{"page-directive tag":/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master|MasterType|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/gi,rest:Prism.languages.markup.tag.inside}},"directive tag":{pattern:/<%.*%>/gi,inside:{"directive tag":/<%\s*?[$=%#:]{0,2}|%>/gi,rest:Prism.languages.csharp}}}),Prism.languages.insertBefore("inside","punctuation",{"directive tag":Prism.languages.aspnet["directive tag"]},Prism.languages.aspnet.tag.inside["attr-value"]),Prism.languages.insertBefore("aspnet","comment",{"asp comment":/<%--[\w\W]*?--%>/g}),Prism.languages.insertBefore("aspnet",Prism.languages.javascript?"script":"tag",{"asp script":{pattern:/<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:Prism.languages.aspnet.tag.inside},rest:Prism.languages.csharp||{}}}}),Prism.languages.aspnet.style&&(Prism.languages.aspnet.style.inside.tag.pattern=/<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,Prism.languages.aspnet.style.inside.tag.inside=Prism.languages.aspnet.tag.inside),Prism.languages.aspnet.script&&(Prism.languages.aspnet.script.inside.tag.pattern=Prism.languages.aspnet["asp script"].inside.tag.pattern,Prism.languages.aspnet.script.inside.tag.inside=Prism.languages.aspnet.tag.inside);
|
@ -0,0 +1,27 @@
|
||||
// NOTES - follows first-first highlight method, block is locked after highlight, different from SyntaxHl
|
||||
Prism.languages.autohotkey= {
|
||||
'comment': {
|
||||
pattern: /(^[^";\n]*("[^"\n]*?"[^"\n]*?)*)(;.*$|^\s*\/\*[\s\S]*\n\*\/)/gm,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /"(([^"\n\r]|"")*)"/gm,
|
||||
'function': /[^\(\); \t,\n\+\*\-=\?>:\\\/<&%\[\]]+?(?=\()/gm, //function - don't use .*\) in the end bcoz string locks it
|
||||
'tag': /^[ \t]*[^\s:]+?(?=:[^:])/gm, //labels
|
||||
'variable': /%\w+%/g,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
|
||||
'operator': /[\+\-\*\\\/:=\?&\|<>]/g,
|
||||
'punctuation': /[\{}[\]\(\):]/g,
|
||||
'boolean': /\b(true|false)\b/g,
|
||||
|
||||
'selector': /\b(AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,
|
||||
|
||||
'constant': /\b(a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i,
|
||||
|
||||
'builtin': /\b(abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i,
|
||||
|
||||
'symbol': /\b(alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|control|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pause|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,
|
||||
|
||||
'important': /#\b(AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i,
|
||||
|
||||
'keyword': /\b(Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Click|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|Delete|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Exp|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|Ln|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Right|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i
|
||||
};
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@
|
||||
Prism.languages.bash = Prism.languages.extend('clike', {
|
||||
'comment': {
|
||||
pattern: /(^|[^"{\\])(#.*?(\r?\n|$))/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': {
|
||||
//allow multiline string
|
||||
pattern: /("|')(\\?[\s\S])*?\1/g,
|
||||
inside: {
|
||||
//'property' class reused for bash variables
|
||||
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g
|
||||
}
|
||||
},
|
||||
'keyword': /\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('bash', 'keyword', {
|
||||
//'property' class reused for bash variables
|
||||
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g
|
||||
});
|
||||
Prism.languages.insertBefore('bash', 'comment', {
|
||||
//shebang must be before comment, 'important' class from css reused
|
||||
'important': /(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.bash=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])(#.*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/("|')(\\?[\s\S])*?\1/g,inside:{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g}},keyword:/\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g}),Prism.languages.insertBefore("bash","keyword",{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g}),Prism.languages.insertBefore("bash","comment",{important:/(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g});
|
@ -0,0 +1,26 @@
|
||||
Prism.languages.c = Prism.languages.extend('clike', {
|
||||
// allow for c multiline strings
|
||||
'string': /("|')([^\n\\\1]|\\.|\\\r*\n)*?\1/g,
|
||||
'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/g,
|
||||
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\//g
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('c', 'string', {
|
||||
// property class reused for macro statements
|
||||
'property': {
|
||||
// allow for multiline macro definitions
|
||||
// spaces after the # character compile fine with gcc
|
||||
pattern: /((^|\n)\s*)#\s*[a-z]+([^\n\\]|\\.|\\\r*\n)*/gi,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
// highlight the path of the include statement as a string
|
||||
'string': {
|
||||
pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/g,
|
||||
lookbehind: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
delete Prism.languages.c['class-name'];
|
||||
delete Prism.languages.c['boolean'];
|
@ -0,0 +1 @@
|
||||
Prism.languages.c=Prism.languages.extend("clike",{string:/("|')([^\n\\\1]|\\.|\\\r*\n)*?\1/g,keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/g,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\//g}),Prism.languages.insertBefore("c","string",{property:{pattern:/((^|\n)\s*)#\s*[a-z]+([^\n\\]|\\.|\\\r*\n)*/gi,lookbehind:!0,inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/g,lookbehind:!0}}}}),delete Prism.languages.c["class-name"],delete Prism.languages.c["boolean"];
|
@ -0,0 +1,32 @@
|
||||
Prism.languages.clike = {
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\/\*[\w\W]*?\*\//g,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'string': /("|')(\\\n|\\?.)*?\1/g,
|
||||
'class-name': {
|
||||
pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
punctuation: /(\.|\\)/
|
||||
}
|
||||
},
|
||||
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,
|
||||
'boolean': /\b(true|false)\b/g,
|
||||
'function': {
|
||||
pattern: /[a-z0-9_]+\(/ig,
|
||||
inside: {
|
||||
punctuation: /\(/
|
||||
}
|
||||
},
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
|
||||
'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g,
|
||||
'ignore': /&(lt|gt|amp);/gi,
|
||||
'punctuation': /[{}[\];(),.:]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:/("|')(\\\n|\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};
|
@ -0,0 +1,83 @@
|
||||
(function(Prism) {
|
||||
|
||||
// Ignore comments starting with { to privilege string interpolation highlighting
|
||||
var comment = /#(?!\{).+/g,
|
||||
interpolation = {
|
||||
pattern: /#\{[^}]+\}/g,
|
||||
alias: 'variable'
|
||||
};
|
||||
|
||||
Prism.languages.coffeescript = Prism.languages.extend('javascript', {
|
||||
'comment': comment,
|
||||
'string': [
|
||||
|
||||
// Strings are multiline
|
||||
/'(?:\\?[\s\S])*?'/g,
|
||||
|
||||
{
|
||||
// Strings are multiline
|
||||
pattern: /"(?:\\?[\s\S])*?"/g,
|
||||
inside: {
|
||||
'interpolation': interpolation
|
||||
}
|
||||
}
|
||||
],
|
||||
'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g,
|
||||
'class-member': {
|
||||
pattern: /@(?!\d)\w+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'comment', {
|
||||
'multiline-comment': {
|
||||
pattern: /###[\s\S]+?###/g,
|
||||
alias: 'comment'
|
||||
},
|
||||
|
||||
// Block regexp can contain comments and interpolation
|
||||
'block-regex': {
|
||||
pattern: /\/{3}[\s\S]*?\/{3}/,
|
||||
alias: 'regex',
|
||||
inside: {
|
||||
'comment': comment,
|
||||
'interpolation': interpolation
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'string', {
|
||||
'inline-javascript': {
|
||||
pattern: /`(?:\\?[\s\S])*?`/g,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^`|`$/g,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
// Block strings
|
||||
'multiline-string': [
|
||||
{
|
||||
pattern: /'''[\s\S]*?'''/,
|
||||
alias: 'string'
|
||||
},
|
||||
{
|
||||
pattern: /"""[\s\S]*?"""/,
|
||||
alias: 'string',
|
||||
inside: {
|
||||
interpolation: interpolation
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'keyword', {
|
||||
// Object property
|
||||
'property': /(?!\d)\w+(?=\s*:(?!:))/g
|
||||
});
|
||||
|
||||
}(Prism));
|
@ -0,0 +1 @@
|
||||
!function(e){var n=/#(?!\{).+/g,t={pattern:/#\{[^}]+\}/g,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:n,string:[/'(?:\\?[\s\S])*?'/g,{pattern:/"(?:\\?[\s\S])*?"/g,inside:{interpolation:t}}],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/g,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:n,interpolation:t}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\?[\s\S])*?`/g,inside:{delimiter:{pattern:/^`|`$/g,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,alias:"string"},{pattern:/"""[\s\S]*?"""/,alias:"string",inside:{interpolation:t}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/g})}(Prism);
|
@ -0,0 +1 @@
|
||||
self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==n)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)t.highlightElement(a,e===!0,n)},highlightElement:function(a,r,i){for(var l,o,s=a;s&&!e.test(s.className);)s=s.parentNode;if(s&&(l=(s.className.match(e)||[,""])[1],o=t.languages[l]),o){a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,s=a.parentNode,/pre/i.test(s.nodeName)&&(s.className=s.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var g=a.textContent;if(g){g=g.replace(/^(?:\r?\n|\r)/,"");var u={element:a,language:l,grammar:o,code:g};if(t.hooks.run("before-highlight",u),r&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){u.highlightedCode=n.stringify(JSON.parse(e.data),l),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(u.element),t.hooks.run("after-highlight",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",u)}}},highlight:function(e,a,r){var i=t.tokenize(e,a);return n.stringify(t.util.encode(i),r)},tokenize:function(e,n){var a=t.Token,r=[e],i=n.rest;if(i){for(var l in i)n[l]=i[l];delete n.rest}e:for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var o=n[l];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var g=o[s],u=g.inside,c=!!g.lookbehind,f=0,h=g.alias;g=g.pattern||g;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,u?t.tokenize(m,u):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+o+">"+i.content+"</"+i.tag+">"},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);
|
@ -0,0 +1,12 @@
|
||||
Prism.languages.cpp = Prism.languages.extend('c', {
|
||||
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
|
||||
'boolean': /\b(true|false)\b/g,
|
||||
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('cpp', 'keyword', {
|
||||
'class-name': {
|
||||
pattern: /(class\s+)[a-z0-9_]+/ig,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.cpp=Prism.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,"boolean":/\b(true|false)\b/g,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g}),Prism.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/gi,lookbehind:!0}});
|
@ -0,0 +1,6 @@
|
||||
Prism.languages.csharp = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/g,
|
||||
'string': /@?("|')(\\?.)*?\1/g,
|
||||
'preprocessor': /^\s*#.*/gm,
|
||||
'number': /\b-?(0x[\da-f]+|\d*\.?\d+)\b/ig
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.csharp=Prism.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/g,string:/@?("|')(\\?.)*?\1/g,preprocessor:/^\s*#.*/gm,number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/gi});
|
@ -0,0 +1,15 @@
|
||||
Prism.languages.css.selector = {
|
||||
pattern: /[^\{\}\s][^\{\}]*(?=\s*\{)/g,
|
||||
inside: {
|
||||
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,
|
||||
'pseudo-class': /:[-\w]+(?:\(.*\))?/g,
|
||||
'class': /\.[-:\.\w]+/g,
|
||||
'id': /#[-:\.\w]+/g
|
||||
}
|
||||
};
|
||||
|
||||
Prism.languages.insertBefore('css', 'function', {
|
||||
'hexcode': /#[\da-f]{3,6}/gi,
|
||||
'entity': /\\[\da-f]{1,8}/gi,
|
||||
'number': /[\d%\.]+/g
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,"pseudo-class":/:[-\w]+(?:\(.*\))?/g,"class":/\.[-:\.\w]+/g,id:/#[-:\.\w]+/g}},Prism.languages.insertBefore("css","function",{hexcode:/#[\da-f]{3,6}/gi,entity:/\\[\da-f]{1,8}/gi,number:/[\d%\.]+/g});
|
@ -0,0 +1,50 @@
|
||||
Prism.languages.css = {
|
||||
'comment': /\/\*[\w\W]*?\*\//g,
|
||||
'atrule': {
|
||||
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/gi,
|
||||
inside: {
|
||||
'punctuation': /[;:]/g
|
||||
}
|
||||
},
|
||||
'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/gi,
|
||||
'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/g,
|
||||
'string': /("|')(\\\n|\\?.)*?\1/g,
|
||||
'property': /(\b|\B)[\w-]+(?=\s*:)/ig,
|
||||
'important': /\B!important\b/gi,
|
||||
'punctuation': /[\{\};:]/g,
|
||||
'function': /[-a-z0-9]+(?=\()/ig
|
||||
};
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
'style': {
|
||||
pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/ig,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /<style[\w\W]*?>|<\/style>/ig,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.css
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('inside', 'attr-value', {
|
||||
'style-attr': {
|
||||
pattern: /\s*style=("|').+?\1/ig,
|
||||
inside: {
|
||||
'attr-name': {
|
||||
pattern: /^\s*style/ig,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
'punctuation': /^\s*=\s*['"]|['"]\s*$/,
|
||||
'attr-value': {
|
||||
pattern: /.+/gi,
|
||||
inside: Prism.languages.css
|
||||
}
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
}, Prism.languages.markup.tag);
|
||||
}
|
@ -0,0 +1 @@
|
||||
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,string:/("|')(\\\n|\\?.)*?\1/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
|
@ -0,0 +1,18 @@
|
||||
Prism.languages.dart = Prism.languages.extend('clike', {
|
||||
'string': [
|
||||
/r?("""|''')[\s\S]*?\1/,
|
||||
/r?("|')(\\?.)*?\1/
|
||||
],
|
||||
'keyword': [
|
||||
/\b(?:async|sync|yield)\*/,
|
||||
/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/
|
||||
],
|
||||
'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('dart','function',{
|
||||
'metadata': {
|
||||
pattern: /@\w+/,
|
||||
alias: 'symbol'
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.dart=Prism.languages.extend("clike",{string:[/r?("""|''')[\s\S]*?\1/,/r?("|')(\\?.)*?\1/],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}});
|
@ -0,0 +1,24 @@
|
||||
Prism.languages.eiffel = {
|
||||
'string': [
|
||||
// Single-line string
|
||||
/"(?:%\s+%|%"|.)*?"/,
|
||||
// Aligned-verbatim-strings
|
||||
/"([^[]*)\[[\s\S]+?\]\1"/,
|
||||
// Non-aligned-verbatim-strings
|
||||
/"([^{]*)\{[\s\S]+?\}\1"/
|
||||
],
|
||||
// (comments including quoted strings not supported)
|
||||
'comment': /--.*/,
|
||||
// normal char | special char | char code
|
||||
'char': /'(?:%'|.)+?'/,
|
||||
'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,
|
||||
'boolean': /\b(?:True|False)\b/gi,
|
||||
'number': [
|
||||
// hexa | octal | bin
|
||||
/\b0[xcb][\da-f](?:_*[\da-f])*\b/ig,
|
||||
// Decimal
|
||||
/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g
|
||||
],
|
||||
'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,
|
||||
'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.eiffel={string:[/"(?:%\s+%|%"|.)*?"/,/"([^[]*)\[[\s\S]+?\]\1"/,/"([^{]*)\{[\s\S]+?\}\1"/],comment:/--.*/,"char":/'(?:%'|.)+?'/,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,"boolean":/\b(?:True|False)\b/gi,number:[/\b0[xcb][\da-f](?:_*[\da-f])*\b/gi,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,operator:/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g};
|
@ -0,0 +1,35 @@
|
||||
Prism.languages.erlang = {
|
||||
'comment': /%.+/,
|
||||
'string': /"(?:\\?.)*?"/,
|
||||
'quoted-function': {
|
||||
pattern: /'[^']+'(?=\()/,
|
||||
alias: 'function'
|
||||
},
|
||||
'quoted-atom': {
|
||||
pattern: /'[^']+'/,
|
||||
alias: 'atom'
|
||||
},
|
||||
'boolean': /\b(?:true|false)\b/,
|
||||
'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
|
||||
'number': [
|
||||
/\$\\?./,
|
||||
/\d+#[a-z0-9]+/i,
|
||||
/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
|
||||
],
|
||||
'function': /\b[a-z][\w@]*(?=\()/,
|
||||
'variable': /(?:\b|\?)[A-Z_][\w@]*/,
|
||||
'operator': [
|
||||
/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
|
||||
{
|
||||
pattern: /(^|(?!<).)<(?!<)/,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|(?!>).)>(?!>)/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'atom': /\b[a-z][\w@]*/,
|
||||
'punctuation': /[()[\]{}:;,.#|]|<<|>>/
|
||||
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.erlang={comment:/%.+/,string:/"(?:\\?.)*?"/,"quoted-function":{pattern:/'[^']+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'[^']+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/],"function":/\b[a-z][\w@]*(?=\()/,variable:/(?:\b|\?)[A-Z_][\w@]*/,operator:[/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|(?!<).)<(?!<)/,lookbehind:!0},{pattern:/(^|(?!>).)>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/};
|
@ -0,0 +1,34 @@
|
||||
Prism.languages.fortran = {
|
||||
'quoted-number': {
|
||||
pattern: /[BOZ](['"])[A-F0-9]+\1/i,
|
||||
alias: 'number'
|
||||
},
|
||||
'string': {
|
||||
pattern: /(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,
|
||||
inside: {
|
||||
'comment': /!.*/
|
||||
}
|
||||
},
|
||||
'comment': /!.*/,
|
||||
'boolean': /\.(?:TRUE|FALSE)\.(?:_\w+)?/i,
|
||||
'number': /(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,
|
||||
'keyword': [
|
||||
// Types
|
||||
/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,
|
||||
// Statements
|
||||
/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,
|
||||
// END statements
|
||||
/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,
|
||||
// Others
|
||||
/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i
|
||||
],
|
||||
'operator': [
|
||||
/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,
|
||||
{
|
||||
// Use lookbehind to prevent confusion with (/ /)
|
||||
pattern: /(^|(?!\().)\/(?!\))/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'punctuation': /\(\/|\/\)|[(),;:&]/
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,inside:{comment:/!.*/}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/};
|
@ -0,0 +1,16 @@
|
||||
Prism.languages.fsharp = Prism.languages.extend('clike', {
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\(\*[\w\W]*?\*\)/g,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*/g,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'keyword': /\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/g,
|
||||
'string': /@?("""|"|')((\\|\n)?.)*?\1B?/g,
|
||||
'preprocessor': /^\s*#.*/gm,
|
||||
'number': [ /\b-?0x[\da-fA-F]+(un|lf|LF)?\b/g, /\b-?0b[01]+(y|uy)?\b/g, /\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/g, /\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/g ]
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.fsharp=Prism.languages.extend("clike",{comment:[{pattern:/(^|[^\\])\(\*[\w\W]*?\*\)/g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/g,lookbehind:!0}],keyword:/\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/g,string:/@?("""|"|')((\\|\n)?.)*?\1B?/g,preprocessor:/^\s*#.*/gm,number:[/\b-?0x[\da-fA-F]+(un|lf|LF)?\b/g,/\b-?0b[01]+(y|uy)?\b/g,/\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/g,/\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/g]});
|
@ -0,0 +1,13 @@
|
||||
// TODO:
|
||||
// - Support for outline parameters
|
||||
// - Support for tables
|
||||
|
||||
Prism.languages.gherkin = {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|((#)|(\/\/)).*?(\r?\n|$))/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /("|')(\\?.)*?\1/g,
|
||||
'atrule': /\b(And|Given|When|Then|In order to|As an|I want to|As a)\b/g,
|
||||
'keyword': /\b(Scenario Outline|Scenario|Feature|Background|Story)\b/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.gherkin={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|((#)|(\/\/)).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,atrule:/\b(And|Given|When|Then|In order to|As an|I want to|As a)\b/g,keyword:/\b(Scenario Outline|Scenario|Feature|Background|Story)\b/g};
|
@ -0,0 +1,68 @@
|
||||
Prism.languages.git = {
|
||||
/*
|
||||
* A simple one line comment like in a git status command
|
||||
* For instance:
|
||||
* $ git status
|
||||
* # On branch infinite-scroll
|
||||
* # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
|
||||
* # and have 1 and 2 different commits each, respectively.
|
||||
* nothing to commit (working directory clean)
|
||||
*/
|
||||
'comment': /^#.*$/m,
|
||||
|
||||
/*
|
||||
* a string (double and simple quote)
|
||||
*/
|
||||
'string': /("|')(\\?.)*?\1/gm,
|
||||
|
||||
/*
|
||||
* a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
||||
* For instance:
|
||||
* $ git add file.txt
|
||||
*/
|
||||
'command': {
|
||||
pattern: /^.*\$ git .*$/m,
|
||||
inside: {
|
||||
/*
|
||||
* A git command can contain a parameter starting by a single or a double dash followed by a string
|
||||
* For instance:
|
||||
* $ git diff --cached
|
||||
* $ git log -p
|
||||
*/
|
||||
'parameter': /\s(--|-)\w+/m
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Coordinates displayed in a git diff command
|
||||
* For instance:
|
||||
* $ git diff
|
||||
* diff --git file.txt file.txt
|
||||
* index 6214953..1d54a52 100644
|
||||
* --- file.txt
|
||||
* +++ file.txt
|
||||
* @@ -1 +1,2 @@
|
||||
* -Here's my tetx file
|
||||
* +Here's my text file
|
||||
* +And this is the second line
|
||||
*/
|
||||
'coord': /^@@.*@@$/m,
|
||||
|
||||
/*
|
||||
* Regexp to match the changed lines in a git diff output. Check the example above.
|
||||
*/
|
||||
'deleted': /^-(?!-).+$/m,
|
||||
'inserted': /^\+(?!\+).+$/m,
|
||||
|
||||
/*
|
||||
* Match a "commit [SHA1]" line in a git log output.
|
||||
* For instance:
|
||||
* $ git log
|
||||
* commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
|
||||
* Author: lgiraudel
|
||||
* Date: Mon Feb 17 11:18:34 2014 +0100
|
||||
*
|
||||
* Add of a new line
|
||||
*/
|
||||
'commit_sha1': /^commit \w{40}$/m
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/gm,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-(?!-).+$/m,inserted:/^\+(?!\+).+$/m,commit_sha1:/^commit \w{40}$/m};
|
@ -0,0 +1,9 @@
|
||||
Prism.languages.go = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/g,
|
||||
'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/g,
|
||||
'boolean': /\b(_|iota|nil|true|false)\b/g,
|
||||
'operator': /([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/g,
|
||||
'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/ig,
|
||||
'string': /("|'|`)(\\?.|\r|\n)*?\1/g
|
||||
});
|
||||
delete Prism.languages.go['class-name'];
|
@ -0,0 +1 @@
|
||||
Prism.languages.go=Prism.languages.extend("clike",{keyword:/\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/g,builtin:/\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/g,"boolean":/\b(_|iota|nil|true|false)\b/g,operator:/([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/g,number:/\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/gi,string:/("|'|`)(\\?.|\r|\n)*?\1/g}),delete Prism.languages.go["class-name"];
|
@ -0,0 +1,50 @@
|
||||
Prism.languages.groovy = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/g,
|
||||
'string': /("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g,
|
||||
'number': /\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi,
|
||||
'operator': {
|
||||
pattern: /(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}<?(?=\w)|->|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'punctuation': /\.+|[{}[\];(),:$]/g
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'string', {
|
||||
'shebang': {
|
||||
pattern: /#!.+/,
|
||||
alias: 'comment'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'punctuation', {
|
||||
'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/g
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'function', {
|
||||
'annotation': {
|
||||
pattern: /(^|[^.])@\w+/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
if (env.language === 'groovy' && env.type === 'string') {
|
||||
var delimiter = env.content[0];
|
||||
|
||||
if (delimiter != "'") {
|
||||
var pattern = /([^\\])(\$(\{.*?\}|[\w\.]+))/;
|
||||
if (delimiter === '$') {
|
||||
pattern = /([^\$])(\$(\{.*?\}|[\w\.]+))/;
|
||||
}
|
||||
env.content = Prism.highlight(env.content, {
|
||||
'expression': {
|
||||
pattern: pattern,
|
||||
lookbehind: true,
|
||||
inside: Prism.languages.groovy
|
||||
}
|
||||
});
|
||||
|
||||
env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.groovy=Prism.languages.extend("clike",{keyword:/\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/g,string:/("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g,number:/\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi,operator:{pattern:/(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}<?(?=\w)|->|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/g,lookbehind:!0},punctuation:/\.+|[{}[\];(),:$]/g}),Prism.languages.insertBefore("groovy","string",{shebang:{pattern:/#!.+/,alias:"comment"}}),Prism.languages.insertBefore("groovy","punctuation",{"spock-block":/\b(setup|given|when|then|and|cleanup|expect|where):/g}),Prism.languages.insertBefore("groovy","function",{annotation:{pattern:/(^|[^.])@\w+/,lookbehind:!0}}),Prism.hooks.add("wrap",function(e){if("groovy"===e.language&&"string"===e.type){var t=e.content[0];if("'"!=t){var n=/([^\\])(\$(\{.*?\}|[\w\.]+))/;"$"===t&&(n=/([^\$])(\$(\{.*?\}|[\w\.]+))/),e.content=Prism.highlight(e.content,{expression:{pattern:n,lookbehind:!0,inside:Prism.languages.groovy}}),e.classes.push("/"===t?"regex":"gstring")}}});
|
@ -0,0 +1,161 @@
|
||||
/* TODO
|
||||
Handle multiline code after tag
|
||||
%foo= some |
|
||||
multiline |
|
||||
code |
|
||||
*/
|
||||
|
||||
(function(Prism) {
|
||||
|
||||
Prism.languages.haml = {
|
||||
// Multiline stuff should appear before the rest
|
||||
|
||||
'multiline-comment': [
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
},
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
}
|
||||
],
|
||||
|
||||
'multiline-code': [
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
// See at the end of the file for known filters
|
||||
'filter': {
|
||||
pattern: /((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'markup': {
|
||||
pattern: /((?:^|\n)[\t ]*)<.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
},
|
||||
'doctype': {
|
||||
pattern: /((?:^|\n)[\t ]*)!!!(?: .+)?/,
|
||||
lookbehind: true
|
||||
},
|
||||
'tag': {
|
||||
// Allows for one nested group of braces
|
||||
pattern: /((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'attributes': [
|
||||
{
|
||||
// Lookbehind tries to prevent interpolations for breaking it all
|
||||
// Allows for one nested group of braces
|
||||
pattern: /(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\([^)]+\)/,
|
||||
inside: {
|
||||
'attr-value': {
|
||||
pattern: /(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'attr-name': /[\w:-]+(?=\s*!?=|\s*[,)])/,
|
||||
'punctuation': /[=(),]/
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\[[^\]]+\]/,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[<>]/
|
||||
}
|
||||
},
|
||||
'code': {
|
||||
pattern: /((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
// Interpolations in plain text
|
||||
'interpolation': {
|
||||
pattern: /#\{[^}]+\}/,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^#\{|\}$/,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
'punctuation': {
|
||||
pattern: /((?:^|\n)[\t ]*)[~=\-&!]/,
|
||||
lookbehind: true
|
||||
}
|
||||
};
|
||||
|
||||
var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+';
|
||||
|
||||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
'css',
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
'erb',
|
||||
'javascript',
|
||||
'less',
|
||||
'markdown',
|
||||
'ruby',
|
||||
'scss',
|
||||
'textile'
|
||||
];
|
||||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', filter.filter)),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
},
|
||||
rest: Prism.languages[filter.language]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Prism.languages.insertBefore('haml', 'filter', all_filters);
|
||||
|
||||
}(Prism));
|
@ -0,0 +1 @@
|
||||
!function(e){e.languages.haml={"multiline-comment":[{pattern:/((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},{pattern:/((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"}],"multiline-code":[{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,lookbehind:!0,inside:{rest:e.languages.ruby}}],filter:{pattern:/((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},doctype:{pattern:/((?:^|\n)[\t ]*)!!!(?: .+)?/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:e.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:e.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:e.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=["css",{filter:"coffee",language:"coffeescript"},"erb","javascript","less","markdown","ruby","scss","textile"],a={},i=0,r=n.length;r>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("haml","filter",a)}(Prism);
|
@ -0,0 +1,82 @@
|
||||
(function(Prism) {
|
||||
|
||||
var handlebars_pattern = /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;
|
||||
|
||||
Prism.languages.handlebars = Prism.languages.extend('markup', {
|
||||
'handlebars': {
|
||||
pattern: handlebars_pattern,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^\{\{\{?|\}\}\}?$/ig,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'string': /(["'])(\\?.)+?\1/g,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
|
||||
'boolean': /\b(true|false)\b/g,
|
||||
'block': {
|
||||
pattern: /^(\s*~?\s*)[#\/]\w+/ig,
|
||||
lookbehind: true,
|
||||
alias: 'keyword'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: /\[[^\]]+\]/,
|
||||
inside: {
|
||||
punctuation: /\[|\]/g,
|
||||
variable: /[\w\W]+/g
|
||||
}
|
||||
},
|
||||
'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,
|
||||
'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Comments are inserted at top so that they can
|
||||
// surround markup
|
||||
Prism.languages.insertBefore('handlebars', 'tag', {
|
||||
'handlebars-comment': {
|
||||
pattern: /\{\{![\w\W]*?\}\}/g,
|
||||
alias: ['handlebars','comment']
|
||||
}
|
||||
});
|
||||
|
||||
// Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}}
|
||||
// This allows for easy Handlebars + markup highlighting
|
||||
Prism.hooks.add('before-highlight', function(env) {
|
||||
if (env.language !== 'handlebars') {
|
||||
return;
|
||||
}
|
||||
|
||||
env.tokenStack = [];
|
||||
|
||||
env.backupCode = env.code;
|
||||
env.code = env.code.replace(handlebars_pattern, function(match) {
|
||||
env.tokenStack.push(match);
|
||||
|
||||
return '___HANDLEBARS' + env.tokenStack.length + '___';
|
||||
});
|
||||
});
|
||||
|
||||
// Restore env.code for other plugins (e.g. line-numbers)
|
||||
Prism.hooks.add('before-insert', function(env) {
|
||||
if (env.language === 'handlebars') {
|
||||
env.code = env.backupCode;
|
||||
delete env.backupCode;
|
||||
}
|
||||
});
|
||||
|
||||
// Re-insert the tokens after highlighting
|
||||
// and highlight them with defined grammar
|
||||
Prism.hooks.add('after-highlight', function(env) {
|
||||
if (env.language !== 'handlebars') {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0, t; t = env.tokenStack[i]; i++) {
|
||||
env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars'));
|
||||
}
|
||||
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
});
|
||||
|
||||
}(Prism));
|
@ -0,0 +1 @@
|
||||
!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*?\}\}/g,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}})}(Prism);
|
@ -0,0 +1,32 @@
|
||||
Prism.languages.haskell= {
|
||||
'comment': {
|
||||
pattern: /(^|[^-!#$%*+=\?&@|~.:<>^\\])(--[^-!#$%*+=\?&@|~.:<>^\\].*(\r?\n|$)|{-[\w\W]*?-})/gm,
|
||||
lookbehind: true
|
||||
},
|
||||
'char': /'([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+))'/g,
|
||||
'string': /"([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+)|\\\s+\\)*"/g,
|
||||
'keyword' : /\b(case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/g,
|
||||
'import_statement' : {
|
||||
// The imported or hidden names are not included in this import
|
||||
// statement. This is because we want to highlight those exactly like
|
||||
// we do for the names in the program.
|
||||
pattern: /(\n|^)\s*(import)\s+(qualified\s+)?(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*)(\s+(as)\s+(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*))?(\s+hiding\b)?/gm,
|
||||
inside: {
|
||||
'keyword': /\b(import|qualified|as|hiding)\b/g
|
||||
}
|
||||
},
|
||||
// These are builtin variables only. Constructors are highlighted later as a constant.
|
||||
'builtin': /\b(abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/g,
|
||||
// decimal integers and floating point numbers | octal integers | hexadecimal integers
|
||||
'number' : /\b(\d+(\.\d+)?([eE][+-]?\d+)?|0[Oo][0-7]+|0[Xx][0-9a-fA-F]+)\b/g,
|
||||
// Most of this is needed because of the meaning of a single '.'.
|
||||
// If it stands alone freely, it is the function composition.
|
||||
// It may also be a separator between a module name and an identifier => no
|
||||
// operator. If it comes together with other special characters it is an
|
||||
// operator too.
|
||||
'operator' : /\s\.\s|([-!#$%*+=\?&@|~:<>^\\]*\.[-!#$%*+=\?&@|~:<>^\\]+)|([-!#$%*+=\?&@|~:<>^\\]+\.[-!#$%*+=\?&@|~:<>^\\]*)|[-!#$%*+=\?&@|~:<>^\\]+|(`([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*`)/g,
|
||||
// In Haskell, nearly everything is a variable, do not highlight these.
|
||||
'hvariable': /\b([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*\b/g,
|
||||
'constant': /\b([A-Z][_a-zA-Z0-9']*\.)*[A-Z][_a-zA-Z0-9']*\b/g,
|
||||
'punctuation' : /[{}[\];(),.:]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.haskell={comment:{pattern:/(^|[^-!#$%*+=\?&@|~.:<>^\\])(--[^-!#$%*+=\?&@|~.:<>^\\].*(\r?\n|$)|{-[\w\W]*?-})/gm,lookbehind:!0},"char":/'([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+))'/g,string:/"([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+)|\\\s+\\)*"/g,keyword:/\b(case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/g,import_statement:{pattern:/(\n|^)\s*(import)\s+(qualified\s+)?(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*)(\s+(as)\s+(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*))?(\s+hiding\b)?/gm,inside:{keyword:/\b(import|qualified|as|hiding)\b/g}},builtin:/\b(abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/g,number:/\b(\d+(\.\d+)?([eE][+-]?\d+)?|0[Oo][0-7]+|0[Xx][0-9a-fA-F]+)\b/g,operator:/\s\.\s|([-!#$%*+=\?&@|~:<>^\\]*\.[-!#$%*+=\?&@|~:<>^\\]+)|([-!#$%*+=\?&@|~:<>^\\]+\.[-!#$%*+=\?&@|~:<>^\\]*)|[-!#$%*+=\?&@|~:<>^\\]+|(`([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*`)/g,hvariable:/\b([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*\b/g,constant:/\b([A-Z][_a-zA-Z0-9']*\.)*[A-Z][_a-zA-Z0-9']*\b/g,punctuation:/[{}[\];(),.:]/g};
|
@ -0,0 +1,44 @@
|
||||
Prism.languages.http = {
|
||||
'request-line': {
|
||||
pattern: /^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,
|
||||
inside: {
|
||||
// HTTP Verb
|
||||
property: /^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,
|
||||
// Path or query argument
|
||||
'attr-name': /:\w+/g
|
||||
}
|
||||
},
|
||||
'response-status': {
|
||||
pattern: /^HTTP\/1.[01] [0-9]+.*/g,
|
||||
inside: {
|
||||
// Status, e.g. 200 OK
|
||||
property: /[0-9]+[A-Z\s-]+$/ig
|
||||
}
|
||||
},
|
||||
// HTTP header name
|
||||
keyword: /^[\w-]+:(?=.+)/gm
|
||||
};
|
||||
|
||||
// Create a mapping of Content-Type headers to language definitions
|
||||
var httpLanguages = {
|
||||
'application/json': Prism.languages.javascript,
|
||||
'application/xml': Prism.languages.markup,
|
||||
'text/xml': Prism.languages.markup,
|
||||
'text/html': Prism.languages.markup
|
||||
};
|
||||
|
||||
// Insert each content type parser that has its associated language
|
||||
// currently loaded.
|
||||
for (var contentType in httpLanguages) {
|
||||
if (httpLanguages[contentType]) {
|
||||
var options = {};
|
||||
options[contentType] = {
|
||||
pattern: new RegExp('(content-type:\\s*' + contentType + '[\\w\\W]*?)\\n\\n[\\w\\W]*', 'gi'),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: httpLanguages[contentType]
|
||||
}
|
||||
};
|
||||
Prism.languages.insertBefore('http', 'keyword', options);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,"attr-name":/:\w+/g}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/g,inside:{property:/[0-9]+[A-Z\s-]+$/gi}},keyword:/^[\w-]+:(?=.+)/gm};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","gi"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}},Prism.languages.insertBefore("http","keyword",options)}
|
@ -0,0 +1,11 @@
|
||||
Prism.languages.ini= {
|
||||
'comment': /^\s*;.*$/gm,
|
||||
'important': /\[.*?\]/gm,
|
||||
'constant': /^\s*[^\s=]+?(?=[ \t]*=)/gm,
|
||||
'attr-value': {
|
||||
pattern: /=.*/gm,
|
||||
inside: {
|
||||
'punctuation': /^[=]/g
|
||||
}
|
||||
}
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.ini={comment:/^\s*;.*$/gm,important:/\[.*?\]/gm,constant:/^\s*[^\s=]+?(?=[ \t]*=)/gm,"attr-value":{pattern:/=.*/gm,inside:{punctuation:/^[=]/g}}};
|
@ -0,0 +1,196 @@
|
||||
(function(Prism) {
|
||||
Prism.languages.jade = {
|
||||
|
||||
// Multiline stuff should appear before the rest
|
||||
|
||||
'multiline-comment': {
|
||||
pattern: /((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
},
|
||||
|
||||
// All the tag-related part is in lookbehind
|
||||
// so that it can be highlighted by the "tag" pattern
|
||||
'multiline-script': {
|
||||
pattern: /((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
// See at the end of the file for known filters
|
||||
'filter': {
|
||||
pattern: /((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'multiline-plain-text': {
|
||||
pattern: /((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'markup': {
|
||||
pattern: /((?:^|\n)[\t ]*)<.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
},
|
||||
'comment': {
|
||||
pattern: /((?:^|\n)[\t ]*)\/\/.+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'doctype': {
|
||||
pattern: /((?:^|\n)[\t ]*)doctype(?: .+)?/,
|
||||
lookbehind: true
|
||||
},
|
||||
|
||||
// This handle all conditional and loop keywords
|
||||
'flow-control': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'each': {
|
||||
pattern: /((?:^|\n)[\t ]*)each .+? in\b/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'keyword': /\b(?:each|in)\b/,
|
||||
'punctuation': /,/
|
||||
}
|
||||
},
|
||||
'branch': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,
|
||||
lookbehind: true,
|
||||
alias: 'keyword'
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
'keyword': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'mixin': [
|
||||
// Declaration
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*)mixin .+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'keyword': /^mixin/,
|
||||
'function': /\w+(?=\s*\(|\s*$)/,
|
||||
'punctuation': /[(),.]/
|
||||
}
|
||||
},
|
||||
// Usage
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*)\+.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'name': {
|
||||
pattern: /^\+\w+/,
|
||||
alias: 'function'
|
||||
},
|
||||
'rest': Prism.languages.javascript
|
||||
}
|
||||
}
|
||||
],
|
||||
'script': {
|
||||
pattern: /((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
'plain-text': {
|
||||
pattern: /((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'tag': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'attributes': [
|
||||
{
|
||||
pattern: /&[^(]+\([^)]+\)/,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\([^)]+\)/,
|
||||
inside: {
|
||||
'attr-value': {
|
||||
pattern: /(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
'attr-name': /[\w-]+(?=\s*!?=|\s*[,)])/,
|
||||
'punctuation': /[!=(),]/
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[:]/
|
||||
}
|
||||
},
|
||||
'code': [
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*(?:-|!?=)).+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[.\-!=|]/
|
||||
};
|
||||
|
||||
var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+';
|
||||
|
||||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
{filter:'atpl',language:'twig'},
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
'ejs',
|
||||
'handlebars',
|
||||
'hogan',
|
||||
'less',
|
||||
'livescript',
|
||||
'markdown',
|
||||
'mustache',
|
||||
'plates',
|
||||
{filter:'sass',language:'scss'},
|
||||
'stylus',
|
||||
'swig'
|
||||
|
||||
];
|
||||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', filter.filter)),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
},
|
||||
rest: Prism.languages[filter.language]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Prism.languages.insertBefore('jade', 'filter', all_filters);
|
||||
|
||||
}(Prism));
|
@ -0,0 +1 @@
|
||||
!function(e){e.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:e.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:e.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:e.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:e.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:e.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:e.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:e.languages.javascript}}],punctuation:/[.\-!=|]/};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","hogan","less","livescript","markdown","mustache","plates",{filter:"sass",language:"scss"},"stylus","swig"],a={},i=0,s=n.length;s>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("jade","filter",a)}(Prism);
|
@ -0,0 +1,8 @@
|
||||
Prism.languages.java = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,
|
||||
'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/gi,
|
||||
'operator': {
|
||||
pattern: /(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/gm,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/gi,operator:{pattern:/(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/gm,lookbehind:!0}});
|
@ -0,0 +1,28 @@
|
||||
Prism.languages.javascript = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,
|
||||
'function': /(?!\d)[a-z0-9_$]+(?=\()/ig
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('javascript', 'keyword', {
|
||||
'regex': {
|
||||
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
'script': {
|
||||
pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/ig,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /<script[\w\W]*?>|<\/script>/ig,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
},
|
||||
alias: 'language-javascript'
|
||||
}
|
||||
});
|
||||
}
|
@ -0,0 +1 @@
|
||||
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}});
|
@ -0,0 +1,22 @@
|
||||
(function(Prism) {
|
||||
|
||||
var javascript = Prism.util.clone(Prism.languages.javascript);
|
||||
|
||||
Prism.languages.jsx = Prism.languages.extend('markup', javascript);
|
||||
Prism.languages.jsx.tag.pattern= /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/gi;
|
||||
|
||||
Prism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/gi;
|
||||
|
||||
Prism.languages.insertBefore('inside', 'attr-value',{
|
||||
'script': {
|
||||
pattern: /=(\{[\w\W]*?\})/gi,
|
||||
inside: {
|
||||
'function' : Prism.languages.javascript.function,
|
||||
'punctuation': /[={}[\];(),.:]/,
|
||||
'keyword': Prism.languages.javascript.keyword
|
||||
},
|
||||
'alias': 'language-javascript'
|
||||
}
|
||||
}, Prism.languages.jsx.tag);
|
||||
|
||||
}(Prism));
|
@ -0,0 +1 @@
|
||||
!function(a){var s=a.util.clone(a.languages.javascript);a.languages.jsx=a.languages.extend("markup",s),a.languages.jsx.tag.pattern=/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/gi,a.languages.jsx.tag.inside["attr-value"].pattern=/=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,a.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{[\w\W]*?\})/gi,inside:{"function":a.languages.javascript.function,punctuation:/[={}[\];(),.:]/,keyword:a.languages.javascript.keyword},alias:"language-javascript"}},a.languages.jsx.tag)}(Prism);
|
@ -0,0 +1,12 @@
|
||||
Prism.languages.julia= {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,
|
||||
'keyword' : /\b(abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|let|local|macro|module|print|println|quote|return|try|type|typealias|using|while)\b/g,
|
||||
'boolean' : /\b(true|false)\b/g,
|
||||
'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi,
|
||||
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
|
||||
'punctuation' : /[{}[\];(),.:]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.julia={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,keyword:/\b(abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|let|local|macro|module|print|println|quote|return|try|type|typealias|using|while)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi,operator:/[-+]{1,2}|=?<|=?>|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,punctuation:/[{}[\];(),.:]/g};
|
@ -0,0 +1,6 @@
|
||||
Prism.languages.latex = {
|
||||
'comment': /%.*?(\r?\n|$)$/m,
|
||||
'string': /(\$)(\\?.)*?\1/g,
|
||||
'punctuation': /[{}]/g,
|
||||
'selector': /\\[a-z;,:\.]*/i
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.latex={comment:/%.*?(\r?\n|$)$/m,string:/(\$)(\\?.)*?\1/g,punctuation:/[{}]/g,selector:/\\[a-z;,:\.]*/i};
|
@ -0,0 +1,60 @@
|
||||
/* FIXME :
|
||||
:extend() is not handled specifically : its highlighting is buggy.
|
||||
Mixin usage must be inside a ruleset to be highlighted.
|
||||
At-rules (e.g. import) containing interpolations are buggy.
|
||||
Detached rulesets are highlighted as at-rules.
|
||||
A comment before a mixin usage prevents the latter to be properly highlighted.
|
||||
*/
|
||||
|
||||
Prism.languages.less = Prism.languages.extend('css', {
|
||||
'comment': [
|
||||
/\/\*[\w\W]*?\*\//g,
|
||||
{
|
||||
pattern: /(^|[^\\])\/\/.+/g,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'atrule': {
|
||||
pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,
|
||||
inside: {
|
||||
'punctuation': /[:()]/g
|
||||
}
|
||||
},
|
||||
// selectors and mixins are considered the same
|
||||
'selector': {
|
||||
pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,
|
||||
inside: {
|
||||
// mixin parameters
|
||||
'variable': /@+[\w-]+/
|
||||
}
|
||||
},
|
||||
|
||||
'property': /(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/ig,
|
||||
'punctuation': /[{}();:,]/g,
|
||||
'operator': /[+\-*\/]/
|
||||
});
|
||||
|
||||
// Invert function and punctuation positions
|
||||
Prism.languages.insertBefore('less', 'punctuation', {
|
||||
'function': Prism.languages.less.function
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('less', 'property', {
|
||||
'variable': [
|
||||
// Variable declaration (the colon must be consumed!)
|
||||
{
|
||||
pattern: /@[\w-]+\s*:/,
|
||||
inside: {
|
||||
"punctuation": /:/
|
||||
}
|
||||
},
|
||||
|
||||
// Variable usage
|
||||
/@@?[\w-]+/
|
||||
],
|
||||
'mixin-usage': {
|
||||
pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
|
||||
lookbehind: true,
|
||||
alias: 'function'
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}});
|
@ -0,0 +1,54 @@
|
||||
Prism.languages.lolcode = {
|
||||
'comment': [
|
||||
/\bOBTW\s+[\s\S]*?\s+TLDR\b/,
|
||||
/\bBTW.+/
|
||||
],
|
||||
'string': {
|
||||
pattern: /"(?::.|[^"])*"/,
|
||||
inside: {
|
||||
'variable': /:\{[^}]+\}/,
|
||||
'symbol': [
|
||||
/:\([a-f\d]+\)/i,
|
||||
/:\[[^\]]+\]/,
|
||||
/:[)>o":]/
|
||||
]
|
||||
}
|
||||
},
|
||||
'number': /(-|\b)\d*\.?\d+/,
|
||||
'symbol': {
|
||||
pattern: /(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'keyword': /A(?=\s)/
|
||||
}
|
||||
},
|
||||
'label': {
|
||||
pattern: /((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,
|
||||
lookbehind: true,
|
||||
alias: 'string'
|
||||
},
|
||||
'function': {
|
||||
pattern: /((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'keyword': [
|
||||
{
|
||||
pattern: /(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
/'Z(?=\s|,|$)/
|
||||
],
|
||||
'boolean': {
|
||||
pattern: /(^|\s)(?:WIN|FAIL)(?=\s|,|$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'variable': {
|
||||
pattern: /(^|\s)(?:IT)(?=\s|,|$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'operator': {
|
||||
pattern: /(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'punctuation': /\.{3}|\u2026|,|!/
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.lolcode={comment:[/\bOBTW\s+[\s\S]*?\s+TLDR\b/,/\bBTW.+/],string:{pattern:/"(?::.|[^"])*"/,inside:{variable:/:\{[^}]+\}/,symbol:[/:\([a-f\d]+\)/i,/:\[[^\]]+\]/,/:[)>o":]/]}},number:/(-|\b)\d*\.?\d+/,symbol:{pattern:/(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/,lookbehind:!0,inside:{keyword:/A(?=\s)/}},label:{pattern:/((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,lookbehind:!0,alias:"string"},"function":{pattern:/((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/,lookbehind:!0},keyword:[{pattern:/(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/,lookbehind:!0},/'Z(?=\s|,|$)/],"boolean":{pattern:/(^|\s)(?:WIN|FAIL)(?=\s|,|$)/,lookbehind:!0},variable:{pattern:/(^|\s)(?:IT)(?=\s|,|$)/,lookbehind:!0},operator:{pattern:/(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/,lookbehind:!0},punctuation:/\.{3}|\u2026|,|!/};
|
@ -0,0 +1,122 @@
|
||||
Prism.languages.markdown = Prism.languages.extend('markup', {});
|
||||
Prism.languages.insertBefore('markdown', 'prolog', {
|
||||
'blockquote': {
|
||||
// > ...
|
||||
pattern: /(^|\n)>(?:[\t ]*>)*/,
|
||||
lookbehind: true,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'code': [
|
||||
{
|
||||
// Prefixed by 4 spaces or 1 tab
|
||||
pattern: /(^|\n)(?: {4}|\t).+/,
|
||||
lookbehind: true,
|
||||
alias: 'keyword'
|
||||
},
|
||||
{
|
||||
// `code`
|
||||
// ``code``
|
||||
pattern: /``.+?``|`[^`\n]+`/,
|
||||
alias: 'keyword'
|
||||
}
|
||||
],
|
||||
'title': [
|
||||
{
|
||||
// title 1
|
||||
// =======
|
||||
|
||||
// title 2
|
||||
// -------
|
||||
pattern: /\w+.*\n(?:==+|--+)/,
|
||||
alias: 'important',
|
||||
inside: {
|
||||
punctuation: /==+$|--+$/
|
||||
}
|
||||
},
|
||||
{
|
||||
// # title 1
|
||||
// ###### title 6
|
||||
pattern: /((?:^|\n)\s*)#+.+/,
|
||||
lookbehind: true,
|
||||
alias: 'important',
|
||||
inside: {
|
||||
punctuation: /^#+|#+$/
|
||||
}
|
||||
}
|
||||
],
|
||||
'hr': {
|
||||
// ***
|
||||
// ---
|
||||
// * * *
|
||||
// -----------
|
||||
pattern: /((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/,
|
||||
lookbehind: true,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'list': {
|
||||
// * item
|
||||
// + item
|
||||
// - item
|
||||
// 1. item
|
||||
pattern: /((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/,
|
||||
lookbehind: true,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'url-reference': {
|
||||
// [id]: http://example.com "Optional title"
|
||||
// [id]: http://example.com 'Optional title'
|
||||
// [id]: http://example.com (Optional title)
|
||||
// [id]: <http://example.com> "Optional title"
|
||||
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,
|
||||
inside: {
|
||||
'variable': {
|
||||
pattern: /^(!?\[)[^\]]+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/,
|
||||
'punctuation': /[[\]\(\)<>:]/
|
||||
},
|
||||
alias: 'url'
|
||||
},
|
||||
'bold': {
|
||||
// **strong**
|
||||
// __strong__
|
||||
|
||||
// Allow only one line break
|
||||
pattern: /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'punctuation': /^\*\*|^__|\*\*\s*$|__\s*$/
|
||||
}
|
||||
},
|
||||
'italic': {
|
||||
// *em*
|
||||
// _em_
|
||||
|
||||
// Allow only one line break
|
||||
pattern: /(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'punctuation': /^[*_]|[*_]$/
|
||||
}
|
||||
},
|
||||
'url': {
|
||||
// [example](http://example.com "Optional title")
|
||||
// [example] [id]
|
||||
pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/,
|
||||
inside: {
|
||||
'variable': {
|
||||
pattern: /(!?\[)[^\]]+(?=\]$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /"(?:[^"]|\\")*"(?=\)$)/
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.markdown['bold'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
|
||||
Prism.languages.markdown['italic'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
|
||||
Prism.languages.markdown['bold'].inside['italic'] = Prism.util.clone(Prism.languages.markdown['italic']);
|
||||
Prism.languages.markdown['italic'].inside['bold'] = Prism.util.clone(Prism.languages.markdown['bold']);
|
@ -0,0 +1 @@
|
||||
Prism.languages.markdown=Prism.languages.extend("markup",{}),Prism.languages.insertBefore("markdown","prolog",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"punctuation"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/,lookbehind:!0,alias:"punctuation"},list:{pattern:/((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/,punctuation:/[[\]\(\)<>:]/},alias:"url"},bold:{pattern:/(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*\s*$|__\s*$/}},italic:{pattern:/(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:[^"]|\\")*"(?=\)$)/}}}}),Prism.languages.markdown.bold.inside.url=Prism.util.clone(Prism.languages.markdown.url),Prism.languages.markdown.italic.inside.url=Prism.util.clone(Prism.languages.markdown.url),Prism.languages.markdown.bold.inside.italic=Prism.util.clone(Prism.languages.markdown.italic),Prism.languages.markdown.italic.inside.bold=Prism.util.clone(Prism.languages.markdown.bold);
|
@ -0,0 +1,41 @@
|
||||
Prism.languages.markup = {
|
||||
'comment': /<!--[\w\W]*?-->/g,
|
||||
'prolog': /<\?.+?\?>/,
|
||||
'doctype': /<!DOCTYPE.+?>/,
|
||||
'cdata': /<!\[CDATA\[[\w\W]*?]]>/i,
|
||||
'tag': {
|
||||
pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /^<\/?[\w:-]+/i,
|
||||
inside: {
|
||||
'punctuation': /^<\/?/,
|
||||
'namespace': /^[\w-]+?:/
|
||||
}
|
||||
},
|
||||
'attr-value': {
|
||||
pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,
|
||||
inside: {
|
||||
'punctuation': /=|>|"/g
|
||||
}
|
||||
},
|
||||
'punctuation': /\/?>/g,
|
||||
'attr-name': {
|
||||
pattern: /[\w:-]+/g,
|
||||
inside: {
|
||||
'namespace': /^[\w-]+?:/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
'entity': /&#?[\da-z]{1,8};/gi
|
||||
};
|
||||
|
||||
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
|
||||
if (env.type === 'entity') {
|
||||
env.attributes['title'] = env.content.replace(/&/, '&');
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))});
|
@ -0,0 +1,17 @@
|
||||
Prism.languages.matlab = {
|
||||
// We put string before comment, because of printf() patterns that contain "%"
|
||||
'string': {
|
||||
pattern: /(^|\W)'(?:''|[^'\n])*'/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'comment': [
|
||||
/%\{[\s\S]*?\}%/g,
|
||||
/%.+/g
|
||||
],
|
||||
// FIXME We could handle imaginary numbers as a whole
|
||||
'number': /\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,
|
||||
'keyword': /\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,
|
||||
'function': /(?!\d)\w+(?=\s*\()/g,
|
||||
'operator': /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g,
|
||||
'punctuation': /\.{3}|[.,;\[\](){}!]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.matlab={string:{pattern:/(^|\W)'(?:''|[^'\n])*'/g,lookbehind:!0},comment:[/%\{[\s\S]*?\}%/g,/%.+/g],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!]/g};
|
@ -0,0 +1,20 @@
|
||||
Prism.languages.nasm = {
|
||||
'comment': /;.*$/m,
|
||||
'string': /("|'|`)(\\?.)*?\1/gm,
|
||||
'label': {
|
||||
pattern: /^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,
|
||||
alias: 'function'
|
||||
},
|
||||
'keyword': [
|
||||
/\[?BITS (16|32|64)\]?/m,
|
||||
/^\s*section\s*[a-zA-Z\.]+:?/im,
|
||||
/(?:extern|global)[^;]*/im,
|
||||
/(?:CPU|FLOAT|DEFAULT).*$/m
|
||||
],
|
||||
'register': {
|
||||
pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,
|
||||
alias: 'variable'
|
||||
},
|
||||
'number': /(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,
|
||||
'operator': /[\[\]\*+\-\/%<>=&|\$!]/gm
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm};
|
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Original by Jan T. Sott (http://github.com/idleberg)
|
||||
*
|
||||
* Includes all commands and plug-ins shipped with NSIS 3.0a2
|
||||
*/
|
||||
Prism.languages.nsis = {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /("|')(\\?.)*?\1/g,
|
||||
'keyword': /\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,
|
||||
'property': /\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,
|
||||
'variable': /(\$(\(|\{)?[-_\w]+)(\)|\})?/i,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
|
||||
'operator': /[-+]{1,2}|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g,
|
||||
'punctuation': /[{}[\];(),.:]/g,
|
||||
'important': /!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.nsis={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,property:/\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,variable:/(\$(\(|\{)?[-_\w]+)(\)|\})?/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g,punctuation:/[{}[\];(),.:]/g,important:/!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi};
|
@ -0,0 +1,5 @@
|
||||
Prism.languages.objectivec = Prism.languages.extend('c', {
|
||||
'keyword': /(\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b)|((?=[\w|@])(@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b)/g,
|
||||
'string': /(?:("|')([^\n\\\1]|\\.|\\\r*\n)*?\1)|(@"([^\n\\"]|\\.|\\\r*\n)*?")/g,
|
||||
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|@/g
|
||||
});
|
@ -0,0 +1 @@
|
||||
Prism.languages.objectivec=Prism.languages.extend("c",{keyword:/(\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b)|((?=[\w|@])(@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b)/g,string:/(?:("|')([^\n\\\1]|\\.|\\\r*\n)*?\1)|(@"([^\n\\"]|\\.|\\\r*\n)*?")/g,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|@/g});
|
@ -0,0 +1,54 @@
|
||||
// Based on Free Pascal
|
||||
|
||||
/* TODO
|
||||
Support inline asm ?
|
||||
*/
|
||||
|
||||
Prism.languages.pascal = {
|
||||
'comment': [
|
||||
/\(\*[\s\S]+?\*\)/,
|
||||
/\{[\s\S]+?\}/,
|
||||
/\/\/.*/
|
||||
],
|
||||
'string': [
|
||||
/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,
|
||||
// Char
|
||||
/\^[a-z]/i
|
||||
],
|
||||
'keyword': [
|
||||
{
|
||||
// Turbo Pascal
|
||||
pattern: /(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
// Free Pascal
|
||||
pattern: /(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
// Object Pascal
|
||||
pattern: /(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
// Modifiers
|
||||
pattern: /(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'number': [
|
||||
// Hexadecimal, octal and binary
|
||||
/[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,
|
||||
// Decimal
|
||||
/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
|
||||
],
|
||||
'operator': [
|
||||
/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,
|
||||
{
|
||||
pattern: /(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.pascal={comment:[/\(\*[\s\S]+?\*\)/,/\{[\s\S]+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/};
|
@ -0,0 +1,112 @@
|
||||
Prism.languages.perl = {
|
||||
'comment': [
|
||||
{
|
||||
// POD
|
||||
pattern: /((?:^|\n)\s*)=\w+[\s\S]*?=cut.*/g,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\$])#.*?(\r?\n|$)/g,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
// TODO Could be nice to handle Heredoc too.
|
||||
'string': [
|
||||
// q/.../
|
||||
/\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1/g,
|
||||
|
||||
// q a...a
|
||||
/\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(\\?.)*?\s*\1/g,
|
||||
|
||||
// q(...)
|
||||
/\b(?:q|qq|qx|qw)\s*\(([^()]|\\.)*\s*\)/g,
|
||||
|
||||
// q{...}
|
||||
/\b(?:q|qq|qx|qw)\s*\{([^{}]|\\.)*\s*\}/g,
|
||||
|
||||
// q[...]
|
||||
/\b(?:q|qq|qx|qw)\s*\[([^[\]]|\\.)*\s*\]/g,
|
||||
|
||||
// q<...>
|
||||
/\b(?:q|qq|qx|qw)\s*<([^<>]|\\.)*\s*>/g,
|
||||
|
||||
// "...", '...', `...`
|
||||
/("|'|`)(\\?.)*?\1/g
|
||||
],
|
||||
'regex': [
|
||||
// m/.../
|
||||
/\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1[msixpodualgc]*/g,
|
||||
|
||||
// m a...a
|
||||
/\b(?:m|qr)\s+([a-zA-Z0-9])(\\?.)*?\s*\1[msixpodualgc]*/g,
|
||||
|
||||
// m(...)
|
||||
/\b(?:m|qr)\s*\(([^()]|\\.)*\s*\)[msixpodualgc]*/g,
|
||||
|
||||
// m{...}
|
||||
/\b(?:m|qr)\s*\{([^{}]|\\.)*\s*\}[msixpodualgc]*/g,
|
||||
|
||||
// m[...]
|
||||
/\b(?:m|qr)\s*\[([^[\]]|\\.)*\s*\][msixpodualgc]*/g,
|
||||
|
||||
// m<...>
|
||||
/\b(?:m|qr)\s*<([^<>]|\\.)*\s*>[msixpodualgc]*/g,
|
||||
|
||||
// s/.../.../
|
||||
/\b(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,
|
||||
|
||||
// s a...a...a
|
||||
/\b(?:s|tr|y)\s+([a-zA-Z0-9])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,
|
||||
|
||||
// s(...)(...)
|
||||
/\b(?:s|tr|y)\s*\(([^()]|\\.)*\s*\)\s*\(\s*([^()]|\\.)*\s*\)[msixpodualgcer]*/g,
|
||||
|
||||
// s{...}{...}
|
||||
/\b(?:s|tr|y)\s*\{([^{}]|\\.)*\s*\}\s*\{\s*([^{}]|\\.)*\s*\}[msixpodualgcer]*/g,
|
||||
|
||||
// s[...][...]
|
||||
/\b(?:s|tr|y)\s*\[([^[\]]|\\.)*\s*\]\s*\[\s*([^[\]]|\\.)*\s*\][msixpodualgcer]*/g,
|
||||
|
||||
// s<...><...>
|
||||
/\b(?:s|tr|y)\s*<([^<>]|\\.)*\s*>\s*<\s*([^<>]|\\.)*\s*>[msixpodualgcer]*/g,
|
||||
|
||||
// /.../
|
||||
/\/(\[.+?]|\\.|[^\/\r\n])*\/[msixpodualgc]*(?=\s*($|[\r\n,.;})&|\-+*=~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/g
|
||||
],
|
||||
|
||||
// FIXME Not sure about the handling of ::, ', and #
|
||||
'variable': [
|
||||
// ${^POSTMATCH}
|
||||
/[&*\$@%]\{\^[A-Z]+\}/g,
|
||||
// $^V
|
||||
/[&*\$@%]\^[A-Z_]/g,
|
||||
// ${...}
|
||||
/[&*\$@%]#?(?=\{)/,
|
||||
// $foo
|
||||
/[&*\$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/ig,
|
||||
// $1
|
||||
/[&*\$@%]\d+/g,
|
||||
// $_, @_, %!
|
||||
/[\$@%][!"#\$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/g
|
||||
],
|
||||
'filehandle': {
|
||||
// <>, <FOO>, _
|
||||
pattern: /<(?!=).*>|\b_\b/g,
|
||||
alias: 'symbol'
|
||||
},
|
||||
'vstring': {
|
||||
// v1.2, 1.2.3
|
||||
pattern: /v\d+(\.\d+)*|\d+(\.\d+){2,}/g,
|
||||
alias: 'string'
|
||||
},
|
||||
'function': {
|
||||
pattern: /sub [a-z0-9_]+/ig,
|
||||
inside: {
|
||||
keyword: /sub/
|
||||
}
|
||||
},
|
||||
'keyword': /\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/g,
|
||||
'number': /(\n|\b)-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee]-?\d+)?)\b/g,
|
||||
'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|[-+*=~\/|&]{1,2}|<=?|>=?|\.{1,3}|[!?\\^]|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b/g,
|
||||
'punctuation': /[{}[\];(),:]/g
|
||||
};
|
@ -0,0 +1 @@
|
||||
Prism.languages.perl={comment:[{pattern:/((?:^|\n)\s*)=\w+[\s\S]*?=cut.*/g,lookbehind:!0},{pattern:/(^|[^\\$])#.*?(\r?\n|$)/g,lookbehind:!0}],string:[/\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s*\(([^()]|\\.)*\s*\)/g,/\b(?:q|qq|qx|qw)\s*\{([^{}]|\\.)*\s*\}/g,/\b(?:q|qq|qx|qw)\s*\[([^[\]]|\\.)*\s*\]/g,/\b(?:q|qq|qx|qw)\s*<([^<>]|\\.)*\s*>/g,/("|'|`)(\\?.)*?\1/g],regex:[/\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s+([a-zA-Z0-9])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s*\(([^()]|\\.)*\s*\)[msixpodualgc]*/g,/\b(?:m|qr)\s*\{([^{}]|\\.)*\s*\}[msixpodualgc]*/g,/\b(?:m|qr)\s*\[([^[\]]|\\.)*\s*\][msixpodualgc]*/g,/\b(?:m|qr)\s*<([^<>]|\\.)*\s*>[msixpodualgc]*/g,/\b(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s+([a-zA-Z0-9])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\(([^()]|\\.)*\s*\)\s*\(\s*([^()]|\\.)*\s*\)[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\{([^{}]|\\.)*\s*\}\s*\{\s*([^{}]|\\.)*\s*\}[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\[([^[\]]|\\.)*\s*\]\s*\[\s*([^[\]]|\\.)*\s*\][msixpodualgcer]*/g,/\b(?:s|tr|y)\s*<([^<>]|\\.)*\s*>\s*<\s*([^<>]|\\.)*\s*>[msixpodualgcer]*/g,/\/(\[.+?]|\\.|[^\/\r\n])*\/[msixpodualgc]*(?=\s*($|[\r\n,.;})&|\-+*=~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/g],variable:[/[&*\$@%]\{\^[A-Z]+\}/g,/[&*\$@%]\^[A-Z_]/g,/[&*\$@%]#?(?=\{)/,/[&*\$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/gi,/[&*\$@%]\d+/g,/[\$@%][!"#\$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/g],filehandle:{pattern:/<(?!=).*>|\b_\b/g,alias:"symbol"},vstring:{pattern:/v\d+(\.\d+)*|\d+(\.\d+){2,}/g,alias:"string"},"function":{pattern:/sub [a-z0-9_]+/gi,inside:{keyword:/sub/}},keyword:/\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/g,number:/(\n|\b)-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee]-?\d+)?)\b/g,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|[-+*=~\/|&]{1,2}|<=?|>=?|\.{1,3}|[!?\\^]|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b/g,punctuation:/[{}[\];(),:]/g};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue