From: Tim Düsterhus Date: Sat, 16 May 2020 11:30:38 +0000 (+0200) Subject: Update prism to 1.20.0 X-Git-Tag: 5.3.0_Alpha_1~211^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a59d05579d615ec101f43a56c3452f0785483ee7;p=GitHub%2FWoltLab%2FWCF.git Update prism to 1.20.0 --- diff --git a/wcfsetup/install/files/js/3rdParty/prism/README.md b/wcfsetup/install/files/js/3rdParty/prism/README.md index 30ff9fa5ad..b09d6eb81f 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/README.md +++ b/wcfsetup/install/files/js/3rdParty/prism/README.md @@ -1,28 +1,31 @@ -# [Prism](http://prismjs.com/) +# [Prism](https://prismjs.com/) [![Build Status](https://travis-ci.org/PrismJS/prism.svg?branch=master)](https://travis-ci.org/PrismJS/prism) +[![npm](https://img.shields.io/npm/dw/prismjs.svg)](https://www.npmjs.com/package/prismjs) -Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from [Dabblet](http://dabblet.com/). +Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from [Dabblet](https://dabblet.com/). -You can learn more on http://prismjs.com/. +You can learn more on [prismjs.com](https://prismjs.com/). -Why another syntax highlighter?: http://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841 +[Why another syntax highlighter?](https://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841) + +[More themes for Prism!](https://github.com/PrismJS/prism-themes) ## Contribute to Prism! Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips: -- Read the [documentation](http://prismjs.com/extending.html). Prism was designed to be extensible. -- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the components/ folder. The minified files are also generated automatically. +- Read the [documentation](https://prismjs.com/extending.html). Prism was designed to be extensible. +- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the `components/` folder. The minified files are also generated automatically. - The build system uses [gulp](https://github.com/gulpjs/gulp) to minify the files and build `prism.js`. Having gulp installed, you just need to run the command `gulp`. - Please follow the code conventions used in the files already. For example, I use [tabs for indentation and spaces for alignment](http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/). Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc. - Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult. - My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected. - If you contribute a new language definition, you will be responsible for handling bug reports about that language definition. -- If you add a new language definition, theme or plugin, you need to add it to `components.js` as well, so that it becomes available to the download build page. +- If you add a new language definition, theme or plugin, you need to add it to `components.json` as well and rebuild Prism by running `gulp`, so that it becomes available to the download build page. For new languages, please also add a few [tests](https://prismjs.com/test-suite.html) and an example in the `examples/` folder. Thank you so much for contributing!! ## Translations -* [![中文说明](http://awesomes.oss-cn-beijing.aliyuncs.com/readme.png)](http://www.awesomes.cn/repo/PrismJS/prism) +* [![中文说明](http://awesomes.oss-cn-beijing.aliyuncs.com/readme.png)](https://www.awesomes.cn/repo/PrismJS/prism) diff --git a/wcfsetup/install/files/js/3rdParty/prism/components.json b/wcfsetup/install/files/js/3rdParty/prism/components.json index 2f8c5a6080..70eef9e16d 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components.json +++ b/wcfsetup/install/files/js/3rdParty/prism/components.json @@ -60,17 +60,16 @@ "css": { "title": "CSS", "option": "default", - "peerDependencies": "markup" + "modify": "markup" }, "clike": { "title": "C-like", - "option": "default", - "overrideExampleHeader": true + "option": "default" }, "javascript": { "title": "JavaScript", "require": "clike", - "peerDependencies": "markup", + "modify": "markup", "alias": "js", "option": "default" }, @@ -85,13 +84,18 @@ "actionscript": { "title": "ActionScript", "require": "javascript", - "peerDependencies": "markup", + "modify": "markup", "owner": "Golmote" }, "ada": { "title": "Ada", "owner": "Lucretia" }, + "antlr4": { + "title": "ANTLR4", + "alias": "g4", + "owner": "RunDevelopment" + }, "apacheconf": { "title": "Apache Configuration", "owner": "GuiTeK" @@ -104,6 +108,10 @@ "title": "AppleScript", "owner": "Golmote" }, + "aql": { + "title": "AQL", + "owner": "RunDevelopment" + }, "arduino": { "title": "Arduino", "require": "cpp", @@ -114,7 +122,7 @@ "owner": "Golmote" }, "asciidoc": { - "alias": "adoc", + "alias": "adoc", "title": "AsciiDoc", "owner": "Golmote" }, @@ -151,6 +159,14 @@ "title": "Batch", "owner": "Golmote" }, + "bbcode": { + "title": "BBcode", + "alias": "shortcode", + "aliasTitles": { + "shortcode": "Shortcode" + }, + "owner": "RunDevelopment" + }, "bison": { "title": "Bison", "require": "c", @@ -168,6 +184,10 @@ "title": "Brainfuck", "owner": "Golmote" }, + "brightscript": { + "title": "BrightScript", + "owner": "RunDevelopment" + }, "bro": { "title": "Bro", "owner": "wayward710" @@ -177,6 +197,11 @@ "require": "clike", "owner": "zeitgeist87" }, + "concurnas": { + "title": "Concurnas", + "alias": "conc", + "owner": "jasontatton" + }, "csharp": { "title": "C#", "require": "clike", @@ -218,6 +243,7 @@ "css-extras": { "title": "CSS Extras", "require": "css", + "modify": "css", "owner": "milesj" }, "d": { @@ -230,6 +256,10 @@ "require": "clike", "owner": "Golmote" }, + "dax": { + "title": "DAX", + "owner": "peterbud" + }, "diff": { "title": "Diff", "owner": "uranusjr" @@ -240,6 +270,11 @@ "alias": "jinja2", "owner": "romanvm" }, + "dns-zone-file": { + "title": "DNS zone file", + "owner": "RunDevelopment", + "alias": "dns-zone" + }, "docker": { "title": "Docker", "alias": "dockerfile", @@ -266,6 +301,11 @@ "title": "Elm", "owner": "zwilias" }, + "etlua": { + "title": "Embedded Lua templating", + "require": ["lua", "markup-templating"], + "owner": "RunDevelopment" + }, "erb": { "title": "ERB", "require": ["ruby", "markup-templating"], @@ -275,11 +315,25 @@ "title": "Erlang", "owner": "Golmote" }, + "excel-formula": { + "title": "Excel Formula", + "alias": ["xlsx", "xls"], + "owner": "RunDevelopment" + }, "fsharp": { "title": "F#", "require": "clike", "owner": "simonreynolds7" }, + "factor": { + "title": "Factor", + "owner": "catb0t" + }, + "firestore-security-rules": { + "title": "Firestore security rules", + "require": "clike", + "owner": "RunDevelopment" + }, "flow": { "title": "Flow", "require": "javascript", @@ -289,10 +343,19 @@ "title": "Fortran", "owner": "Golmote" }, + "ftl": { + "title": "FreeMarker Template Language", + "require": "markup-templating", + "owner": "RunDevelopment" + }, "gcode": { "title": "G-code", "owner": "RunDevelopment" }, + "gdscript": { + "title": "GDScript", + "owner": "RunDevelopment" + }, "gedcom": { "title": "GEDCOM", "owner": "Golmote" @@ -333,14 +396,14 @@ "haml": { "title": "Haml", "require": "ruby", - "peerDependencies": [ + "optional": [ "css", + "css-extras", "coffeescript", "erb", "javascript", "less", "markdown", - "ruby", "scss", "textile" ], @@ -367,8 +430,10 @@ }, "http": { "title": "HTTP", - "peerDependencies": [ + "optional": [ + "css", "javascript", + "json", "markup" ], "owner": "danielgtaylor" @@ -413,14 +478,13 @@ "javadoc": { "title": "JavaDoc", "require": ["markup", "java", "javadoclike"], - "peerDependencies": [ - "scala" - ], + "modify": "java", + "optional": "scala", "owner": "RunDevelopment" }, "javadoclike": { "title": "JavaDoc-like", - "peerDependencies": [ + "modify": [ "java", "javascript", "php" @@ -443,7 +507,8 @@ "jsdoc": { "title": "JSDoc", "require": ["javascript", "javadoclike"], - "peerDependencies": [ + "modify": "javascript", + "optional": [ "actionscript", "coffeescript" ], @@ -452,7 +517,8 @@ "js-extras": { "title": "JS Extras", "require": "javascript", - "peerDependencies": [ + "modify": "javascript", + "optional": [ "actionscript", "coffeescript", "flow", @@ -461,6 +527,19 @@ ], "owner": "RunDevelopment" }, + "js-templates": { + "title": "JS Templates", + "require": "javascript", + "modify": "javascript", + "optional": [ + "css", + "css-extras", + "graphql", + "markdown", + "markup" + ], + "owner": "RunDevelopment" + }, "json": { "title": "JSON", "owner": "CupOfTea696" @@ -497,11 +576,23 @@ }, "owner": "japborst" }, + "latte": { + "title": "Latte", + "require": ["clike", "markup-templating", "php"], + "owner": "nette" + }, "less": { "title": "Less", "require": "css", + "optional": "css-extras", "owner": "Golmote" }, + "lilypond": { + "title": "LilyPond", + "require": "scheme", + "alias": "ly", + "owner": "RunDevelopment" + }, "liquid": { "title": "Liquid", "owner": "cinhtau" @@ -515,6 +606,10 @@ "title": "LiveScript", "owner": "Golmote" }, + "llvm": { + "title": "LLVM IR", + "owner": "porglezomp" + }, "lolcode": { "title": "LOLCODE", "owner": "Golmote" @@ -554,6 +649,11 @@ "title": "Monkey", "owner": "Golmote" }, + "moonscript": { + "title": "MoonScript", + "alias": "moon", + "owner": "RunDevelopment" + }, "n1ql": { "title": "N1QL", "owner": "TMWilds" @@ -561,9 +661,7 @@ "n4js": { "title": "N4JS", "require": "javascript", - "peerDependencies": [ - "jsdoc" - ], + "optional": "jsdoc", "alias": "n4jsd", "owner": "bsmith-n4" }, @@ -575,6 +673,10 @@ "title": "NASM", "owner": "rbmj" }, + "neon": { + "title": "NEON", + "owner": "nette" + }, "nginx": { "title": "nginx", "owner": "westonganger", @@ -603,12 +705,11 @@ }, "opencl": { "title": "OpenCL", - "require": "cpp", - "peerDependencies": [ + "require": "c", + "modify": [ "c", "cpp" ], - "overrideExampleHeader": true, "owner": "Milania1" }, "oz": { @@ -632,6 +733,15 @@ }, "owner": "Golmote" }, + "pascaligo": { + "title": "Pascaligo", + "owner": "DefinitelyNotAGoat" + }, + "pcaxis": { + "title": "PC-Axis", + "alias": "px", + "owner": "RunDevelopment" + }, "perl": { "title": "Perl", "owner": "Golmote" @@ -644,11 +754,13 @@ "phpdoc": { "title": "PHPDoc", "require": ["php", "javadoclike"], + "modify": "php", "owner": "RunDevelopment" }, "php-extras": { "title": "PHP Extras", "require": "php", + "modify": "php", "owner": "milesj" }, "plsql": { @@ -656,6 +768,11 @@ "require": "sql", "owner": "Golmote" }, + "powerquery": { + "title": "PowerQuery", + "alias": ["pq", "mscript"], + "owner": "peterbud" + }, "powershell": { "title": "PowerShell", "owner": "nauzilus" @@ -681,7 +798,7 @@ "pug": { "title": "Pug", "require": ["markup", "javascript"], - "peerDependencies": [ + "optional": [ "coffeescript", "ejs", "handlebars", @@ -700,7 +817,7 @@ }, "pure": { "title": "Pure", - "peerDependencies": [ + "optional": [ "c", "cpp", "fortran" @@ -716,6 +833,11 @@ "title": "Q (kdb+ database)", "owner": "Golmote" }, + "qml": { + "title": "QML", + "require": "javascript", + "owner": "RunDevelopment" + }, "qore": { "title": "Qore", "require": "clike", @@ -728,9 +850,10 @@ "jsx": { "title": "React JSX", "require": ["markup", "javascript"], - "peerDependencies": [ + "optional": [ "jsdoc", - "js-extras" + "js-extras", + "js-templates" ], "owner": "vkbansal" }, @@ -749,7 +872,7 @@ }, "regex": { "title": "Regex", - "peerDependencies": [ + "modify": [ "actionscript", "coffeescript", "flow", @@ -771,6 +894,11 @@ "title": "Roboconf", "owner": "Golmote" }, + "robotframework": { + "title": "Robot Framework", + "alias": "robot", + "owner": "RunDevelopment" + }, "ruby": { "title": "Ruby", "require": "clike", @@ -783,6 +911,7 @@ }, "sas": { "title": "SAS", + "optional": ["groovy", "lua", "sql"], "owner": "Golmote" }, "sass": { @@ -793,6 +922,7 @@ "scss": { "title": "Sass (Scss)", "require": "css", + "optional": "css-extras", "owner": "MoOx" }, "scala": { @@ -818,15 +948,40 @@ "require": "markup-templating", "owner": "Golmote" }, - "sql": { - "title": "SQL", - "owner": "multipetros" + "solidity": { + "title": "Solidity (Ethereum)", + "require": "clike", + "owner": "glachaud" + }, + "solution-file": { + "title": "Solution file", + "alias": "sln", + "owner": "RunDevelopment" }, "soy": { "title": "Soy (Closure Template)", "require": "markup-templating", "owner": "Golmote" }, + "sparql": { + "title": "SPARQL", + "require": "turtle", + "owner": "Triply-Dev", + "alias": "rq" + }, + "splunk-spl": { + "title": "Splunk SPL", + "owner": "RunDevelopment" + }, + "sqf": { + "title": "SQF: Status Quo Function (Arma 3)", + "require": "clike", + "owner": "RunDevelopment" + }, + "sql": { + "title": "SQL", + "owner": "multipetros" + }, "stylus": { "title": "Stylus", "owner": "vkbansal" @@ -848,7 +1003,7 @@ "textile": { "title": "Textile", "require": "markup", - "peerDependencies": "css", + "optional": "css", "owner": "Golmote" }, "toml": { @@ -860,6 +1015,14 @@ "require": ["clike", "markup-templating"], "owner": "gflohr" }, + "turtle": { + "title": "Turtle", + "alias": "trig", + "aliasTitles": { + "trig": "TriG" + }, + "owner": "jakubklimek" + }, "twig": { "title": "Twig", "require": "markup", @@ -868,6 +1031,7 @@ "typescript": { "title": "TypeScript", "require": "javascript", + "optional": "js-templates", "alias": "ts", "owner": "vkbansal" }, @@ -949,6 +1113,10 @@ "title": "YAML", "alias": "yml", "owner": "hason" + }, + "zig": { + "title": "Zig", + "owner": "RunDevelopment" } }, "plugins": { @@ -956,90 +1124,154 @@ "path": "plugins/{id}/prism-{id}", "link": "plugins/{id}/" }, - "line-highlight": "Line Highlight", + "line-highlight": { + "title": "Line Highlight", + "description": "Highlights specific lines and/or line ranges." + }, "line-numbers": { "title": "Line Numbers", + "description": "Line number at the beginning of code lines.", "owner": "kuba-kubula" }, "show-invisibles": { "title": "Show Invisibles", - "after": [ + "description": "Show hidden characters such as tabs and line breaks.", + "optional": [ "autolinker", "data-uri-highlight" ] }, - "autolinker": "Autolinker", - "wpd": "WebPlatform Docs", + "autolinker": { + "title": "Autolinker", + "description": "Converts URLs and emails in code to clickable links. Parses Markdown links in comments." + }, + "wpd": { + "title": "WebPlatform Docs", + "description": "Makes tokens link to WebPlatform.org documentation. The links open in a new tab." + }, "custom-class": { "title": "Custom Class", + "description": "This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.", "owner": "dvkndn", "noCSS": true }, "file-highlight": { "title": "File Highlight", + "description": "Fetch external files and highlight them with Prism. Used on the Prism website itself.", "noCSS": true }, "show-language": { "title": "Show Language", + "description": "Display the highlighted language in code blocks (inline code does not show the label).", "owner": "nauzilus", "noCSS": true, "require": "toolbar" }, "jsonp-highlight": { "title": "JSONP Highlight", + "description": "Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).", "noCSS": true, "owner": "nauzilus" }, "highlight-keywords": { "title": "Highlight Keywords", + "description": "Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.", "owner": "vkbansal", "noCSS": true }, "remove-initial-line-feed": { "title": "Remove initial line feed", + "description": "Removes the initial line feed in code blocks.", "owner": "Golmote", "noCSS": true }, + "inline-color": { + "title": "Inline color", + "description": "Adds a small inline preview for colors in style sheets.", + "require": "css-extras", + "owner": "RunDevelopment" + }, "previewers": { "title": "Previewers", + "description": "Previewers for angles, colors, gradients, easing and time.", + "require": "css-extras", "owner": "Golmote" }, "autoloader": { "title": "Autoloader", + "description": "Automatically loads the needed languages to highlight the code blocks.", "owner": "Golmote", "noCSS": true }, "keep-markup": { "title": "Keep Markup", + "description": "Prevents custom markup from being dropped out during highlighting.", "owner": "Golmote", - "after": "normalize-whitespace", + "optional": "normalize-whitespace", "noCSS": true }, "command-line": { "title": "Command Line", + "description": "Display a command line with a prompt and, optionally, the output/response from the commands.", "owner": "chriswells0" }, - "unescaped-markup": "Unescaped Markup", + "unescaped-markup": { + "title": "Unescaped Markup", + "description": "Write markup without having to escape anything." + }, "normalize-whitespace": { "title": "Normalize Whitespace", + "description": "Supports multiple operations to normalize whitespace in code blocks.", "owner": "zeitgeist87", - "after": "unescaped-markup", + "optional": "unescaped-markup", "noCSS": true }, "data-uri-highlight": { "title": "Data-URI Highlight", + "description": "Highlights data-URI contents.", "owner": "Golmote", "noCSS": true }, "toolbar": { "title": "Toolbar", + "description": "Attach a toolbar for plugins to easily register buttons on the top of a code block.", "owner": "mAAdhaTTah" }, "copy-to-clipboard": { "title": "Copy to Clipboard Button", + "description": "Add a button that copies the code block to the clipboard when clicked.", "owner": "mAAdhaTTah", "require": "toolbar", "noCSS": true + }, + "download-button": { + "title": "Download Button", + "description": "A button in the toolbar of a code block adding a convenient way to download a code file.", + "owner": "Golmote", + "require": "toolbar", + "noCSS": true + }, + "match-braces": { + "title": "Match braces", + "description": "Highlights matching braces.", + "owner": "RunDevelopment" + }, + "diff-highlight": { + "title": "Diff Highlight", + "description": "Highlights the code inside diff blocks.", + "owner": "RunDevelopment", + "require": "diff" + }, + "filter-highlight-all": { + "title": "Filter highlightAll", + "description": "Filters the elements the highlightAll and highlightAllUnder methods actually highlight.", + "owner": "RunDevelopment", + "noCSS": true + }, + "treeview": { + "title": "Treeview", + "description": "A language with special styles to highlight file system tree structures.", + "owner": "Golmote" } } } diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-actionscript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-actionscript.js index 1451060228..6d3f49db73 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-actionscript.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-actionscript.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-javascript","prism/components/prism-markup"], function () { +define(["prism/prism","prism/components/prism-javascript"], function () { 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': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=?)=?|[~?@]/ @@ -10,10 +10,9 @@ if (Prism.languages.markup) { 'xml': { pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/, lookbehind: true, - inside: { - rest: Prism.languages.markup - } + inside: Prism.languages.markup } }); } + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-antlr4.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-antlr4.js new file mode 100644 index 0000000000..d67937757a --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-antlr4.js @@ -0,0 +1,68 @@ +define(["prism/prism"], function () { +Prism.languages.antlr4 = { + 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, + 'string': { + pattern: /'(?:\\.|[^\\'\r\n])*'/, + greedy: true + }, + 'character-class': { + pattern: /\[(?:\\.|[^\\\]\r\n])*\]/, + greedy: true, + alias: 'regex', + inside: { + 'range': { + pattern: /([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/, + lookbehind: true, + alias: 'punctuation' + }, + 'escape': /\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/, + 'punctuation': /[\[\]]/ + } + }, + 'action': { + pattern: /\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/, + greedy: true, + inside: { + 'content': { + // this might be C, C++, Python, Java, C#, or any other language ANTLR4 compiles to + pattern: /(\{)[\s\S]+(?=\})/, + lookbehind: true + }, + 'punctuation': /[{}]/ + } + }, + 'command': { + pattern: /(->\s*)(?:\s*(?:,\s*)?[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i, + lookbehind: true, + inside: { + 'function': /\b\w+(?=\s*(?:[,(]|$))/, + 'punctuation': /[,()]/ + } + }, + 'annotation': { + pattern: /@\w+(?:::\w+)*/, + alias: 'keyword' + }, + 'label': { + pattern: /#[ \t]*\w+/, + alias: 'punctuation' + }, + 'keyword': /\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/, + 'definition': [ + { + pattern: /\b[a-z]\w*(?=\s*:)/, + alias: ['rule', 'class-name'] + }, + { + pattern: /\b[A-Z]\w*(?=\s*:)/, + alias: ['token', 'constant'] + }, + ], + 'constant': /\b[A-Z][A-Z_]*\b/, + 'operator': /\.\.|->|[|~]|[*+?]\??/, + 'punctuation': /[;:()=]/ +}; + +Prism.languages.g4 = Prism.languages.antlr4; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-aql.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-aql.js new file mode 100644 index 0000000000..8b5bfe687c --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-aql.js @@ -0,0 +1,44 @@ +define(["prism/prism"], function () { +Prism.languages.aql = { + 'comment': /\/\/.*|\/\*[\s\S]*?\*\//, + 'property': { + pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/, + lookbehind: true, + greedy: true + }, + 'string': { + pattern: /(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/, + greedy: true + }, + 'variable': /@@?\w+/, + 'keyword': [ + { + pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i, + lookbehind: true + }, + /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i, + // pseudo keywords get a lookbehind to avoid false positives + { + pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i, + lookbehind: true + }, + { + pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/, + lookbehind: true + }, + { + pattern: /\bOPTIONS(?=\s*{)/i + } + ], + 'function': /(?!\d)\w+(?=\s*\()/, + 'boolean': /(?:true|false)/i, + 'range': { + pattern: /\.\./, + alias: 'operator' + }, + 'number': /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i, + 'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/, + 'punctuation': /::|[?.:,;()[\]{}]/ +}; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-aspnet.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-aspnet.js index 936f301631..e15e8d93fd 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-aspnet.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-aspnet.js @@ -1,16 +1,24 @@ define(["prism/prism","prism/components/prism-markup","prism/components/prism-csharp"], function () { Prism.languages.aspnet = Prism.languages.extend('markup', { - 'page-directive tag': { + 'page-directive': { pattern: /<%\s*@.*%>/i, + alias: 'tag', inside: { - 'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, + 'page-directive': { + pattern: /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, + alias: 'tag' + }, rest: Prism.languages.markup.tag.inside } }, - 'directive tag': { + 'directive': { pattern: /<%.*%>/i, + alias: 'tag', inside: { - 'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i, + 'directive': { + pattern: /<%\s*?[$=%#:]{0,2}|%>/i, + alias: 'tag' + }, rest: Prism.languages.csharp } } @@ -20,19 +28,24 @@ Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:( // match directives of attribute value foo="<% Bar %>" Prism.languages.insertBefore('inside', 'punctuation', { - 'directive tag': Prism.languages.aspnet['directive tag'] + 'directive': Prism.languages.aspnet['directive'] }, Prism.languages.aspnet.tag.inside["attr-value"]); Prism.languages.insertBefore('aspnet', 'comment', { - 'asp comment': /<%--[\s\S]*?--%>/ + 'asp-comment': { + pattern: /<%--[\s\S]*?--%>/, + alias: ['asp', 'comment'] + } }); // script runat="server" contains csharp, not javascript Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', { - 'asp script': { + 'asp-script': { pattern: /()[\s\S]*?(?=<\/script>)/i, lookbehind: true, + alias: ['asp', 'script'], inside: Prism.languages.csharp || {} } }); + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-autohotkey.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-autohotkey.js index 8ea73dab48..17e8fe1a4d 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-autohotkey.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-autohotkey.js @@ -2,7 +2,7 @@ define(["prism/prism"], function () { // 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\*\/)/m, + pattern: /(^[^";\n]*(?:"[^"\n]*?"[^"\n]*?)*)(?:;.*$|^\s*\/\*[\s\S]*\n\*\/)/m, lookbehind: true }, 'string': /"(?:[^"\n\r]|"")*"/m, @@ -26,4 +26,5 @@ Prism.languages.autohotkey= { '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|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|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|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|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|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 }; + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-bash.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-bash.js index d68ecde857..bb44e54365 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-bash.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-bash.js @@ -108,7 +108,7 @@ define(["prism/prism"], function () { 'string': [ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document { - pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\2/, + pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\2/, lookbehind: true, greedy: true, inside: insideString @@ -116,13 +116,14 @@ define(["prism/prism"], function () { // Here-document with quotes around the tag // → No expansion (so no “inside”). { - pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\3/, + pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\3/, lookbehind: true, greedy: true }, // “Normal” string { - pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/, + pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\2)[^\\])*\2/, + lookbehind: true, greedy: true, inside: insideString } diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-bbcode.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-bbcode.js new file mode 100644 index 0000000000..bd4e9dcfbe --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-bbcode.js @@ -0,0 +1,31 @@ +define(["prism/prism"], function () { +Prism.languages.bbcode = { + 'tag': { + pattern: /\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/, + inside: { + 'tag': { + pattern: /^\[\/?[^\s=\]]+/, + inside: { + 'punctuation': /^\[\/?/ + } + }, + 'attr-value': { + pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/i, + inside: { + 'punctuation': [ + /^=/, + { + pattern: /^(\s*)["']|["']$/, + lookbehind: true + } + ] + } + }, + 'punctuation': /\]/, + 'attr-name': /[^\s=\]]+/ + } + } +}; + +Prism.languages.shortcode = Prism.languages.bbcode; +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-brightscript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-brightscript.js new file mode 100644 index 0000000000..4d1c1be4e4 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-brightscript.js @@ -0,0 +1,47 @@ +define(["prism/prism"], function () { +Prism.languages.brightscript = { + 'comment': /(?:\brem|').*/i, + 'directive-statement': { + pattern: /(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im, + lookbehind: true, + alias: 'property', + inside: { + 'error-message': { + pattern: /(^#error).+/, + lookbehind: true + }, + 'directive': { + pattern: /^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/, + alias: 'keyword' + }, + 'expression': { + pattern: /[\s\S]+/, + inside: null // see below + } + } + }, + 'property': { + pattern: /([\r\n{,][\t ]*)(?:(?!\d)\w+|"(?:[^"\r\n]|"")*"(?!"))(?=[ \t]*:)/, + lookbehind: true, + greedy: true + }, + 'string': { + pattern: /"(?:[^"\r\n]|"")*"(?!")/, + greedy: true + }, + 'class-name': { + pattern: /(\bAs[\t ]+)\w+/i, + lookbehind: true + }, + 'keyword': /\b(?:As|Dim|Each|Else|Elseif|End|Exit|For|Function|Goto|If|In|Print|Return|Step|Stop|Sub|Then|To|While)\b/i, + 'boolean': /\b(?:true|false)\b/i, + 'function': /\b(?!\d)\w+(?=[\t ]*\()/i, + 'number': /(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i, + 'operator': /--|\+\+|>>=?|<<=?|<>|[-+*/\\<>]=?|[:^=?]|\b(?:and|mod|not|or)\b/i, + 'punctuation': /[.,;()[\]{}]/, + 'constant': /\b(?:LINE_NUM)\b/i +}; + +Prism.languages.brightscript['directive-statement'].inside.expression.inside = Prism.languages.brightscript; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-c.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-c.js index 0855b32514..0f25fc840f 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-c.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-c.js @@ -1,10 +1,15 @@ define(["prism/prism","prism/components/prism-clike"], function () { Prism.languages.c = Prism.languages.extend('clike', { + 'comment': { + pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/, + greedy: true + }, 'class-name': { - pattern: /(\b(?:enum|struct)\s+)\w+/, + pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+/, lookbehind: true }, - 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|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/, + 'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|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/, + 'function': /[a-z_]\w*(?=\s*\()/i, 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/, 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i }); diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-cil.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-cil.js index 0456f5ab58..220c8a8d81 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-cil.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-cil.js @@ -1,29 +1,29 @@ define(["prism/prism"], function () { Prism.languages.cil = { 'comment': /\/\/.*/, - + 'string': { pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, greedy: true }, - + 'directive': { pattern: /(^|\W)\.[a-z]+(?=\s)/, lookbehind: true, alias: 'class-name' }, - + // Actually an assembly reference 'variable': /\[[\w\.]+\]/, - - + + 'keyword': /\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|iant|idispatch|implements|import|initonly|instance|u?int(?:8|16|32|64)?|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/, - - 'function': /\b(?:(?:constrained|unaligned|volatile|readonly|tail|no)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.[0-9]+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.[0-9]+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|ldvirtftn|castclass|beq(?:\.s)?|mkrefany|localloc|ckfinite|rethrow|ldtoken|ldsflda|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stloc|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|clt|cgt|ceq|box|and|or|br)\b/, - + + 'function': /\b(?:(?:constrained|unaligned|volatile|readonly|tail|no)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.[0-9]+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(?:i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.[0-9]+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|ldvirtftn|castclass|beq(?:\.s)?|mkrefany|localloc|ckfinite|rethrow|ldtoken|ldsflda|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stloc|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|clt|cgt|ceq|box|and|or|br)\b/, + 'boolean': /\b(?:true|false)\b/, 'number': /\b-?(?:0x[0-9a-fA-F]+|[0-9]+)(?:\.[0-9a-fA-F]+)?\b/i, - + 'punctuation': /[{}[\];(),:=]|IL_[0-9A-Za-z]+/ } diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-clike.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-clike.js index 6a56b59d9e..324331bbc3 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-clike.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-clike.js @@ -16,17 +16,17 @@ Prism.languages.clike = { greedy: true }, 'class-name': { - pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i, + pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i, lookbehind: true, inside: { - punctuation: /[.\\]/ + 'punctuation': /[.\\]/ } }, 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, 'boolean': /\b(?:true|false)\b/, 'function': /\w+(?=\()/, 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, + 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/, 'punctuation': /[{}[\];(),.:]/ }; diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-clojure.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-clojure.js index 51d5fba659..fc875167fc 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-clojure.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-clojure.js @@ -1,16 +1,19 @@ define(["prism/prism"], function () { // Copied from https://github.com/jeluard/prism-clojure Prism.languages.clojure = { - comment: /;+.*/, - string: /"(?:\\.|[^\\"\r\n])*"/, - operator: /(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i, //used for symbols and keywords - keyword: { + 'comment': /;.*/, + 'string': { + pattern: /"(?:[^"\\]|\\.)*"/, + greedy: true + }, + 'operator': /(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i, //used for symbols and keywords + 'keyword': { pattern: /([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/, lookbehind: true }, - boolean: /\b(?:true|false|nil)\b/, - number: /\b[0-9A-Fa-f]+\b/, - punctuation: /[{}\[\](),]/ + 'boolean': /\b(?:true|false|nil)\b/, + 'number': /\b[\da-f]+\b/i, + 'punctuation': /[{}\[\](),]/ }; return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-concurnas.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-concurnas.js new file mode 100644 index 0000000000..b1eab0663a --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-concurnas.js @@ -0,0 +1,50 @@ +define(["prism/prism"], function () { +Prism.languages.concurnas = { + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, + lookbehind: true + }, + { + pattern: /(^|[^\\:])\/\/.*/, + lookbehind: true, + greedy: true + } + ], + 'langext': { + pattern: /\w+\s*\|\|[\s\S]+?\|\|/, + greedy: true, + alias: 'string' + }, + 'function': { + pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/, + lookbehind: true + }, + 'keyword': /\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/, + 'boolean': /\b(?:false|true)\b/, + 'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i, + 'punctuation': /[{}[\];(),.:]/, + 'operator': /<==|>==|=>|->|<-|<>|\^|&==|&<>|!|\?|\?:|\.\?|\+\+|--|[-+*/=<>]=?|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/, + 'annotation': { + pattern: /@(?:\w+:)?(?:\w*|\[[^\]]+\])/, + alias: 'builtin' + } +}; + +Prism.languages.insertBefore('concurnas', 'langext', { + 'string': { + pattern: /[rs]?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, + greedy: true, + inside: { + 'interpolation': { + pattern: /((?:^|[^\\])(?:\\{2})*){(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/, + lookbehind: true, + inside: Prism.languages.concurnas + }, + 'string': /[\s\S]+/ + } + } +}); + +Prism.languages.conc = Prism.languages.concurnas; +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-cpp.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-cpp.js index 278a7892c9..2028e8a970 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-cpp.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-cpp.js @@ -4,7 +4,7 @@ Prism.languages.cpp = Prism.languages.extend('c', { pattern: /(\b(?:class|enum|struct)\s+)\w+/, lookbehind: true }, - '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|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|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/, + 'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|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/, 'number': { pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i, greedy: true diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-csharp.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-csharp.js index 6bc59dd760..ed26c1dd3b 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-csharp.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-csharp.js @@ -1,83 +1,362 @@ define(["prism/prism","prism/components/prism-clike"], function () { -Prism.languages.csharp = Prism.languages.extend('clike', { - 'keyword': /\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/, - 'string': [ - { - pattern: /@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/, - greedy: true - }, - { - pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/, - greedy: true +(function (Prism) { + + /** + * Replaces all placeholders "<>" of given pattern with the n-th replacement (zero based). + * + * Note: This is a simple text based replacement. Be careful when using backreferences! + * + * @param {string} pattern the given pattern. + * @param {string[]} replacements a list of replacement which can be inserted into the given pattern. + * @returns {string} the pattern with all placeholders replaced with their corresponding replacements. + * @example replace(/a<<0>>a/.source, [/b+/.source]) === /a(?:b+)a/.source + */ + function replace(pattern, replacements) { + return pattern.replace(/<<(\d+)>>/g, function (m, index) { + return '(?:' + replacements[+index] + ')'; + }); + } + /** + * @param {string} pattern + * @param {string[]} replacements + * @param {string} [flags] + * @returns {RegExp} + */ + function re(pattern, replacements, flags) { + return RegExp(replace(pattern, replacements), flags || ''); + } + + /** + * Creates a nested pattern where all occurrences of the string `<>` are replaced with the pattern itself. + * + * @param {string} pattern + * @param {number} depthLog2 + * @returns {string} + */ + function nested(pattern, depthLog2) { + for (var i = 0; i < depthLog2; i++) { + pattern = pattern.replace(/<>/g, function () { return '(?:' + pattern + ')'; }); + } + return pattern.replace(/<>/g, '[^\\s\\S]'); + } + + // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ + var keywordKinds = { + // keywords which represent a return or variable type + type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void', + // keywords which are used to declare a type + typeDeclaration: 'class enum interface struct', + // contextual keywords + // ("var" and "dynamic" are missing because they are used like types) + contextual: 'add alias ascending async await by descending from get global group into join let nameof notnull on orderby partial remove select set unmanaged value when where where', + // all other keywords + other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield' + }; + + // keywords + function keywordsToPattern(words) { + return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b'; + } + var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration); + var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other)); + var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other); + var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other); + + // types + var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source, 2); // the idea behind the other forbidden characters is to prevent false positives. Same for tupleElement. + var nestedRound = nested(/\((?:[^()]|<>)*\)/.source, 2); + var name = /@?\b[A-Za-z_]\w*\b/.source; + var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]); + var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]); + var array = /\[\s*(?:,\s*)*\]/.source; + var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]) + var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]); + var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]); + + var typeInside = { + 'keyword': keywords, + 'punctuation': /[<>()?,.:[\]]/ + }; + + // strings & characters + // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#character-literals + // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals + var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source; // simplified pattern + var regularString = /"(?:\\.|[^\\"\r\n])*"/.source; + var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source; + + + Prism.languages.csharp = Prism.languages.extend('clike', { + 'string': [ + { + pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]), + lookbehind: true, + greedy: true + }, + { + pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]), + lookbehind: true, + greedy: true + }, + { + pattern: RegExp(character), + greedy: true, + alias: 'character' + } + ], + 'class-name': [ + { + // Using static + // using static System.Math; + pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]), + lookbehind: true, + inside: typeInside + }, + { + // Using alias (type) + // using Project = PC.MyCompany.Project; + pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]), + lookbehind: true, + inside: typeInside + }, + { + // Using alias (alias) + // using Project = PC.MyCompany.Project; + pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]), + lookbehind: true + }, + { + // Type declarations + // class Foo + // interface Foo + pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]), + lookbehind: true, + inside: typeInside + }, + { + // Single catch exception declaration + // catch(Foo) + // (things like catch(Foo e) is covered by variable declaration) + pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]), + lookbehind: true, + inside: typeInside + }, + { + // Name of the type parameter of generic constraints + // where Foo : class + pattern: re(/(\bwhere\s+)<<0>>/.source, [name]), + lookbehind: true + }, + { + // Casts and checks via as and is. + // as Foo, is Bar + // (things like if(a is Foo b) is covered by variable declaration) + pattern: re(/(\b(?:is|as)\s+)<<0>>/.source, [typeExpression]), + lookbehind: true, + inside: typeInside + }, + { + // Variable, field and parameter declaration + // (Foo bar, Bar baz, Foo[,,] bay, Foo> bax) + pattern: re(/\b<<0>>(?=\s+(?!<<1>>)<<2>>(?:\s*[=,;:{)\]]|\s+in))/.source, [typeExpression, nonContextualKeywords, name]), + inside: typeInside + } + ], + 'keyword': keywords, + // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals + 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i, + 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/, + 'punctuation': /\?\.?|::|[{}[\];(),.:]/ + }); + + Prism.languages.insertBefore('csharp', 'number', { + 'range': { + pattern: /\.\./, + alias: 'operator' + } + }); + + Prism.languages.insertBefore('csharp', 'punctuation', { + 'named-parameter': { + pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]), + lookbehind: true, + alias: 'punctuation' } - ], - 'class-name': [ - { - // (Foo bar, Bar baz) - pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=\s+\w+)/, + }); + + Prism.languages.insertBefore('csharp', 'class-name', { + 'namespace': { + // namespace Foo.Bar {} + // using Foo.Bar; + pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]), + lookbehind: true, inside: { - punctuation: /\./ + 'punctuation': /\./ } }, - { - // [Foo] - pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/, + 'type-expression': { + // default(Foo), typeof(Foo), sizeof(int) + pattern: re(/(\b(?:default|typeof|sizeof)\s*\(\s*)(?:[^()\s]|\s(?!\s*\))|<<0>>)*(?=\s*\))/.source, [nestedRound]), + lookbehind: true, + alias: 'class-name', + inside: typeInside + }, + 'return-type': { + // Foo ForBar(); Foo IFoo.Bar() => 0 + // int this[int index] => 0; T IReadOnlyList.this[int index] => this[index]; + // int Foo => 0; int Foo { get; set } = 0; + pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]), + inside: typeInside, + alias: 'class-name' + }, + 'constructor-invocation': { + // new List> { } + pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]), lookbehind: true, + inside: typeInside, + alias: 'class-name' + }, + /*'explicit-implementation': { + // int IFoo.Bar => 0; void IFoo>.Foo(); + pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration), + inside: classNameInside, + alias: 'class-name' + },*/ + 'generic-method': { + // foo() + pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]), inside: { - punctuation: /\./ + 'function': re(/^<<0>>/.source, [name]), + 'generic': { + pattern: RegExp(generic), + alias: 'class-name', + inside: typeInside + } } }, - { - // class Foo : Bar - pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/, + 'type-list': { + // The list of types inherited or of generic constraints + // class Foo : Bar, IList + // where F : Bar, IList + pattern: re( + /\b((?:<<0>>\s+<<1>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>)(?:\s*,\s*(?:<<3>>|<<4>>))*(?=\s*(?:where|[{;]|=>|$))/.source, + [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source] + ), lookbehind: true, inside: { - punctuation: /\./ + 'keyword': keywords, + 'class-name': { + pattern: RegExp(typeExpression), + greedy: true, + inside: typeInside + }, + 'punctuation': /,/ } }, - { - // class Foo - pattern: /((?:\b(?:class|interface|new)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/, + 'preprocessor': { + pattern: /(^\s*)#.*/m, + lookbehind: true, + alias: 'property', + inside: { + // highlight preprocessor directives as keywords + 'directive': { + pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/, + lookbehind: true, + alias: 'keyword' + } + } + } + }); + + // attributes + var regularStringOrCharacter = regularString + '|' + character; + var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*[\s\S]*?\*\/|<<0>>/.source, [regularStringOrCharacter]); + var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<>*\)/.source, [regularStringCharacterOrComment]), 2); + + // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets + var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source; + var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]); + + Prism.languages.insertBefore('csharp', 'class-name', { + 'attribute': { + // Attributes + // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)] + pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]), lookbehind: true, + greedy: true, inside: { - punctuation: /\./ + 'target': { + pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]), + alias: 'keyword' + }, + 'attribute-arguments': { + pattern: re(/\(<<0>>*\)/.source, [roundExpression]), + inside: Prism.languages.csharp + }, + 'class-name': { + pattern: RegExp(identifier), + inside: { + 'punctuation': /\./ + } + }, + 'punctuation': /[:,]/ } } - ], - 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i, - 'operator': />>=?|<<=?|[-=]>|([-+&|?])\1|~|[-+*/%&|^!=<>]=?/, - 'punctuation': /\?\.?|::|[{}[\];(),.:]/ -}); - -Prism.languages.insertBefore('csharp', 'class-name', { - 'generic-method': { - pattern: /\w+\s*<[^>\r\n]+?>\s*(?=\()/, - inside: { - function: /^\w+/, - 'class-name': { - pattern: /\b[A-Z]\w*(?:\.\w+)*\b/, + }); + + + // string interpolation + var formatString = /:[^}\r\n]+/.source; + // multi line + var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<>*\)/.source, [regularStringCharacterOrComment]), 2) + var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]); + // single line + var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*.*?\*\/|<<0>>|\(<>*\)/.source, [regularStringOrCharacter]), 2) + var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]); + + function createInterpolationInside(interpolation, interpolationRound) { + return { + 'interpolation': { + pattern: re(/([^{](?:\{\{)*)<<0>>/.source, [interpolation]), + lookbehind: true, inside: { - punctuation: /\./ + 'format-string': { + pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]), + lookbehind: true, + inside: { + 'punctuation': /^:/ + } + }, + 'punctuation': /^\{|\}$/, + 'expression': { + pattern: /[\s\S]+/, + alias: 'language-csharp', + inside: Prism.languages.csharp + } } }, - keyword: Prism.languages.csharp.keyword, - punctuation: /[<>(),.:]/ - } - }, - 'preprocessor': { - pattern: /(^\s*)#.*/m, - lookbehind: true, - alias: 'property', - inside: { - // highlight preprocessor directives as keywords - 'directive': { - pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/, + 'string': /[\s\S]+/ + }; + } + + Prism.languages.insertBefore('csharp', 'string', { + 'interpolation-string': [ + { + pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]), + lookbehind: true, + greedy: true, + inside: createInterpolationInside(mInterpolation, mInterpolationRound), + }, + { + pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]), lookbehind: true, - alias: 'keyword' + greedy: true, + inside: createInterpolationInside(sInterpolation, sInterpolationRound), } - } - } -}); + ] + }); + +}(Prism)); Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp; diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-css-extras.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-css-extras.js index 5a0bbfa505..e9ea7f8d29 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-css-extras.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-css-extras.js @@ -1,79 +1,112 @@ define(["prism/prism","prism/components/prism-css"], function () { -Prism.languages.css.selector = { - pattern: Prism.languages.css.selector, - inside: { - 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, - 'pseudo-class': /:[-\w]+/, - 'class': /\.[-:.\w]+/, - 'id': /#[-:.\w]+/, - 'attribute': { - pattern: /\[(?:[^[\]"']|("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1)*\]/, - greedy: true, - inside: { - 'punctuation': /^\[|\]$/, - 'case-sensitivity': { - pattern: /(\s)[si]$/i, - lookbehind: true, - alias: 'keyword' - }, - 'namespace': { - pattern: /^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/, +(function (Prism) { + + var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/; + var selectorInside; + + Prism.languages.css.selector = { + pattern: Prism.languages.css.selector, + inside: selectorInside = { + 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, + 'pseudo-class': /:[-\w]+/, + 'class': /\.[-:.\w]+/, + 'id': /#[-:.\w]+/, + 'attribute': { + pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'), + greedy: true, + inside: { + 'punctuation': /^\[|\]$/, + 'case-sensitivity': { + pattern: /(\s)[si]$/i, + lookbehind: true, + alias: 'keyword' + }, + 'namespace': { + pattern: /^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/, + lookbehind: true, + inside: { + 'punctuation': /\|$/ + } + }, + 'attribute': { + pattern: /^(\s*)[-\w\xA0-\uFFFF]+/, + lookbehind: true + }, + 'value': [ + string, + { + pattern: /(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/, + lookbehind: true + } + ], + 'operator': /[|~*^$]?=/ + } + }, + 'n-th': [ + { + pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, lookbehind: true, inside: { - 'punctuation': /\|$/ + 'number': /[\dn]+/, + 'operator': /[+-]/ } }, - 'attribute': { - pattern: /^(\s*)[-\w\xA0-\uFFFF]+/, + { + pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, lookbehind: true - }, - 'value': [ - /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - { - pattern: /(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/, - lookbehind: true - } - ], - 'operator': /[|~*^$]?=/ - } + } + ], + 'punctuation': /[()]/ + } + }; + + Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside; + + Prism.languages.insertBefore('css', 'property', { + 'variable': { + pattern: /(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i, + lookbehind: true + } + }); + + var unit = { + pattern: /(\d)(?:%|[a-z]+)/, + lookbehind: true + }; + // 123 -123 .123 -.123 12.3 -12.3 + var number = { + pattern: /(^|[^\w.-])-?\d*\.?\d+/, + lookbehind: true + }; + + Prism.languages.insertBefore('css', 'function', { + 'operator': { + pattern: /(\s)[+\-*\/](?=\s)/, + lookbehind: true + }, + // CAREFUL! + // Previewers and Inline color use hexcode and color. + 'hexcode': { + pattern: /\B#(?:[\da-f]{1,2}){3,4}\b/i, + alias: 'color' }, - 'n-th': [ + 'color': [ + /\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i, { - pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, - lookbehind: true, + pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i, inside: { - 'number': /[\dn]+/, - 'operator': /[+-]/ + 'unit': unit, + 'number': number, + 'function': /[\w-]+(?=\()/, + 'punctuation': /[(),]/ } - }, - { - pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, - lookbehind: true } ], - 'punctuation': /[()]/ - } -}; - -Prism.languages.insertBefore('css', 'property', { - 'variable': { - pattern: /(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i, - lookbehind: true - } -}); + 'entity': /\\[\da-f]{1,8}/i, + 'unit': unit, + 'number': number + }); -Prism.languages.insertBefore('css', 'function', { - 'operator': { - pattern: /(\s)[+\-*\/](?=\s)/, - lookbehind: true - }, - 'hexcode': /#[\da-f]{3,8}/i, - 'entity': /\\[\da-f]{1,8}/i, - 'unit': { - pattern: /(\d)(?:%|[a-z]+)/, - lookbehind: true - }, - 'number': /-?[\d.]+/ -}); +})(Prism); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-css.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-css.js index aee107620f..f2bf04c2a2 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-css.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-css.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-markup"], function () { +define(["prism/prism"], function () { (function (Prism) { var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/; @@ -8,12 +8,18 @@ define(["prism/prism","prism/components/prism-markup"], function () { 'atrule': { pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/, inside: { - 'rule': /@[\w-]+/ + 'rule': /^@[\w-]+/, + 'selector-function-argument': { + pattern: /(\bselector\s*\((?!\s*\))\s*)(?:[^()]|\((?:[^()]|\([^()]*\))*\))+?(?=\s*\))/, + lookbehind: true, + alias: 'selector' + } // See rest below } }, 'url': { pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'), + greedy: true, inside: { 'function': /^url/i, 'punctuation': /^\(|\)$/ diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-d.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-d.js index 1db3a0e897..93f24734fb 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-d.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-d.js @@ -1,20 +1,55 @@ define(["prism/prism","prism/components/prism-clike"], function () { Prism.languages.d = Prism.languages.extend('clike', { + 'comment': [ + { + // Shebang + pattern: /^\s*#!.+/, + greedy: true + }, + { + pattern: RegExp(/(^|[^\\])/.source + '(?:' + [ + // /+ comment +/ + // Allow one level of nesting + /\/\+(?:\/\+[\s\S]*?\+\/|(?!\/\+)[\s\S])*?\+\//.source, + // // comment + /\/\/.*/.source, + // /* comment */ + /\/\*[\s\S]*?\*\//.source + ].join('|') + ')'), + lookbehind: true, + greedy: true + } + ], 'string': [ - // r"", x"" - /\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/, - // q"[]", q"()", q"<>", q"{}" - /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/, - // q"IDENT - // ... - // IDENT" - /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/, - // q"//", q"||", etc. - /\bq"(.)[\s\S]*?\1"/, - // Characters - /'(?:\\'|\\?[^']+)'/, + { + pattern: RegExp([ + // r"", x"" + /\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/.source, + + // q"[]", q"()", q"<>", q"{}" + /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/.source, + + // q"IDENT + // ... + // IDENT" + /\bq"((?!\d)\w+)$[\s\S]*?^\1"/.source, + + // q"//", q"||", etc. + /\bq"(.)[\s\S]*?\2"/.source, + + // Characters + // 'a', '\\', '\n', '\xFF', '\377', '\uFFFF', '\U0010FFFF', '\quot' + /'(?:\\(?:\W|\w+)|[^\\])'/.source, - /(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/ + /(["`])(?:\\[\s\S]|(?!\3)[^\\])*\3[cwd]?/.source + ].join('|'), 'm'), + greedy: true + }, + { + pattern: /\bq\{(?:\{[^{}]*\}|[^{}])*\}/, + greedy: true, + alias: 'token-string' + } ], 'number': [ @@ -32,26 +67,6 @@ Prism.languages.d = Prism.languages.extend('clike', { 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/ }); - -Prism.languages.d.comment = [ - // Shebang - /^\s*#!.+/, - // /+ +/ - { - // Allow one level of nesting - pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//, - lookbehind: true - } -].concat(Prism.languages.d.comment); - -Prism.languages.insertBefore('d', 'comment', { - 'token-string': { - // Allow one level of nesting - pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/, - alias: 'string' - } -}); - Prism.languages.insertBefore('d', 'keyword', { 'property': /\B@\w*/ }); @@ -63,4 +78,5 @@ Prism.languages.insertBefore('d', 'function', { alias: 'variable' } }); + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-dax.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-dax.js new file mode 100644 index 0000000000..f12a7ca9ab --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-dax.js @@ -0,0 +1,30 @@ +define(["prism/prism"], function () { +Prism.languages.dax = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/).*)/, + lookbehind: true + }, + 'data-field': { + pattern: /'(?:[^']|'')*'(?!')(?:\[[ \w\xA0-\uFFFF]+\])?|\w+\[[ \w\xA0-\uFFFF]+\]/, + alias: 'symbol' + }, + 'measure': { + pattern: /\[[ \w\xA0-\uFFFF]+\]/, + alias: 'constant' + }, + 'string': { + pattern: /"(?:[^"]|"")*"(?!")/, + greedy: true + }, + 'function': /\b(?:ABS|ACOS|ACOSH|ACOT|ACOTH|ADDCOLUMNS|ADDMISSINGITEMS|ALL|ALLCROSSFILTERED|ALLEXCEPT|ALLNOBLANKROW|ALLSELECTED|AND|APPROXIMATEDISTINCTCOUNT|ASIN|ASINH|ATAN|ATANH|AVERAGE|AVERAGEA|AVERAGEX|BETA\.DIST|BETA\.INV|BLANK|CALCULATE|CALCULATETABLE|CALENDAR|CALENDARAUTO|CEILING|CHISQ\.DIST|CHISQ\.DIST\.RT|CHISQ\.INV|CHISQ\.INV\.RT|CLOSINGBALANCEMONTH|CLOSINGBALANCEQUARTER|CLOSINGBALANCEYEAR|COALESCE|COMBIN|COMBINA|COMBINEVALUES|CONCATENATE|CONCATENATEX|CONFIDENCE\.NORM|CONFIDENCE\.T|CONTAINS|CONTAINSROW|CONTAINSSTRING|CONTAINSSTRINGEXACT|CONVERT|COS|COSH|COT|COTH|COUNT|COUNTA|COUNTAX|COUNTBLANK|COUNTROWS|COUNTX|CROSSFILTER|CROSSJOIN|CURRENCY|CURRENTGROUP|CUSTOMDATA|DATATABLE|DATE|DATEADD|DATEDIFF|DATESBETWEEN|DATESINPERIOD|DATESMTD|DATESQTD|DATESYTD|DATEVALUE|DAY|DEGREES|DETAILROWS|DISTINCT|DISTINCTCOUNT|DISTINCTCOUNTNOBLANK|DIVIDE|EARLIER|EARLIEST|EDATE|ENDOFMONTH|ENDOFQUARTER|ENDOFYEAR|EOMONTH|ERROR|EVEN|EXACT|EXCEPT|EXP|EXPON\.DIST|FACT|FALSE|FILTER|FILTERS|FIND|FIRSTDATE|FIRSTNONBLANK|FIRSTNONBLANKVALUE|FIXED|FLOOR|FORMAT|GCD|GENERATE|GENERATEALL|GENERATESERIES|GEOMEAN|GEOMEANX|GROUPBY|HASONEFILTER|HASONEVALUE|HOUR|IF|IF\.EAGER|IFERROR|IGNORE|INT|INTERSECT|ISBLANK|ISCROSSFILTERED|ISEMPTY|ISERROR|ISEVEN|ISFILTERED|ISINSCOPE|ISLOGICAL|ISNONTEXT|ISNUMBER|ISO\.CEILING|ISODD|ISONORAFTER|ISSELECTEDMEASURE|ISSUBTOTAL|ISTEXT|KEEPFILTERS|KEYWORDMATCH|LASTDATE|LASTNONBLANK|LASTNONBLANKVALUE|LCM|LEFT|LEN|LN|LOG|LOG10|LOOKUPVALUE|LOWER|MAX|MAXA|MAXX|MEDIAN|MEDIANX|MID|MIN|MINA|MINUTE|MINX|MOD|MONTH|MROUND|NATURALINNERJOIN|NATURALLEFTOUTERJOIN|NEXTDAY|NEXTMONTH|NEXTQUARTER|NEXTYEAR|NONVISUAL|NORM\.DIST|NORM\.INV|NORM\.S\.DIST|NORM\.S\.INV|NOT|NOW|ODD|OPENINGBALANCEMONTH|OPENINGBALANCEQUARTER|OPENINGBALANCEYEAR|OR|PARALLELPERIOD|PATH|PATHCONTAINS|PATHITEM|PATHITEMREVERSE|PATHLENGTH|PERCENTILE\.EXC|PERCENTILE\.INC|PERCENTILEX\.EXC|PERCENTILEX\.INC|PERMUT|PI|POISSON\.DIST|POWER|PREVIOUSDAY|PREVIOUSMONTH|PREVIOUSQUARTER|PREVIOUSYEAR|PRODUCT|PRODUCTX|QUARTER|QUOTIENT|RADIANS|RAND|RANDBETWEEN|RANK\.EQ|RANKX|RELATED|RELATEDTABLE|REMOVEFILTERS|REPLACE|REPT|RIGHT|ROLLUP|ROLLUPADDISSUBTOTAL|ROLLUPGROUP|ROLLUPISSUBTOTAL|ROUND|ROUNDDOWN|ROUNDUP|ROW|SAMEPERIODLASTYEAR|SAMPLE|SEARCH|SECOND|SELECTCOLUMNS|SELECTEDMEASURE|SELECTEDMEASUREFORMATSTRING|SELECTEDMEASURENAME|SELECTEDVALUE|SIGN|SIN|SINH|SQRT|SQRTPI|STARTOFMONTH|STARTOFQUARTER|STARTOFYEAR|STDEV\.P|STDEV\.S|STDEVX\.P|STDEVX\.S|SUBSTITUTE|SUBSTITUTEWITHINDEX|SUM|SUMMARIZE|SUMMARIZECOLUMNS|SUMX|SWITCH|T\.DIST|T\.DIST\.2T|T\.DIST\.RT|T\.INV|T\.INV\.2T|TAN|TANH|TIME|TIMEVALUE|TODAY|TOPN|TOPNPERLEVEL|TOPNSKIP|TOTALMTD|TOTALQTD|TOTALYTD|TREATAS|TRIM|TRUE|TRUNC|UNICHAR|UNICODE|UNION|UPPER|USERELATIONSHIP|USERNAME|USEROBJECTID|USERPRINCIPALNAME|UTCNOW|UTCTODAY|VALUE|VALUES|VAR\.P|VAR\.S|VARX\.P|VARX\.S|WEEKDAY|WEEKNUM|XIRR|XNPV|YEAR|YEARFRAC)(?=\s*\()/i, + 'keyword': /\b(?:DEFINE|MEASURE|EVALUATE|ORDER\s+BY|RETURN|VAR|START\s+AT|ASC|DESC)\b/i, + 'boolean': { + pattern: /\b(?:TRUE|FALSE|NULL)\b/i, + alias: 'constant' + }, + 'number': /\b\d+\.?\d*|\B\.\d+\b/i, + 'operator': /:=|[-+*\/=^]|&&?|\|\||<(?:=>?|<|>)?|>[>=]?|\b(?:IN|NOT)\b/i, + 'punctuation': /[;\[\](){}`,.]/ +}; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-diff.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-diff.js index d997e08ee3..406383e2e1 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-diff.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-diff.js @@ -1,23 +1,57 @@ define(["prism/prism"], function () { -Prism.languages.diff = { - 'coord': [ - // Match all kinds of coord lines (prefixed by "+++", "---" or "***"). - /^(?:\*{3}|-{3}|\+{3}).*$/m, - // Match "@@ ... @@" coord lines in unified diff. - /^@@.*@@$/m, - // Match coord lines in normal diff (starts with a number). - /^\d+.*$/m - ], - - // Match inserted and deleted lines. Support both +/- and >/< styles. - 'deleted': /^[-<].*$/m, - 'inserted': /^[+>].*$/m, - - // Match "different" lines (prefixed with "!") in context diff. - 'diff': { - 'pattern': /^!(?!!).+$/m, - 'alias': 'important' - } -}; +(function (Prism) { + + Prism.languages.diff = { + 'coord': [ + // Match all kinds of coord lines (prefixed by "+++", "---" or "***"). + /^(?:\*{3}|-{3}|\+{3}).*$/m, + // Match "@@ ... @@" coord lines in unified diff. + /^@@.*@@$/m, + // Match coord lines in normal diff (starts with a number). + /^\d+.*$/m + ] + + // deleted, inserted, unchanged, diff + }; + + /** + * A map from the name of a block to its line prefix. + * + * @type {Object} + */ + var PREFIXES = { + 'deleted-sign': '-', + 'deleted-arrow': '<', + 'inserted-sign': '+', + 'inserted-arrow': '>', + 'unchanged': ' ', + 'diff': '!', + }; + + // add a token for each prefix + Object.keys(PREFIXES).forEach(function (name) { + var prefix = PREFIXES[name]; + + var alias = []; + if (!/^\w+$/.test(name)) { // "deleted-sign" -> "deleted" + alias.push(/\w+/.exec(name)[0]); + } + if (name === "diff") { + alias.push("bold"); + } + + Prism.languages.diff[name] = { + // pattern: /^(?:[_].*(?:\r\n?|\n|(?![\s\S])))+/m + pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'), + alias: alias + }; + }); + + // make prefixes available to Diff plugin + Object.defineProperty(Prism.languages.diff, 'PREFIXES', { + value: PREFIXES + }); + +}(Prism)); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-dns-zone-file.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-dns-zone-file.js new file mode 100644 index 0000000000..338c1f6e16 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-dns-zone-file.js @@ -0,0 +1,36 @@ +define(["prism/prism"], function () { +Prism.languages['dns-zone-file'] = { + 'comment': /;.*/, + 'string': { + pattern: /"(?:\\.|[^"\\\r\n])*"/, + greedy: true + }, + 'variable': [ + { + pattern: /(^\$ORIGIN[ \t]+)\S+/m, + lookbehind: true, + }, + { + pattern: /(^|\s)@(?=\s|$)/, + lookbehind: true, + } + ], + 'keyword': /^\$(?:ORIGIN|INCLUDE|TTL)(?=\s|$)/m, + 'class': { + // https://tools.ietf.org/html/rfc1035#page-13 + pattern: /(^|\s)(?:IN|CH|CS|HS)(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + 'type': { + // https://en.wikipedia.org/wiki/List_of_DNS_record_types + pattern: /(^|\s)(?:A|A6|AAAA|AFSDB|APL|ATMA|CAA|CDNSKEY|CDS|CERT|CNAME|DHCID|DLV|DNAME|DNSKEY|DS|EID|GID|GPOS|HINFO|HIP|IPSECKEY|ISDN|KEY|KX|LOC|MAILA|MAILB|MB|MD|MF|MG|MINFO|MR|MX|NAPTR|NB|NBSTAT|NIMLOC|NINFO|NS|NSAP|NSAP-PTR|NSEC|NSEC3|NSEC3PARAM|NULL|NXT|OPENPGPKEY|PTR|PX|RKEY|RP|RRSIG|RT|SIG|SINK|SMIMEA|SOA|SPF|SRV|SSHFP|TA|TKEY|TLSA|TSIG|TXT|UID|UINFO|UNSPEC|URI|WKS|X25)(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + 'punctuation': /[()]/ +}; + +Prism.languages['dns-zone'] = Prism.languages['dns-zone-file'] + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-elixir.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-elixir.js index a38beda6c8..736e1e6f9c 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-elixir.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-elixir.js @@ -38,7 +38,7 @@ Prism.languages.elixir = { alias: 'symbol' }, // Look-ahead prevents bad highlighting of the :: operator - 'attr-name': /\w+:(?!:)/, + 'attr-name': /\w+\??:(?!:)/, 'capture': { // Look-behind prevents bad highlighting of the && operator pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-elm.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-elm.js index d0360d8c10..d47d7407ff 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-elm.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-elm.js @@ -20,7 +20,7 @@ Prism.languages.elm = { // 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: /^\s*import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+([A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m, + pattern: /^\s*import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+(?:[A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m, inside: { keyword: /\b(?:import|as|exposing)\b/ } diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-etlua.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-etlua.js new file mode 100644 index 0000000000..da844c8a7f --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-etlua.js @@ -0,0 +1,26 @@ +define(["prism/prism","prism/components/prism-lua","prism/components/prism-markup-templating"], function () { +(function (Prism) { + + Prism.languages.etlua = { + 'delimiter': { + pattern: /^<%[-=]?|-?%>$/, + alias: 'punctuation' + }, + 'language-lua': { + pattern: /[\s\S]+/, + inside: Prism.languages.lua + } + }; + + Prism.hooks.add('before-tokenize', function (env) { + var pattern = /<%[\s\S]+?%>/g; + Prism.languages['markup-templating'].buildPlaceholders(env, 'etlua', pattern); + }); + + Prism.hooks.add('after-tokenize', function (env) { + Prism.languages['markup-templating'].tokenizePlaceholders(env, 'etlua'); + }); + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-excel-formula.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-excel-formula.js new file mode 100644 index 0000000000..ffee8c963b --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-excel-formula.js @@ -0,0 +1,69 @@ +define(["prism/prism"], function () { +Prism.languages['excel-formula'] = { + 'comment': { + pattern: /(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i, + lookbehind: true, + greedy: true + }, + 'string': { + pattern: /"(?:[^"]|"")*"(?!")/, + greedy: true + }, + 'reference': { + // https://www.ablebits.com/office-addins-blog/2015/12/08/excel-reference-another-sheet-workbook/ + + // Sales!B2 + // 'Winter sales'!B2 + // [Sales.xlsx]Jan!B2:B5 + // D:\Reports\[Sales.xlsx]Jan!B2:B5 + // '[Sales.xlsx]Jan sales'!B2:B5 + // 'D:\Reports\[Sales.xlsx]Jan sales'!B2:B5 + + pattern: /(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/, + greedy: true, + alias: 'string', + inside: { + 'operator': /!$/, + 'punctuation': /'/, + 'sheet': { + pattern: /[^[\]]+$/, + alias: 'function' + }, + 'file': { + pattern: /\[[^[\]]+\]$/, + inside: { + 'punctuation': /[[\]]/ + } + }, + 'path': /[\s\S]+/ + } + }, + 'function-name': { + pattern: /[A-Z]\w*(?=\()/i, + alias: 'keyword' + }, + 'range': { + pattern: /\$?(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)/i, + alias: 'property', + inside: { + 'operator': /:/, + 'cell': /\$?[A-Z]+\$?\d+/i, + 'column': /\$?[A-Z]+/i, + 'row': /\$?\d+/ + } + }, + 'cell': { + // Excel is case insensitive, so the string "foo1" could be either a variable or a cell. + // To combat this, we match cells case insensitive, if the contain at least one "$", and case sensitive otherwise. + pattern: /[A-Z]+\d+|\$[A-Za-z]+\$?\d+|[A-Za-z]+\$\d+/, + alias: 'property' + }, + 'number': /(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i, + 'boolean': /\b(?:TRUE|FALSE)\b/i, + 'operator': /[-+*/^%=&,]|<[=>]?|>=?/, + 'punctuation': /[[\]();{}|]/ +}; + +Prism.languages['xlsx'] = Prism.languages['xls'] = Prism.languages['excel-formula']; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-factor.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-factor.js new file mode 100644 index 0000000000..21f53bfbfd --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-factor.js @@ -0,0 +1,406 @@ +define(["prism/prism"], function () { +(function (Prism) { + + var comment_inside = { + 'function': /\b(?:TODOS?|FIX(?:MES?)?|NOTES?|BUGS?|XX+|HACKS?|WARN(?:ING)?|\?{2,}|!{2,})\b/ + }; + var string_inside = { + 'number': /\\[^\s']|%\w/ + }; + + var factor = { + 'comment': [ + { + // ! single-line exclamation point comments with whitespace after/around the ! + pattern: /(^|\s)(?:! .*|!$)/, + lookbehind: true, + inside: comment_inside + }, + + /* from basis/multiline: */ + { + // /* comment */, /* comment*/ + pattern: /(^|\s)\/\*\s[\s\S]*?\*\/(?=\s|$)/, + lookbehind: true, + greedy: true, + inside: comment_inside + }, + { + // ![[ comment ]] , ![===[ comment]===] + pattern: /(^|\s)!\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/, + lookbehind: true, + greedy: true, + inside: comment_inside + } + ], + + 'number': [ + { + // basic base 10 integers 9, -9 + pattern: /(^|\s)[+-]?\d+(?=\s|$)/, + lookbehind: true + }, + { + // base prefix integers 0b010 0o70 0xad 0d10 0XAD -0xa9 + pattern: /(^|\s)[+-]?0(?:b[01]+|o[0-7]+|d\d+|x[\dA-F]+)(?=\s|$)/i, + lookbehind: true + }, + { + // fractional ratios 1/5 -1/5 and the literal float approximations 1/5. -1/5. + pattern: /(^|\s)[+-]?\d+\/\d+\.?(?=\s|$)/, + lookbehind: true + }, + { + // positive mixed numbers 23+1/5 +23+1/5 + pattern: /(^|\s)\+?\d+\+\d+\/\d+(?=\s|$)/, + lookbehind: true + }, + { + // negative mixed numbers -23-1/5 + pattern: /(^|\s)-\d+-\d+\/\d+(?=\s|$)/, + lookbehind: true + }, + { + // basic decimal floats -0.01 0. .0 .1 -.1 -1. -12.13 +12.13 + // and scientific notation with base 10 exponents 3e4 3e-4 .3e-4 + pattern: /(^|\s)[+-]?(?:\d*\.\d+|\d+\.\d*|\d+)(?:e[+-]?\d+)?(?=\s|$)/i, + lookbehind: true + }, + { + // NAN literal syntax NAN: 80000deadbeef, NAN: a + pattern: /(^|\s)NAN:\s+[\da-fA-F]+(?=\s|$)/, + lookbehind: true + }, + { + /* + base prefix floats 0x1.0p3 (8.0) 0b1.010p2 (5.0) 0x1.p1 0b1.11111111p11111... + "The normalized hex form ±0x1.MMMMMMMMMMMMM[pP]±EEEE allows any floating-point number to be specified precisely. + The values of MMMMMMMMMMMMM and EEEE map directly to the mantissa and exponent fields of the binary IEEE 754 representation." + + */ + pattern: /(^|\s)[+-]?0(?:b1\.[01]*|o1\.[0-7]*|d1\.\d*|x1\.[\dA-F]*)p\d+(?=\s|$)/i, + lookbehind: true + } + ], + + // R/ regexp?\/\\/ + 'regexp': { + pattern: /(^|\s)R\/\s+(?:\\\S|[^\\/])*\/(?:[idmsr]*|[idmsr]+-[idmsr]+)(?=\s|$)/, + lookbehind: true, + alias: 'number', + inside: { + 'variable': /\\\S/, + 'keyword': /[+?*\[\]^$(){}.|]/, + 'operator': { + pattern: /(\/)[idmsr]+(?:-[idmsr]+)?/, + lookbehind: true + } + } + }, + + 'boolean': { + pattern: /(^|\s)[tf](?=\s|$)/, + lookbehind: true + }, + + // SBUF" asd", URL" ://...", P" /etc/" + 'custom-string': { + pattern: /(^|\s)[A-Z0-9\-]+"\s(?:\\\S|[^"\\])*"/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: { + 'number': /\\\S|%\w|\// + } + }, + + 'multiline-string': [ + { + // STRING: name \n content \n ; -> CONSTANT: name "content" (symbol) + pattern: /(^|\s)STRING:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*;(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: { + 'number': string_inside.number, + // trailing semicolon on its own line + 'semicolon-or-setlocal': { + pattern: /((?:\n|\r\n)\s*);(?=\s|$)/, + lookbehind: true, + alias: 'function' + } + } + }, + { + // HEREDOC: marker \n content \n marker ; -> "content" (immediate) + pattern: /(^|\s)HEREDOC:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*\S+(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: string_inside + }, + { + // [[ string ]], [==[ string]==] + pattern: /(^|\s)\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: string_inside + } + ], + + 'special-using': { + pattern: /(^|\s)USING:(?:\s\S+)*(?=\s+;(?:\s|$))/, + lookbehind: true, + alias: 'function', + inside: { + // this is essentially a regex for vocab names, which i don't want to specify + // but the USING: gets picked up as a vocab name + 'string': { + pattern: /(\s)[^:\s]+/, + lookbehind: true + } + } + }, + + /* this description of stack effect literal syntax is not complete and not as specific as theoretically possible + trying to do better is more work and regex-computation-time than it's worth though. + - we'd like to have the "delimiter" parts of the stack effect [ (, --, and ) ] be a different (less-important or comment-like) colour to the stack effect contents + - we'd like if nested stack effects were treated as such rather than just appearing flat (with `inside`) + - we'd like if the following variable name conventions were recognised specifically: + special row variables = ..a b.. + type and stack effect annotations end with a colon = ( quot: ( a: ( -- ) -- b ) -- x ), ( x: number -- ) + word throws unconditional error = * + any other word-like variable name = a ? q' etc + + https://docs.factorcode.org/content/article-effects.html + + these are pretty complicated to highlight properly without a real parser, and therefore out of scope + the old pattern, which may be later useful, was: (^|\s)(?:call|execute|eval)?\((?:\s+[^"\r\n\t ]\S*)*?\s+--(?:\s+[^"\n\t ]\S*)*?\s+\)(?=\s|$) + */ + + // current solution is not great + 'stack-effect-delimiter': [ + { + // opening parenthesis + pattern: /(^|\s)(?:call|execute|eval)?\((?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // middle -- + pattern: /(\s)--(?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // closing parenthesis + pattern: /(\s)\)(?=\s|$)/, + lookbehind: true, + alias: 'operator' + } + ], + + 'combinators': { + pattern: null, + lookbehind: true, + alias: 'keyword' + }, + + 'kernel-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'sequences-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'math-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'constructor-word': { + // but not <=> + pattern: /(^|\s)<(?!=+>|-+>)\S+>(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + + 'other-builtin-syntax': { + pattern: null, + lookbehind: true, + alias: 'operator' + }, + + /* + full list of supported word naming conventions: (the convention appears outside of the [brackets]) + set-[x] + change-[x] + with-[x] + new-[x] + >[string] + [base]> + [string]>[number] + +[symbol]+ + [boolean-word]? + ?[of] + [slot-reader]>> + >>[slot-setter] + [slot-writer]<< + ([implementation-detail]) + [mutater]! + [variant]* + [prettyprint]. + $[help-markup] + + , SYNTAX:, etc are supported by their own patterns. + + `with` and `new` from `kernel` are their own builtins. + + see + */ + 'conventionally-named-word': { + pattern: /(^|\s)(?!")(?:(?:set|change|with|new)-\S+|\$\S+|>[^>\s]+|[^:>\s]+>|[^>\s]+>[^>\s]+|\+[^+\s]+\+|[^?\s]+\?|\?[^?\s]+|[^>\s]+>>|>>[^>\s]+|[^<\s]+<<|\([^()\s]+\)|[^!\s]+!|[^*\s]\S*\*|[^.\s]\S*\.)(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + + 'colon-syntax': { + pattern: /(^|\s)(?:[A-Z0-9\-]+#?)?:{1,2}\s+(?:;\S+|(?!;)\S+)(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'function' + }, + + 'semicolon-or-setlocal': { + pattern: /(\s)(?:;|:>)(?=\s|$)/, + lookbehind: true, + alias: 'function' + }, + + // do not highlight leading } or trailing X{ at the begin/end of the file as it's invalid syntax + 'curly-brace-literal-delimiter': [ + { + // opening + pattern: /(^|\s)[a-z]*\{(?=\s)/i, + lookbehind: true, + alias: 'operator' + }, + { + // closing + pattern: /(\s)\}(?=\s|$)/, + lookbehind: true, + alias: 'operator' + }, + + ], + + // do not highlight leading ] or trailing [ at the begin/end of the file as it's invalid syntax + 'quotation-delimiter': [ + { + // opening + pattern: /(^|\s)\[(?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // closing + pattern: /(\s)\](?=\s|$)/, + lookbehind: true, + alias: 'operator' + }, + ], + + 'normal-word': { + pattern: /(^|\s)[^"\s]\S*(?=\s|$)/, + lookbehind: true + }, + + /* + basic first-class string "a" + with escaped double-quote "a\"" + escaped backslash "\\" + and general escapes since Factor has so many "\N" + + syntax that works in the reference implementation that isn't fully + supported because it's an implementation detail: + "string 1""string 2" -> 2 strings (works anyway) + "string"5 -> string, 5 + "string"[ ] -> string, quotation + { "a"} -> array + + the rest of those examples all properly recognise the string, but not + the other object (number, quotation, etc) + this is fine for a regex-only implementation. + */ + 'string': { + pattern: /"(?:\\\S|[^"\\])*"/, + greedy: true, + inside: string_inside + } + }; + + var escape = function (str) { + return (str+'').replace(/([.?*+\^$\[\]\\(){}|\-])/g, '\\$1'); + }; + + var arrToWordsRegExp = function (arr) { + return new RegExp( + '(^|\\s)(?:' + arr.map(escape).join('|') + ')(?=\\s|$)' + ); + }; + + var builtins = { + 'kernel-builtin': [ + 'or', '2nipd', '4drop', 'tuck', 'wrapper', 'nip', 'wrapper?', 'callstack>array', 'die', 'dupd', 'callstack', 'callstack?', '3dup', 'hashcode', 'pick', '4nip', 'build', '>boolean', 'nipd', 'clone', '5nip', 'eq?', '?', '=', 'swapd', '2over', 'clear', '2dup', 'get-retainstack', 'not', 'tuple?', 'dup', '3nipd', 'call', '-rotd', 'object', 'drop', 'assert=', 'assert?', '-rot', 'execute', 'boa', 'get-callstack', 'curried?', '3drop', 'pickd', 'overd', 'over', 'roll', '3nip', 'swap', 'and', '2nip', 'rotd', 'throw', '(clone)', 'hashcode*', 'spin', 'reach', '4dup', 'equal?', 'get-datastack', 'assert', '2drop', '', 'boolean?', 'identity-hashcode', 'identity-tuple?', 'null', 'composed?', 'new', '5drop', 'rot', '-roll', 'xor', 'identity-tuple', 'boolean' + ], + 'other-builtin-syntax': [ + // syntax + '=======', 'recursive', 'flushable', '>>', '<<<<<<', 'M\\', 'B', 'PRIVATE>', '\\', '======', 'final', 'inline', 'delimiter', 'deprecated', '>>>>>', '<<<<<<<', 'parse-complex', 'malformed-complex', 'read-only', '>>>>>>>', 'call-next-method', '<<', 'foldable', + // literals + '$', '$[', '${' + ], + 'sequences-builtin': [ + 'member-eq?', 'mismatch', 'append', 'assert-sequence=', 'longer', 'repetition', 'clone-like', '3sequence', 'assert-sequence?', 'last-index-from', 'reversed', 'index-from', 'cut*', 'pad-tail', 'join-as', 'remove-eq!', 'concat-as', 'but-last', 'snip', 'nths', 'nth', 'sequence', 'longest', 'slice?', '', 'remove-nth', 'tail-slice', 'empty?', 'tail*', 'member?', 'virtual-sequence?', 'set-length', 'drop-prefix', 'iota', 'unclip', 'bounds-error?', 'unclip-last-slice', 'non-negative-integer-expected', 'non-negative-integer-expected?', 'midpoint@', 'longer?', '?set-nth', '?first', 'rest-slice', 'prepend-as', 'prepend', 'fourth', 'sift', 'subseq-start', 'new-sequence', '?last', 'like', 'first4', '1sequence', 'reverse', 'slice', 'virtual@', 'repetition?', 'set-last', 'index', '4sequence', 'max-length', 'set-second', 'immutable-sequence', 'first2', 'first3', 'supremum', 'unclip-slice', 'suffix!', 'insert-nth', 'tail', '3append', 'short', 'suffix', 'concat', 'flip', 'immutable?', 'reverse!', '2sequence', 'sum', 'delete-all', 'indices', 'snip-slice', '', 'check-slice', 'sequence?', 'head', 'append-as', 'halves', 'sequence=', 'collapse-slice', '?second', 'slice-error?', 'product', 'bounds-check?', 'bounds-check', 'immutable', 'virtual-exemplar', 'harvest', 'remove', 'pad-head', 'last', 'set-fourth', 'cartesian-product', 'remove-eq', 'shorten', 'shorter', 'reversed?', 'shorter?', 'shortest', 'head-slice', 'pop*', 'tail-slice*', 'but-last-slice', 'iota?', 'append!', 'cut-slice', 'new-resizable', 'head-slice*', 'sequence-hashcode', 'pop', 'set-nth', '?nth', 'second', 'join', 'immutable-sequence?', '', '3append-as', 'virtual-sequence', 'subseq?', 'remove-nth!', 'length', 'last-index', 'lengthen', 'assert-sequence', 'copy', 'move', 'third', 'first', 'tail?', 'set-first', 'prefix', 'bounds-error', '', 'exchange', 'surround', 'cut', 'min-length', 'set-third', 'push-all', 'head?', 'subseq-start-from', 'delete-slice', 'rest', 'sum-lengths', 'head*', 'infimum', 'remove!', 'glue', 'slice-error', 'subseq', 'push', 'replace-slice', 'subseq-as', 'unclip-last' + ], + 'math-builtin': [ + 'number=', 'next-power-of-2', '?1+', 'fp-special?', 'imaginary-part', 'float>bits', 'number?', 'fp-infinity?', 'bignum?', 'fp-snan?', 'denominator', 'gcd', '*', '+', 'fp-bitwise=', '-', 'u>=', '/', '>=', 'bitand', 'power-of-2?', 'log2-expects-positive', 'neg?', '<', 'log2', '>', 'integer?', 'number', 'bits>double', '2/', 'zero?', 'bits>float', 'float?', 'shift', 'ratio?', 'rect>', 'even?', 'ratio', 'fp-sign', 'bitnot', '>fixnum', 'complex?', '/i', 'integer>fixnum', '/f', 'sgn', '>bignum', 'next-float', 'u<', 'u>', 'mod', 'recip', 'rational', '>float', '2^', 'integer', 'fixnum?', 'neg', 'fixnum', 'sq', 'bignum', '>rect', 'bit?', 'fp-qnan?', 'simple-gcd', 'complex', '', 'real', '>fraction', 'double>bits', 'bitor', 'rem', 'fp-nan-payload', 'real-part', 'log2-expects-positive?', 'prev-float', 'align', 'unordered?', 'float', 'fp-nan?', 'abs', 'bitxor', 'integer>fixnum-strict', 'u<=', 'odd?', '<=', '/mod', '>integer', 'real?', 'rational?', 'numerator' + ] + // that's all for now + }; + + Object.keys(builtins).forEach(function (k) { + factor[k].pattern = arrToWordsRegExp( builtins[k] ); + }); + + var combinators = [ + // kernel + '2bi', 'while', '2tri', 'bi*', '4dip', 'both?', 'same?', 'tri@', 'curry', 'prepose', '3bi', '?if', 'tri*', '2keep', '3keep', 'curried', '2keepd', 'when', '2bi*', '2tri*', '4keep', 'bi@', 'keepdd', 'do', 'unless*', 'tri-curry', 'if*', 'loop', 'bi-curry*', 'when*', '2bi@', '2tri@', 'with', '2with', 'either?', 'bi', 'until', '3dip', '3curry', 'tri-curry*', 'tri-curry@', 'bi-curry', 'keepd', 'compose', '2dip', 'if', '3tri', 'unless', 'tuple', 'keep', '2curry', 'tri', 'most', 'while*', 'dip', 'composed', 'bi-curry@', + // sequences + 'find-last-from', 'trim-head-slice', 'map-as', 'each-from', 'none?', 'trim-tail', 'partition', 'if-empty', 'accumulate*', 'reject!', 'find-from', 'accumulate-as', 'collector-for-as', 'reject', 'map', 'map-sum', 'accumulate!', '2each-from', 'follow', 'supremum-by', 'map!', 'unless-empty', 'collector', 'padding', 'reduce-index', 'replicate-as', 'infimum-by', 'trim-tail-slice', 'count', 'find-index', 'filter', 'accumulate*!', 'reject-as', 'map-integers', 'map-find', 'reduce', 'selector', 'interleave', '2map', 'filter-as', 'binary-reduce', 'map-index-as', 'find', 'produce', 'filter!', 'replicate', 'cartesian-map', 'cartesian-each', 'find-index-from', 'map-find-last', '3map-as', '3map', 'find-last', 'selector-as', '2map-as', '2map-reduce', 'accumulate', 'each', 'each-index', 'accumulate*-as', 'when-empty', 'all?', 'collector-as', 'push-either', 'new-like', 'collector-for', '2selector', 'push-if', '2all?', 'map-reduce', '3each', 'any?', 'trim-slice', '2reduce', 'change-nth', 'produce-as', '2each', 'trim', 'trim-head', 'cartesian-find', 'map-index', + // math + 'if-zero', 'each-integer', 'unless-zero', '(find-integer)', 'when-zero', 'find-last-integer', '(all-integers?)', 'times', '(each-integer)', 'find-integer', 'all-integers?', + // math.combinators + 'unless-negative', 'if-positive', 'when-positive', 'when-negative', 'unless-positive', 'if-negative', + // combinators + 'case', '2cleave', 'cond>quot', 'case>quot', '3cleave', 'wrong-values', 'to-fixed-point', 'alist>quot', 'cond', 'cleave', 'call-effect', 'recursive-hashcode', 'spread', 'deep-spread>quot', + // combinators.short-circuit + '2||', '0||', 'n||', '0&&', '2&&', '3||', '1||', '1&&', 'n&&', '3&&', + // combinators.smart + 'smart-unless*', 'keep-inputs', 'reduce-outputs', 'smart-when*', 'cleave>array', 'smart-with', 'smart-apply', 'smart-if', 'inputs/outputs', 'output>sequence-n', 'map-outputs', 'map-reduce-outputs', 'dropping', 'output>array', 'smart-map-reduce', 'smart-2map-reduce', 'output>array-n', 'nullary', 'inputsequence', + // tafn + ]; + + factor.combinators.pattern = arrToWordsRegExp(combinators); + + Prism.languages.factor = factor; + +})(Prism); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-firestore-security-rules.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-firestore-security-rules.js new file mode 100644 index 0000000000..5e1737a928 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-firestore-security-rules.js @@ -0,0 +1,38 @@ +define(["prism/prism","prism/components/prism-clike"], function () { +Prism.languages['firestore-security-rules'] = Prism.languages.extend('clike', { + 'comment': /\/\/.*/, + 'keyword': /\b(?:allow|function|if|match|null|return|rules_version|service)\b/, + 'operator': /&&|\|\||[<>!=]=?|[-+*/%=]|\b(?:in|is)\b/, +}); + +delete Prism.languages['firestore-security-rules']['class-name']; + +Prism.languages.insertBefore('firestore-security-rules', 'keyword', { + 'path': { + pattern: /(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/, + lookbehind: true, + greedy: true, + inside: { + 'variable': { + pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/, + inside: { + 'operator': /=/, + 'keyword': /\*\*/, + 'punctuation': /[.$(){}]/ + } + }, + 'punctuation': /[/]/ + } + }, + 'method': { + // to make the pattern shorter, the actual method names are omitted + pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/, + lookbehind: true, + alias: 'builtin', + inside: { + 'punctuation': /,/ + } + }, +}); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-fsharp.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-fsharp.js index d233991215..8f45ec1c25 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-fsharp.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-fsharp.js @@ -11,7 +11,7 @@ Prism.languages.fsharp = Prism.languages.extend('clike', { } ], 'string': { - pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?|'(?:[^\\']|\\.)'B?/, + pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?|'(?:[^\\']|\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8}))'B?/, greedy: true }, 'class-name': { @@ -22,7 +22,7 @@ Prism.languages.fsharp = Prism.languages.extend('clike', { 'punctuation': /\./ } }, - 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\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|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|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/, + 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\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|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|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/, 'number': [ /\b0x[\da-fA-F]+(?:un|lf|LF)?\b/, /\b0b[01]+(?:y|uy)?\b/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-ftl.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-ftl.js new file mode 100644 index 0000000000..3fc7f06ee2 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-ftl.js @@ -0,0 +1,100 @@ +define(["prism/prism","prism/components/prism-markup-templating"], function () { +(function (Prism) { + + // https://freemarker.apache.org/docs/dgui_template_exp.html + + // FTL expression with 4 levels of nesting supported + var FTL_EXPR = /(?!<#--)[^()"']|\((?:)*\)|<#--[\s\S]*?-->|"(?:[^\\"]|\\.)*"|'(?:[^\\']|\\.)*'/.source; + for (var i = 0; i < 2; i++) { + FTL_EXPR = FTL_EXPR.replace(//g, function () { return FTL_EXPR; }); + } + FTL_EXPR = FTL_EXPR.replace(//g, '[^\s\S]'); + + var ftl = { + 'comment': /<#--[\s\S]*?-->/, + 'string': [ + { + // raw string + pattern: /\br("|')(?:(?!\1)[^\\]|\\.)*\1/, + greedy: true + }, + { + pattern: RegExp(/("|')(?:(?!\1|\$\{)[^\\]|\\.|\$\{(?:)*?\})*\1/.source.replace(//g, function () { return FTL_EXPR; })), + greedy: true, + inside: { + 'interpolation': { + pattern: RegExp(/((?:^|[^\\])(?:\\\\)*)\$\{(?:)*?\}/.source.replace(//g, function () { return FTL_EXPR; })), + lookbehind: true, + inside: { + 'interpolation-punctuation': { + pattern: /^\$\{|\}$/, + alias: 'punctuation' + }, + rest: null + } + } + } + } + ], + 'keyword': /\b(?:as)\b/, + 'boolean': /\b(?:true|false)\b/, + 'builtin-function': { + pattern: /((?:^|[^?])\?\s*)\w+/, + lookbehind: true, + alias: 'function' + }, + 'function': /\w+(?=\s*\()/, + 'number': /\d+(?:\.\d+)?/, + 'operator': /\.\.[<*!]?|->|--|\+\+|&&|\|\||\?{1,2}|[-+*/%!=<>]=?|\b(?:gt|gte|lt|lte)\b/, + 'punctuation': /[,;.:()[\]{}]/ + }; + + ftl.string[1].inside.interpolation.inside.rest = ftl; + + Prism.languages.ftl = { + 'ftl-comment': { + // the pattern is shortened to be more efficient + pattern: /^<#--[\s\S]*/, + alias: 'comment' + }, + 'ftl-directive': { + pattern: /^<[\s\S]+>$/, + inside: { + 'directive': { + pattern: /(^<\/?)[#@][a-z]\w*/i, + lookbehind: true, + alias: 'keyword' + }, + 'punctuation': /^<\/?|\/?>$/, + 'content': { + pattern: /[\s\S]*\S[\s\S]*/, + alias: 'ftl', + inside: ftl + } + } + }, + 'ftl-interpolation': { + pattern: /^\$\{[\s\S]*\}$/, + inside: { + 'punctuation': /^\$\{|\}$/, + 'content': { + pattern: /[\s\S]*\S[\s\S]*/, + alias: 'ftl', + inside: ftl + } + } + } + }; + + Prism.hooks.add('before-tokenize', function (env) { + var pattern = RegExp(/<#--[\s\S]*?-->|<\/?[#@][a-zA-Z](?:)*?>|\$\{(?:)*?\}/.source.replace(//g, function () { return FTL_EXPR; }), 'gi'); + Prism.languages['markup-templating'].buildPlaceholders(env, 'ftl', pattern); + }); + + Prism.hooks.add('after-tokenize', function (env) { + Prism.languages['markup-templating'].tokenizePlaceholders(env, 'ftl'); + }); + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-gdscript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gdscript.js new file mode 100644 index 0000000000..f1ec4f3f4d --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gdscript.js @@ -0,0 +1,30 @@ +define(["prism/prism"], function () { +Prism.languages.gdscript = { + 'comment': /#.*/, + 'string': { + pattern: /@?(?:("|')(?:(?!\1)[^\n\\]|\\[\s\S])*\1(?!"|')|"""(?:[^\\]|\\[\s\S])*?""")/, + greedy: true + }, + 'class-name': { + // class_name Foo, extends Bar, class InnerClass + // export(int) var baz, export(int, 0) var i + // as Node + // const FOO: int = 9, var bar: bool = true + // func add(reference: Item, amount: int) -> Item: + pattern: /(^(?:class_name|class|extends)[ \t]+|^export\([ \t]*|\bas[ \t]+|(?:\b(?:const|var)[ \t]|[,(])[ \t]*\w+[ \t]*:[ \t]*|->[ \t]*)[a-zA-Z_]\w*/m, + lookbehind: true + }, + 'keyword': /\b(?:and|as|assert|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|if|in|is|master|mastersync|match|not|null|onready|or|pass|preload|puppet|puppetsync|remote|remotesync|return|self|setget|signal|static|tool|var|while|yield)\b/, + 'function': /[a-z_]\w*(?=[ \t]*\()/i, + 'variable': /\$\w+/, + 'number': [ + /\b0b[01_]+\b|\b0x[\da-fA-F_]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.[\d_]+)(?:e[+-]?[\d_]+)?\b/, + /\b(?:INF|NAN|PI|TAU)\b/ + ], + 'constant': /\b[A-Z][A-Z_\d]*\b/, + 'boolean': /\b(?:false|true)\b/, + 'operator': /->|:=|&&|\|\||<<|>>|[-+*/%&|!<>=]=?|[~^]/, + 'punctuation': /[.:,;()[\]{}]/ +}; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-gherkin.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gherkin.js index d92163cec9..6c90c0885b 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-gherkin.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gherkin.js @@ -1,82 +1,88 @@ define(["prism/prism"], function () { -Prism.languages.gherkin = { - 'pystring': { - pattern: /("""|''')[\s\S]+?\1/, - alias: 'string' - }, - 'comment': { - pattern: /((?:^|\r?\n|\r)[ \t]*)#.*/, - lookbehind: true - }, - 'tag': { - pattern: /((?:^|\r?\n|\r)[ \t]*)@\S*/, - lookbehind: true - }, - 'feature': { - pattern: /((?:^|\r?\n|\r)[ \t]*)(?:Ability|Ahoy matey!|Arwedd|Aspekt|Besigheid Behoefte|Business Need|Caracteristica|Característica|Egenskab|Egenskap|Eiginleiki|Feature|Fīča|Fitur|Fonctionnalité|Fonksyonalite|Funcionalidade|Funcionalitat|Functionalitate|FuncÅ£ionalitate|Funcționalitate|Functionaliteit|Fungsi|Funkcia|Funkcija|Funkcionalitāte|Funkcionalnost|Funkcja|Funksie|Funktionalität|Funktionalitéit|Funzionalità|Hwaet|Hwæt|Jellemző|Karakteristik|laH|Lastnost|Mak|Mogucnost|Mogućnost|Moznosti|Možnosti|OH HAI|Omadus|Ominaisuus|Osobina|Özellik|perbogh|poQbogh malja'|Potrzeba biznesowa|Požadavek|Požiadavka|Pretty much|Qap|Qu'meH 'ut|Savybė|Tính năng|Trajto|Vermoë|VlastnosÅ¥|Właściwość|Značilnost|Δυνατότητα|Λειτουργία|Могућност|Мөмкинлек|Особина|Свойство|Үзенчәлеклелек|Функционал|Функционалност|Функция|Функціонал|תכונה|خاصية|خصوصیت|صلاحیت|کاروبار کی ضرورت|وِیژگی|रूप लेख|ਖਾਸੀਅਤ|ਨਕਸ਼ ਨੁਹਾਰ|ਮੁਹਾਂਦਰਾ|గుణము|ಹೆಚ್ಚಳ|ความต้องการทางธุรกิจ|ความสามารถ|โครงหลัก|기능|フィーチャ|功能|機能):(?:[^:]+(?:\r?\n|\r|$))*/, - lookbehind: true, - inside: { - 'important': { - pattern: /(:)[^\r\n]+/, - lookbehind: true - }, - keyword: /[^:\r\n]+:/ - } - }, - 'scenario': { - pattern: /((?:^|\r?\n|\r)[ \t]*)(?:Abstract Scenario|Abstrakt Scenario|Achtergrond|Aer|Ær|Agtergrond|All y'all|Antecedentes|Antecedents|Atburðarás|Atburðarásir|Awww, look mate|B4|Background|Baggrund|Bakgrund|Bakgrunn|Bakgrunnur|Beispiele|Beispiller|Bối cảnh|Cefndir|Cenario|Cenário|Cenario de Fundo|Cenário de Fundo|Cenarios|Cenários|Contesto|Context|Contexte|Contexto|Conto|Contoh|Contone|Dæmi|Dasar|Dead men tell no tales|Delineacao do Cenario|Delineação do Cenário|Dis is what went down|Dữ liệu|Dyagram senaryo|Dyagram Senaryo|Egzanp|Ejemplos|Eksempler|Ekzemploj|Enghreifftiau|Esbozo do escenario|Escenari|Escenario|Esempi|Esquema de l'escenari|Esquema del escenario|Esquema do Cenario|Esquema do Cenário|Examples|EXAMPLZ|Exempel|Exemple|Exemples|Exemplos|First off|Fono|Forgatókönyv|Forgatókönyv vázlat|Fundo|Geçmiş|ghantoH|Grundlage|Hannergrond|Háttér|Heave to|Istorik|Juhtumid|Keadaan|Khung kịch bản|Khung tình huống|Kịch bản|Koncept|Konsep skenario|Kontèks|Kontekst|Kontekstas|Konteksts|Kontext|Konturo de la scenaro|Latar Belakang|lut|lut chovnatlh|lutmey|Lýsing Atburðarásar|Lýsing Dæma|Menggariskan Senario|MISHUN|MISHUN SRSLY|mo'|Náčrt Scenára|Náčrt Scénáře|Náčrt Scenáru|Oris scenarija|Örnekler|Osnova|Osnova Scenára|Osnova scénáře|Osnutek|Ozadje|Paraugs|Pavyzdžiai|Példák|Piemēri|Plan du scénario|Plan du Scénario|Plan senaryo|Plan Senaryo|Plang vum Szenario|Pozadí|Pozadie|Pozadina|Príklady|Příklady|Primer|Primeri|Primjeri|Przykłady|Raamstsenaarium|Reckon it's like|Rerefons|Scenár|Scénář|Scenarie|Scenarij|Scenarijai|Scenarijaus Å¡ablonas|Scenariji|Scenārijs|Scenārijs pēc parauga|Scenarijus|Scenario|Scénario|Scenario Amlinellol|Scenario Outline|Scenario Template|Scenariomal|Scenariomall|Scenarios|Scenariu|Scenariusz|Scenaro|Schema dello scenario|Se ðe|Se the|Se þe|Senario|Senaryo|Senaryo deskripsyon|Senaryo Deskripsyon|Senaryo taslağı|Shiver me timbers|Situācija|Situai|Situasie|Situasie Uiteensetting|Skenario|Skenario konsep|Skica|Structura scenariu|Structură scenariu|Struktura scenarija|Stsenaarium|Swa|Swa hwaer swa|Swa hwær swa|Szablon scenariusza|Szenario|Szenariogrundriss|Tapaukset|Tapaus|Tapausaihio|Taust|Tausta|Template Keadaan|Template Senario|Template Situai|The thing of it is|Tình huống|Variantai|Voorbeelde|Voorbeelden|Wharrimean is|Yo\-ho\-ho|You'll wanna|Założenia|Παραδείγματα|Περιγραφή Σεναρίου|Σενάρια|Σενάριο|Υπόβαθρο|Кереш|Контекст|Концепт|Мисаллар|Мисоллар|Основа|Передумова|Позадина|Предистория|Предыстория|Приклади|Пример|Примери|Примеры|Рамка на сценарий|Скица|Структура сценарија|Структура сценария|Структура сценарію|Сценарий|Сценарий структураси|Сценарийның төзелеше|Сценарији|Сценарио|Сценарій|Тарих|Үрнәкләр|דוגמאות|רקע|תבנית תרחיש|תרחיש|الخلفية|الگوی سناریو|امثلة|پس منظر|زمینه|سناریو|سيناريو|سيناريو مخطط|مثالیں|منظر نامے کا خاکہ|منظرنامہ|نمونه ها|उदाहरण|परिदृश्य|परिदृश्य रूपरेखा|पृष्ठभूमि|ਉਦਾਹਰਨਾਂ|ਪਟਕਥਾ|ਪਟਕਥਾ ਢਾਂਚਾ|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਿਛੋਕੜ|ఉదాహరణలు|కథనం|నేపథ్యం|సన్నివేశం|ಉದಾಹರಣೆಗಳು|ಕಥಾಸಾರಾಂಶ|ವಿವರಣೆ|ಹಿನ್ನೆಲೆ|โครงสร้างของเหตุการณ์|ชุดของตัวอย่าง|ชุดของเหตุการณ์|แนวคิด|สรุปเหตุการณ์|เหตุการณ์|ë°°ê²½|시나리오|시나리오 개요|예|サンプル|シナリオ|シナリオアウトライン|シナリオテンプレ|シナリオテンプレート|テンプレ|例|例子|剧本|剧本大纲|劇本|劇本大綱|场景|场景大纲|場景|場景大綱|背景):[^:\r\n]*/, - lookbehind: true, - inside: { - 'important': { - pattern: /(:)[^\r\n]*/, - lookbehind: true - }, - keyword: /[^:\r\n]+:/ - } - }, - 'table-body': { - // Look-behind is used to skip the table head, which has the same format as any table row - pattern: /((?:\r?\n|\r)[ \t]*\|.+\|[^\r\n]*)+/, - lookbehind: true, - inside: { - 'outline': { - pattern: /<[^>]+?>/, - alias: 'variable' - }, - 'td': { - pattern: /\s*[^\s|][^|]*/, - alias: 'string' - }, - 'punctuation': /\|/ - } - }, - 'table-head': { - pattern: /(?:\r?\n|\r)[ \t]*\|.+\|[^\r\n]*/, - inside: { - 'th': { - pattern: /\s*[^\s|][^|]*/, - alias: 'variable' - }, - 'punctuation': /\|/ - } - }, - 'atrule': { - pattern: /((?:\r?\n|\r)[ \t]+)(?:'ach|'a|'ej|7|a|A také|A taktiež|A tiež|A zároveň|Aber|Ac|Adott|Akkor|Ak|Aleshores|Ale|Ali|Allora|Alors|Als|Ama|Amennyiben|Amikor|Ampak|an|AN|Ananging|And y'all|And|Angenommen|Anrhegedig a|An|Apabila|Atès|Atesa|Atunci|Avast!|Aye|A|awer|Bagi|Banjur|Bet|Biết|Blimey!|Buh|But at the end of the day I reckon|But y'all|But|BUT|Cal|Când|Cando|Cand|Ce|Cuando|Če|Ða ðe|Ða|Dadas|Dada|Dados|Dado|DaH ghu' bejlu'|dann|Dann|Dano|Dan|Dar|Dat fiind|Data|Date fiind|Date|Dati fiind|Dati|DaÅ£i fiind|Dați fiind|Dato|DEN|Den youse gotta|Dengan|De|Diberi|Diyelim ki|Donada|Donat|Donitaĵo|Do|Dun|Duota|Ðurh|Eeldades|Ef|Eğer ki|Entao|Então|Entón|Entonces|En|Epi|E|És|Etant donnée|Etant donné|Et|Étant données|Étant donnée|Étant donné|Etant données|Etant donnés|Étant donnés|Fakat|Gangway!|Gdy|Gegeben seien|Gegeben sei|Gegeven|Gegewe|ghu' noblu'|Gitt|Given y'all|Given|Givet|Givun|Ha|Cho|I CAN HAZ|In|Ir|It's just unbelievable|I|Ja|Jeśli|Jeżeli|Kadar|Kada|Kad|Kai|Kaj|Když|Keď|Kemudian|Ketika|Khi|Kiedy|Ko|Kuid|Kui|Kun|Lan|latlh|Le sa a|Let go and haul|Le|Lè sa a|Lè|Logo|Lorsqu'<|Lorsque|mä|Maar|Mais|Mając|Majd|Maka|Manawa|Mas|Ma|Menawa|Men|Mutta|Nalikaning|Nalika|Nanging|NÃ¥r|När|Nato|NhÆ°ng|Niin|Njuk|O zaman|Og|Och|Oletetaan|Onda|Ond|Oraz|Pak|Pero|Però|Podano|Pokiaľ|Pokud|Potem|Potom|Privzeto|Pryd|qaSDI'|Quando|Quand|Quan|SÃ¥|Sed|Se|Siis|Sipoze ke|Sipoze Ke|Sipoze|Si|Şi|Și|Soit|Stel|Tada|Tad|Takrat|Tak|Tapi|Ter|Tetapi|Tha the|Tha|Then y'all|Then|Thì|Thurh|Toda|Too right|ugeholl|Und|Un|Và|vaj|Vendar|Ve|wann|Wanneer|WEN|Wenn|When y'all|When|Wtedy|Wun|Y'know|Yeah nah|Yna|Youse know like when|Youse know when youse got|Y|Za predpokladu|Za předpokladu|Zadani|Zadano|Zadan|Zadate|Zadato|Zakładając|Zaradi|Zatati|Þa þe|Þa|Þá|Þegar|Þurh|Αλλά|Δεδομένου|Και|Όταν|Τότε|А також|Агар|Але|Али|Аммо|А|Әгәр|Әйтик|Әмма|Бирок|Ва|Вә|Дадено|Дано|Допустим|Если|Задате|Задати|Задато|И|І|К тому же|Када|Кад|Когато|Когда|Коли|Ләкин|Лекин|Нәтиҗәдә|Нехай|Но|Онда|Припустимо, що|Припустимо|Пусть|Также|Та|Тогда|Тоді|То|Унда|Һәм|Якщо|אבל|אזי|אז|בהינתן|וגם|כאשר|آنگاه|اذاً|اگر|اما|اور|با فرض|بالفرض|بفرض|پھر|تب|ثم|جب|عندما|فرض کیا|لكن|لیکن|متى|هنگامی|و|अगर|और|कदा|किन्तु|चूंकि|जब|तथा|तदा|तब|परन्तु|पर|यदि|ਅਤੇ|ਜਦੋਂ|ਜਿਵੇਂ ਕਿ|ਜੇਕਰ|ਤਦ|ਪਰ|అప్పుడు|ఈ పరిస్థితిలో|కాని|చెప్పబడినది|మరియు|ಆದರೆ|ನಂತರ|ನೀಡಿದ|ಮತ್ತು|ಸ್ಥಿತಿಯನ್ನು|กำหนดให้|ดังนั้น|แต่|เมื่อ|และ|그러면<|그리고<|단<|만약<|만일<|먼저<|ì¡°ê±´<|하지만<|かつ<|しかし<|ただし<|ならば<|もし<|並且<|但し<|但是<|假如<|假定<|假設<|假设<|前提<|同时<|同時<|并且<|当<|當<|而且<|那么<|那麼<)(?=[ \t]+)/, - lookbehind: true - }, - 'string': { - pattern: /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/, - inside: { - 'outline': { - pattern: /<[^>]+?>/, - alias: 'variable' +(function (Prism) { + + var tableRow = /(?:\r?\n|\r)[ \t]*\|.+\|.*/.source; + + Prism.languages.gherkin = { + 'pystring': { + pattern: /("""|''')[\s\S]+?\1/, + alias: 'string' + }, + 'comment': { + pattern: /(^[ \t]*)#.*/m, + lookbehind: true + }, + 'tag': { + pattern: /(^[ \t]*)@\S*/m, + lookbehind: true + }, + 'feature': { + pattern: /((?:^|\r?\n|\r)[ \t]*)(?:Ability|Ahoy matey!|Arwedd|Aspekt|Besigheid Behoefte|Business Need|Caracteristica|Característica|Egenskab|Egenskap|Eiginleiki|Feature|Fīča|Fitur|Fonctionnalité|Fonksyonalite|Funcionalidade|Funcionalitat|Functionalitate|FuncÅ£ionalitate|Funcționalitate|Functionaliteit|Fungsi|Funkcia|Funkcija|Funkcionalitāte|Funkcionalnost|Funkcja|Funksie|Funktionalität|Funktionalitéit|Funzionalità|Hwaet|Hwæt|Jellemző|Karakteristik|laH|Lastnost|Mak|Mogucnost|Mogućnost|Moznosti|Možnosti|OH HAI|Omadus|Ominaisuus|Osobina|Özellik|perbogh|poQbogh malja'|Potrzeba biznesowa|Požadavek|Požiadavka|Pretty much|Qap|Qu'meH 'ut|Savybė|Tính năng|Trajto|Vermoë|VlastnosÅ¥|Właściwość|Značilnost|Δυνατότητα|Λειτουργία|Могућност|Мөмкинлек|Особина|Свойство|Үзенчәлеклелек|Функционал|Функционалност|Функция|Функціонал|תכונה|خاصية|خصوصیت|صلاحیت|کاروبار کی ضرورت|وِیژگی|रूप लेख|ਖਾਸੀਅਤ|ਨਕਸ਼ ਨੁਹਾਰ|ਮੁਹਾਂਦਰਾ|గుణము|ಹೆಚ್ಚಳ|ความต้องการทางธุรกิจ|ความสามารถ|โครงหลัก|기능|フィーチャ|功能|機能):(?:[^:]+(?:\r?\n|\r|$))*/, + lookbehind: true, + inside: { + 'important': { + pattern: /(:)[^\r\n]+/, + lookbehind: true + }, + 'keyword': /[^:\r\n]+:/ } + }, + 'scenario': { + pattern: /(^[ \t]*)(?:Abstract Scenario|Abstrakt Scenario|Achtergrond|Aer|Ær|Agtergrond|All y'all|Antecedentes|Antecedents|Atburðarás|Atburðarásir|Awww, look mate|B4|Background|Baggrund|Bakgrund|Bakgrunn|Bakgrunnur|Beispiele|Beispiller|Bối cảnh|Cefndir|Cenario|Cenário|Cenario de Fundo|Cenário de Fundo|Cenarios|Cenários|Contesto|Context|Contexte|Contexto|Conto|Contoh|Contone|Dæmi|Dasar|Dead men tell no tales|Delineacao do Cenario|Delineação do Cenário|Dis is what went down|Dữ liệu|Dyagram senaryo|Dyagram Senaryo|Egzanp|Ejemplos|Eksempler|Ekzemploj|Enghreifftiau|Esbozo do escenario|Escenari|Escenario|Esempi|Esquema de l'escenari|Esquema del escenario|Esquema do Cenario|Esquema do Cenário|Examples|EXAMPLZ|Exempel|Exemple|Exemples|Exemplos|First off|Fono|Forgatókönyv|Forgatókönyv vázlat|Fundo|Geçmiş|ghantoH|Grundlage|Hannergrond|Háttér|Heave to|Istorik|Juhtumid|Keadaan|Khung kịch bản|Khung tình huống|Kịch bản|Koncept|Konsep skenario|Kontèks|Kontekst|Kontekstas|Konteksts|Kontext|Konturo de la scenaro|Latar Belakang|lut|lut chovnatlh|lutmey|Lýsing Atburðarásar|Lýsing Dæma|Menggariskan Senario|MISHUN|MISHUN SRSLY|mo'|Náčrt Scenára|Náčrt Scénáře|Náčrt Scenáru|Oris scenarija|Örnekler|Osnova|Osnova Scenára|Osnova scénáře|Osnutek|Ozadje|Paraugs|Pavyzdžiai|Példák|Piemēri|Plan du scénario|Plan du Scénario|Plan senaryo|Plan Senaryo|Plang vum Szenario|Pozadí|Pozadie|Pozadina|Príklady|Příklady|Primer|Primeri|Primjeri|Przykłady|Raamstsenaarium|Reckon it's like|Rerefons|Scenár|Scénář|Scenarie|Scenarij|Scenarijai|Scenarijaus Å¡ablonas|Scenariji|Scenārijs|Scenārijs pēc parauga|Scenarijus|Scenario|Scénario|Scenario Amlinellol|Scenario Outline|Scenario Template|Scenariomal|Scenariomall|Scenarios|Scenariu|Scenariusz|Scenaro|Schema dello scenario|Se ðe|Se the|Se þe|Senario|Senaryo|Senaryo deskripsyon|Senaryo Deskripsyon|Senaryo taslağı|Shiver me timbers|Situācija|Situai|Situasie|Situasie Uiteensetting|Skenario|Skenario konsep|Skica|Structura scenariu|Structură scenariu|Struktura scenarija|Stsenaarium|Swa|Swa hwaer swa|Swa hwær swa|Szablon scenariusza|Szenario|Szenariogrundriss|Tapaukset|Tapaus|Tapausaihio|Taust|Tausta|Template Keadaan|Template Senario|Template Situai|The thing of it is|Tình huống|Variantai|Voorbeelde|Voorbeelden|Wharrimean is|Yo\-ho\-ho|You'll wanna|Założenia|Παραδείγματα|Περιγραφή Σεναρίου|Σενάρια|Σενάριο|Υπόβαθρο|Кереш|Контекст|Концепт|Мисаллар|Мисоллар|Основа|Передумова|Позадина|Предистория|Предыстория|Приклади|Пример|Примери|Примеры|Рамка на сценарий|Скица|Структура сценарија|Структура сценария|Структура сценарію|Сценарий|Сценарий структураси|Сценарийның төзелеше|Сценарији|Сценарио|Сценарій|Тарих|Үрнәкләр|דוגמאות|רקע|תבנית תרחיש|תרחיש|الخلفية|الگوی سناریو|امثلة|پس منظر|زمینه|سناریو|سيناريو|سيناريو مخطط|مثالیں|منظر نامے کا خاکہ|منظرنامہ|نمونه ها|उदाहरण|परिदृश्य|परिदृश्य रूपरेखा|पृष्ठभूमि|ਉਦਾਹਰਨਾਂ|ਪਟਕਥਾ|ਪਟਕਥਾ ਢਾਂਚਾ|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਿਛੋਕੜ|ఉదాహరణలు|కథనం|నేపథ్యం|సన్నివేశం|ಉದಾಹರಣೆಗಳು|ಕಥಾಸಾರಾಂಶ|ವಿವರಣೆ|ಹಿನ್ನೆಲೆ|โครงสร้างของเหตุการณ์|ชุดของตัวอย่าง|ชุดของเหตุการณ์|แนวคิด|สรุปเหตุการณ์|เหตุการณ์|ë°°ê²½|시나리오|시나리오 개요|예|サンプル|シナリオ|シナリオアウトライン|シナリオテンプレ|シナリオテンプレート|テンプレ|例|例子|剧本|剧本大纲|劇本|劇本大綱|场景|场景大纲|場景|場景大綱|背景):[^:\r\n]*/m, + lookbehind: true, + inside: { + 'important': { + pattern: /(:)[^\r\n]*/, + lookbehind: true + }, + 'keyword': /[^:\r\n]+:/ + } + }, + 'table-body': { + // Look-behind is used to skip the table head, which has the same format as any table row + pattern: RegExp('(' + tableRow + ')(?:' + tableRow + ')+'), + lookbehind: true, + inside: { + 'outline': { + pattern: /<[^>]+?>/, + alias: 'variable' + }, + 'td': { + pattern: /\s*[^\s|][^|]*/, + alias: 'string' + }, + 'punctuation': /\|/ + } + }, + 'table-head': { + pattern: RegExp(tableRow), + inside: { + 'th': { + pattern: /\s*[^\s|][^|]*/, + alias: 'variable' + }, + 'punctuation': /\|/ + } + }, + 'atrule': { + pattern: /(^[ \t]+)(?:'ach|'a|'ej|7|a|A také|A taktiež|A tiež|A zároveň|Aber|Ac|Adott|Akkor|Ak|Aleshores|Ale|Ali|Allora|Alors|Als|Ama|Amennyiben|Amikor|Ampak|an|AN|Ananging|And y'all|And|Angenommen|Anrhegedig a|An|Apabila|Atès|Atesa|Atunci|Avast!|Aye|A|awer|Bagi|Banjur|Bet|Biết|Blimey!|Buh|But at the end of the day I reckon|But y'all|But|BUT|Cal|Când|Cando|Cand|Ce|Cuando|Če|Ða ðe|Ða|Dadas|Dada|Dados|Dado|DaH ghu' bejlu'|dann|Dann|Dano|Dan|Dar|Dat fiind|Data|Date fiind|Date|Dati fiind|Dati|DaÅ£i fiind|Dați fiind|Dato|DEN|Den youse gotta|Dengan|De|Diberi|Diyelim ki|Donada|Donat|Donitaĵo|Do|Dun|Duota|Ðurh|Eeldades|Ef|Eğer ki|Entao|Então|Entón|Entonces|En|Epi|E|És|Etant donnée|Etant donné|Et|Étant données|Étant donnée|Étant donné|Etant données|Etant donnés|Étant donnés|Fakat|Gangway!|Gdy|Gegeben seien|Gegeben sei|Gegeven|Gegewe|ghu' noblu'|Gitt|Given y'all|Given|Givet|Givun|Ha|Cho|I CAN HAZ|In|Ir|It's just unbelievable|I|Ja|Jeśli|Jeżeli|Kadar|Kada|Kad|Kai|Kaj|Když|Keď|Kemudian|Ketika|Khi|Kiedy|Ko|Kuid|Kui|Kun|Lan|latlh|Le sa a|Let go and haul|Le|Lè sa a|Lè|Logo|Lorsqu'<|Lorsque|mä|Maar|Mais|Mając|Majd|Maka|Manawa|Mas|Ma|Menawa|Men|Mutta|Nalikaning|Nalika|Nanging|NÃ¥r|När|Nato|NhÆ°ng|Niin|Njuk|O zaman|Og|Och|Oletetaan|Onda|Ond|Oraz|Pak|Pero|Però|Podano|Pokiaľ|Pokud|Potem|Potom|Privzeto|Pryd|qaSDI'|Quando|Quand|Quan|SÃ¥|Sed|Se|Siis|Sipoze ke|Sipoze Ke|Sipoze|Si|Şi|Și|Soit|Stel|Tada|Tad|Takrat|Tak|Tapi|Ter|Tetapi|Tha the|Tha|Then y'all|Then|Thì|Thurh|Toda|Too right|ugeholl|Und|Un|Và|vaj|Vendar|Ve|wann|Wanneer|WEN|Wenn|When y'all|When|Wtedy|Wun|Y'know|Yeah nah|Yna|Youse know like when|Youse know when youse got|Y|Za predpokladu|Za předpokladu|Zadani|Zadano|Zadan|Zadate|Zadato|Zakładając|Zaradi|Zatati|Þa þe|Þa|Þá|Þegar|Þurh|Αλλά|Δεδομένου|Και|Όταν|Τότε|А також|Агар|Але|Али|Аммо|А|Әгәр|Әйтик|Әмма|Бирок|Ва|Вә|Дадено|Дано|Допустим|Если|Задате|Задати|Задато|И|І|К тому же|Када|Кад|Когато|Когда|Коли|Ләкин|Лекин|Нәтиҗәдә|Нехай|Но|Онда|Припустимо, що|Припустимо|Пусть|Также|Та|Тогда|Тоді|То|Унда|Һәм|Якщо|אבל|אזי|אז|בהינתן|וגם|כאשר|آنگاه|اذاً|اگر|اما|اور|با فرض|بالفرض|بفرض|پھر|تب|ثم|جب|عندما|فرض کیا|لكن|لیکن|متى|هنگامی|و|अगर|और|कदा|किन्तु|चूंकि|जब|तथा|तदा|तब|परन्तु|पर|यदि|ਅਤੇ|ਜਦੋਂ|ਜਿਵੇਂ ਕਿ|ਜੇਕਰ|ਤਦ|ਪਰ|అప్పుడు|ఈ పరిస్థితిలో|కాని|చెప్పబడినది|మరియు|ಆದರೆ|ನಂತರ|ನೀಡಿದ|ಮತ್ತು|ಸ್ಥಿತಿಯನ್ನು|กำหนดให้|ดังนั้น|แต่|เมื่อ|และ|그러면<|그리고<|단<|만약<|만일<|먼저<|ì¡°ê±´<|하지만<|かつ<|しかし<|ただし<|ならば<|もし<|並且<|但し<|但是<|假如<|假定<|假設<|假设<|前提<|同时<|同時<|并且<|当<|當<|而且<|那么<|那麼<)(?=[ \t])/m, + lookbehind: true + }, + 'string': { + pattern: /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/, + inside: { + 'outline': { + pattern: /<[^>]+?>/, + alias: 'variable' + } + } + }, + 'outline': { + pattern: /<[^>]+?>/, + alias: 'variable' } - }, - 'outline': { - pattern: /<[^>]+?>/, - alias: 'variable' - } -}; + }; + +}(Prism)); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-gml.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gml.js index f41a525dea..0d18b48b70 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-gml.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-gml.js @@ -3,8 +3,8 @@ Prism.languages.gamemakerlanguage = Prism.languages.gml = Prism.languages.extend 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ulf]*/i, 'keyword': /\b(?:if|else|switch|case|default|break|for|repeat|while|do|until|continue|exit|return|globalvar|var|enum)\b/, 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not|with|at|xor|not)\b/, - 'constant': /\b(self|other|all|noone|global|local|undefined|pointer_(?:invalid|null)|action_(?:stop|restart|continue|reverse)|pi|GM_build_date|GM_version|timezone_(?:local|utc)|gamespeed_(?:fps|microseconds)|ev_(?:create|destroy|step|alarm|keyboard|mouse|collision|other|draw|draw_(?:begin|end|pre|post)|keypress|keyrelease|trigger|(?:left|right|middle|no)_button|(?:left|right|middle)_press|(?:left|right|middle)_release|mouse_(?:enter|leave|wheel_up|wheel_down)|global_(?:left|right|middle)_button|global_(?:left|right|middle)_press|global_(?:left|right|middle)_release|joystick(?:1|2)_(?:left|right|up|down|button1|button2|button3|button4|button5|button6|button7|button8)|outside|boundary|game_start|game_end|room_start|room_end|no_more_lives|animation_end|end_of_path|no_more_health|user\d|step_(?:normal|begin|end)|gui|gui_begin|gui_end)|vk_(?:nokey|anykey|enter|return|shift|control|alt|escape|space|backspace|tab|pause|printscreen|left|right|up|down|home|end|delete|insert|pageup|pagedown|f\d|numpad\d|divide|multiply|subtract|add|decimal|lshift|lcontrol|lalt|rshift|rcontrol|ralt)|mb_(?:any|none|left|right|middle)|c_(?:aqua|black|blue|dkgray|fuchsia|gray|green|lime|ltgray|maroon|navy|olive|purple|red|silver|teal|white|yellow|orange)|fa_(?:left|center|right|top|middle|bottom|readonly|hidden|sysfile|volumeid|directory|archive)|pr_(?:pointlist|linelist|linestrip|trianglelist|trianglestrip|trianglefan)|bm_(?:complex|normal|add|max|subtract|zero|one|src_colour|inv_src_colour|src_color|inv_src_color|src_alpha|inv_src_alpha|dest_alpha|inv_dest_alpha|dest_colour|inv_dest_colour|dest_color|inv_dest_color|src_alpha_sat)|audio_(?:falloff_(?:none|inverse_distance|inverse_distance_clamped|linear_distance|linear_distance_clamped|exponent_distance|exponent_distance_clamped)|old_system|new_system|mono|stereo|3d)|cr_(?:default|none|arrow|cross|beam|size_nesw|size_ns|size_nwse|size_we|uparrow|hourglass|drag|appstart|handpoint|size_all)|spritespeed_framesper(?:second|gameframe)|asset_(?:object|unknown|sprite|sound|room|path|script|font|timeline|tiles|shader)|ds_type_(?:map|list|stack|queue|grid|priority)|ef_(?:explosion|ring|ellipse|firework|smoke|smokeup|star|spark|flare|cloud|rain|snow)|pt_shape_(?:pixel|disk|square|line|star|circle|ring|sphere|flare|spark|explosion|cloud|smoke|snow)|ps_(?:distr|shape)_(?:linear|gaussian|invgaussian|rectangle|ellipse|diamond|line)|ty_(?:real|string)|dll_(?:cdel|cdecl|stdcall)|matrix_(?:view|projection|world)|os_(?:win32|windows|macosx|ios|android|linux|unknown|winphone|win8native|psvita|ps4|xboxone|ps3|uwp)|browser_(?:not_a_browser|unknown|ie|firefox|chrome|safari|safari_mobile|opera|tizen|windows_store|ie_mobile)|device_ios_(?:unknown|iphone|iphone_retina|ipad|ipad_retina|iphone5|iphone6|iphone6plus)|device_(?:emulator|tablet)|display_(?:landscape|landscape_flipped|portrait|portrait_flipped)|of_challenge_(?:win|lose|tie)|leaderboard_type_(?:number|time_mins_secs)|cmpfunc_(?:never|less|equal|lessequal|greater|notequal|greaterequal|always)|cull_(?:noculling|clockwise|counterclockwise)|lighttype_(?:dir|point)|iap_(?:ev_storeload|ev_product|ev_purchase|ev_consume|ev_restore|storeload_ok|storeload_failed|status_uninitialised|status_unavailable|status_loading|status_available|status_processing|status_restoring|failed|unavailable|available|purchased|canceled|refunded)|fb_login_(?:default|fallback_to_webview|no_fallback_to_webview|forcing_webview|use_system_account|forcing_safari)|phy_joint_(?:anchor_1_x|anchor_1_y|anchor_2_x|anchor_2_y|reaction_force_x|reaction_force_y|reaction_torque|motor_speed|angle|motor_torque|max_motor_torque|translation|speed|motor_force|max_motor_force|length_1|length_2|damping_ratio|frequency|lower_angle_limit|upper_angle_limit|angle_limits|max_length|max_torque|max_force)|phy_debug_render_(?:aabb|collision_pairs|coms|core_shapes|joints|obb|shapes)|phy_particle_flag_(?:water|zombie|wall|spring|elastic|viscous|powder|tensile|colourmixing|colormixing)|phy_particle_group_flag_(?:solid|rigid)|phy_particle_data_flag_(?:typeflags|position|velocity|colour|color|category)|achievement_(?:our_info|friends_info|leaderboard_info|info|filter_(?:all_players|friends_only|favorites_only)|type_challenge|type_score_challenge|pic_loaded|show_(?:ui|profile|leaderboard|achievement|bank|friend_picker|purchase_prompt))|network_(?:socket_(?:tcp|udp|bluetooth)|type_(?:connect|disconnect|data|non_blocking_connect)|config_(?:connect_timeout|use_non_blocking_socket|enable_reliable_udp|disable_reliable_udp))|buffer_(?:fixed|grow|wrap|fast|vbuffer|network|u8|s8|u16|s16|u32|s32|u64|f16|f32|f64|bool|text|string|seek_start|seek_relative|seek_end|generalerror|outofspace|outofbounds|invalidtype)|gp_(?:face\d|shoulderl|shoulderr|shoulderlb|shoulderrb|select|start|stickl|stickr|padu|padd|padl|padr|axislh|axislv|axisrh|axisrv)|ov_(?:friends|community|players|settings|gamegroup|achievements)|lb_sort_(?:none|ascending|descending)|lb_disp_(?:none|numeric|time_sec|time_ms)|ugc_(?:result_success|filetype_(?:community|microtrans)|visibility_(?:public|friends_only|private)|query_RankedBy(?:Vote|PublicationDate|Trend|NumTimesReported|TotalVotesAsc|VotesUp|TextSearch)|query_(?:AcceptedForGameRankedByAcceptanceDate|FavoritedByFriendsRankedByPublicationDate|CreatedByFriendsRankedByPublicationDate|NotYetRated)|sortorder_CreationOrder(?:Desc|Asc)|sortorder_(?:TitleAsc|LastUpdatedDesc|SubscriptionDateDesc|VoteScoreDesc|ForModeration)|list_(?:Published|VotedOn|VotedUp|VotedDown|WillVoteLater|Favorited|Subscribed|UsedOrPlayed|Followed)|match_(?:Items|Items_Mtx|Items_ReadyToUse|Collections|Artwork|Videos|Screenshots|AllGuides|WebGuides|IntegratedGuides|UsableInGame|ControllerBindings))|vertex_usage_(?:position|colour|color|normal|texcoord|textcoord|blendweight|blendindices|psize|tangent|binormal|fog|depth|sample)|vertex_type_(?:float\d|colour|color|ubyte4)|layerelementtype_(?:undefined|background|instance|oldtilemap|sprite|tilemap|particlesystem|tile)|tile_(?:rotate|flip|mirror|index_mask)|input_type|se_(?:chorus|compressor|echo|equalizer|flanger|gargle|none|reverb)|text_type|(obj|scr|spr|rm)\w+)\b/, - 'variable': /\b(x|y|(?:x|y)(?:previous|start)|(?:h|v)speed|direction|speed|friction|gravity|gravity_direction|path_(?:index|position|positionprevious|speed|scale|orientation|endaction)|object_index|id|solid|persistent|mask_index|instance_(?:count|id)|alarm|timeline_(?:index|position|speed|running|loop)|visible|sprite_(?:index|width|height|xoffset|yoffset)|image_(?:number|index|speed|depth|xscale|yscale|angle|alpha|blend)|bbox_(?:left|right|top|bottom)|layer|phy_(?:rotation|(?:position|linear_velocity|speed|com|collision|col_normal)_(?:x|y)|angular_(?:velocity|damping)|position_(?:x|y)previous|speed|linear_damping|bullet|fixed_rotation|active|mass|inertia|dynamic|kinematic|sleeping|collision_points)|working_directory|webgl_enabled|view_(?:(?:y|x|w|h)view|(?:y|x|w|h)port|(?:v|h)(?:speed|border)|visible|surface_id|object|enabled|current|angle)|undefined|transition_(?:steps|kind|color)|temp_directory|show_(?:score|lives|health)|secure_mode|score|room_(?:width|speed|persistent|last|height|first|caption)|room|pointer_(?:null|invalid)|os_(?:version|type|device|browser)|mouse_(?:y|x|lastbutton|button)|lives|keyboard_(?:string|lastkey|lastchar|key)|iap_data|health|gamemaker_(?:version|registered|pro)|game_(?:save|project|display)_(?:id|name)|fps_real|fps|event_(?:type|object|number|action)|error_(?:occurred|last)|display_aa|delta_time|debug_mode|cursor_sprite|current_(?:year|weekday|time|second|month|minute|hour|day)|caption_(?:score|lives|health)|browser_(?:width|height)|background_(?:yscale|y|xscale|x|width|vtiled|vspeed|visible|showcolour|showcolor|index|htiled|hspeed|height|foreground|colour|color|blend|alpha)|async_load|application_surface|argument(?:_relitive|_count|\d)|argument|global|local|self|other)\b/ + 'constant': /\b(?:self|other|all|noone|global|local|undefined|pointer_(?:invalid|null)|action_(?:stop|restart|continue|reverse)|pi|GM_build_date|GM_version|timezone_(?:local|utc)|gamespeed_(?:fps|microseconds)|ev_(?:create|destroy|step|alarm|keyboard|mouse|collision|other|draw|draw_(?:begin|end|pre|post)|keypress|keyrelease|trigger|(?:left|right|middle|no)_button|(?:left|right|middle)_press|(?:left|right|middle)_release|mouse_(?:enter|leave|wheel_up|wheel_down)|global_(?:left|right|middle)_button|global_(?:left|right|middle)_press|global_(?:left|right|middle)_release|joystick(?:1|2)_(?:left|right|up|down|button1|button2|button3|button4|button5|button6|button7|button8)|outside|boundary|game_start|game_end|room_start|room_end|no_more_lives|animation_end|end_of_path|no_more_health|user\d|step_(?:normal|begin|end)|gui|gui_begin|gui_end)|vk_(?:nokey|anykey|enter|return|shift|control|alt|escape|space|backspace|tab|pause|printscreen|left|right|up|down|home|end|delete|insert|pageup|pagedown|f\d|numpad\d|divide|multiply|subtract|add|decimal|lshift|lcontrol|lalt|rshift|rcontrol|ralt)|mb_(?:any|none|left|right|middle)|c_(?:aqua|black|blue|dkgray|fuchsia|gray|green|lime|ltgray|maroon|navy|olive|purple|red|silver|teal|white|yellow|orange)|fa_(?:left|center|right|top|middle|bottom|readonly|hidden|sysfile|volumeid|directory|archive)|pr_(?:pointlist|linelist|linestrip|trianglelist|trianglestrip|trianglefan)|bm_(?:complex|normal|add|max|subtract|zero|one|src_colour|inv_src_colour|src_color|inv_src_color|src_alpha|inv_src_alpha|dest_alpha|inv_dest_alpha|dest_colour|inv_dest_colour|dest_color|inv_dest_color|src_alpha_sat)|audio_(?:falloff_(?:none|inverse_distance|inverse_distance_clamped|linear_distance|linear_distance_clamped|exponent_distance|exponent_distance_clamped)|old_system|new_system|mono|stereo|3d)|cr_(?:default|none|arrow|cross|beam|size_nesw|size_ns|size_nwse|size_we|uparrow|hourglass|drag|appstart|handpoint|size_all)|spritespeed_framesper(?:second|gameframe)|asset_(?:object|unknown|sprite|sound|room|path|script|font|timeline|tiles|shader)|ds_type_(?:map|list|stack|queue|grid|priority)|ef_(?:explosion|ring|ellipse|firework|smoke|smokeup|star|spark|flare|cloud|rain|snow)|pt_shape_(?:pixel|disk|square|line|star|circle|ring|sphere|flare|spark|explosion|cloud|smoke|snow)|ps_(?:distr|shape)_(?:linear|gaussian|invgaussian|rectangle|ellipse|diamond|line)|ty_(?:real|string)|dll_(?:cdel|cdecl|stdcall)|matrix_(?:view|projection|world)|os_(?:win32|windows|macosx|ios|android|linux|unknown|winphone|win8native|psvita|ps4|xboxone|ps3|uwp)|browser_(?:not_a_browser|unknown|ie|firefox|chrome|safari|safari_mobile|opera|tizen|windows_store|ie_mobile)|device_ios_(?:unknown|iphone|iphone_retina|ipad|ipad_retina|iphone5|iphone6|iphone6plus)|device_(?:emulator|tablet)|display_(?:landscape|landscape_flipped|portrait|portrait_flipped)|of_challenge_(?:win|lose|tie)|leaderboard_type_(?:number|time_mins_secs)|cmpfunc_(?:never|less|equal|lessequal|greater|notequal|greaterequal|always)|cull_(?:noculling|clockwise|counterclockwise)|lighttype_(?:dir|point)|iap_(?:ev_storeload|ev_product|ev_purchase|ev_consume|ev_restore|storeload_ok|storeload_failed|status_uninitialised|status_unavailable|status_loading|status_available|status_processing|status_restoring|failed|unavailable|available|purchased|canceled|refunded)|fb_login_(?:default|fallback_to_webview|no_fallback_to_webview|forcing_webview|use_system_account|forcing_safari)|phy_joint_(?:anchor_1_x|anchor_1_y|anchor_2_x|anchor_2_y|reaction_force_x|reaction_force_y|reaction_torque|motor_speed|angle|motor_torque|max_motor_torque|translation|speed|motor_force|max_motor_force|length_1|length_2|damping_ratio|frequency|lower_angle_limit|upper_angle_limit|angle_limits|max_length|max_torque|max_force)|phy_debug_render_(?:aabb|collision_pairs|coms|core_shapes|joints|obb|shapes)|phy_particle_flag_(?:water|zombie|wall|spring|elastic|viscous|powder|tensile|colourmixing|colormixing)|phy_particle_group_flag_(?:solid|rigid)|phy_particle_data_flag_(?:typeflags|position|velocity|colour|color|category)|achievement_(?:our_info|friends_info|leaderboard_info|info|filter_(?:all_players|friends_only|favorites_only)|type_challenge|type_score_challenge|pic_loaded|show_(?:ui|profile|leaderboard|achievement|bank|friend_picker|purchase_prompt))|network_(?:socket_(?:tcp|udp|bluetooth)|type_(?:connect|disconnect|data|non_blocking_connect)|config_(?:connect_timeout|use_non_blocking_socket|enable_reliable_udp|disable_reliable_udp))|buffer_(?:fixed|grow|wrap|fast|vbuffer|network|u8|s8|u16|s16|u32|s32|u64|f16|f32|f64|bool|text|string|seek_start|seek_relative|seek_end|generalerror|outofspace|outofbounds|invalidtype)|gp_(?:face\d|shoulderl|shoulderr|shoulderlb|shoulderrb|select|start|stickl|stickr|padu|padd|padl|padr|axislh|axislv|axisrh|axisrv)|ov_(?:friends|community|players|settings|gamegroup|achievements)|lb_sort_(?:none|ascending|descending)|lb_disp_(?:none|numeric|time_sec|time_ms)|ugc_(?:result_success|filetype_(?:community|microtrans)|visibility_(?:public|friends_only|private)|query_RankedBy(?:Vote|PublicationDate|Trend|NumTimesReported|TotalVotesAsc|VotesUp|TextSearch)|query_(?:AcceptedForGameRankedByAcceptanceDate|FavoritedByFriendsRankedByPublicationDate|CreatedByFriendsRankedByPublicationDate|NotYetRated)|sortorder_CreationOrder(?:Desc|Asc)|sortorder_(?:TitleAsc|LastUpdatedDesc|SubscriptionDateDesc|VoteScoreDesc|ForModeration)|list_(?:Published|VotedOn|VotedUp|VotedDown|WillVoteLater|Favorited|Subscribed|UsedOrPlayed|Followed)|match_(?:Items|Items_Mtx|Items_ReadyToUse|Collections|Artwork|Videos|Screenshots|AllGuides|WebGuides|IntegratedGuides|UsableInGame|ControllerBindings))|vertex_usage_(?:position|colour|color|normal|texcoord|textcoord|blendweight|blendindices|psize|tangent|binormal|fog|depth|sample)|vertex_type_(?:float\d|colour|color|ubyte4)|layerelementtype_(?:undefined|background|instance|oldtilemap|sprite|tilemap|particlesystem|tile)|tile_(?:rotate|flip|mirror|index_mask)|input_type|se_(?:chorus|compressor|echo|equalizer|flanger|gargle|none|reverb)|text_type|(?:obj|scr|spr|rm)\w+)\b/, + 'variable': /\b(?:x|y|(?:x|y)(?:previous|start)|(?:h|v)speed|direction|speed|friction|gravity|gravity_direction|path_(?:index|position|positionprevious|speed|scale|orientation|endaction)|object_index|id|solid|persistent|mask_index|instance_(?:count|id)|alarm|timeline_(?:index|position|speed|running|loop)|visible|sprite_(?:index|width|height|xoffset|yoffset)|image_(?:number|index|speed|depth|xscale|yscale|angle|alpha|blend)|bbox_(?:left|right|top|bottom)|layer|phy_(?:rotation|(?:position|linear_velocity|speed|com|collision|col_normal)_(?:x|y)|angular_(?:velocity|damping)|position_(?:x|y)previous|speed|linear_damping|bullet|fixed_rotation|active|mass|inertia|dynamic|kinematic|sleeping|collision_points)|working_directory|webgl_enabled|view_(?:(?:y|x|w|h)view|(?:y|x|w|h)port|(?:v|h)(?:speed|border)|visible|surface_id|object|enabled|current|angle)|undefined|transition_(?:steps|kind|color)|temp_directory|show_(?:score|lives|health)|secure_mode|score|room_(?:width|speed|persistent|last|height|first|caption)|room|pointer_(?:null|invalid)|os_(?:version|type|device|browser)|mouse_(?:y|x|lastbutton|button)|lives|keyboard_(?:string|lastkey|lastchar|key)|iap_data|health|gamemaker_(?:version|registered|pro)|game_(?:save|project|display)_(?:id|name)|fps_real|fps|event_(?:type|object|number|action)|error_(?:occurred|last)|display_aa|delta_time|debug_mode|cursor_sprite|current_(?:year|weekday|time|second|month|minute|hour|day)|caption_(?:score|lives|health)|browser_(?:width|height)|background_(?:yscale|y|xscale|x|width|vtiled|vspeed|visible|showcolour|showcolor|index|htiled|hspeed|height|foreground|colour|color|blend|alpha)|async_load|application_surface|argument(?:_relitive|_count|\d)|argument|global|local|self|other)\b/ }); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-go.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-go.js index d730923412..fc48485482 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-go.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-go.js @@ -6,7 +6,7 @@ Prism.languages.go = Prism.languages.extend('clike', { 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i, 'string': { - pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/, + pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/, greedy: true } }); diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-groovy.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-groovy.js index 97bfb6e3a4..0a5366ddc1 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-groovy.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-groovy.js @@ -1,22 +1,24 @@ define(["prism/prism","prism/components/prism-clike"], function () { 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/, 'string': [ { - pattern: /("""|''')[\s\S]*?\1|(?:\$\/)(?:\$\/\$|[\s\S])*?\/\$/, + pattern: /("""|''')(?:[^\\]|\\[\s\S])*?\1|\$\/(?:\$\/\$|[\s\S])*?\/\$/, greedy: true }, { - pattern: /(["'\/])(?:\\.|(?!\1)[^\\\r\n])*\1/, + // TODO: Slash strings (e.g. /foo/) can contain line breaks but this will cause a lot of trouble with + // simple division (see JS regex), so find a fix maybe? + pattern: /(["'/])(?:\\.|(?!\1)[^\\\r\n])*\1/, greedy: true } ], + '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/, 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i, 'operator': { - pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, + pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, lookbehind: true }, - 'punctuation': /\.+|[{}[\];(),:$]/ + 'punctuation': /\.+|[{}[\];(),.:$]/ }); Prism.languages.insertBefore('groovy', 'string', { @@ -32,9 +34,9 @@ Prism.languages.insertBefore('groovy', 'punctuation', { Prism.languages.insertBefore('groovy', 'function', { 'annotation': { - alias: 'punctuation', pattern: /(^|[^.])@\w+/, - lookbehind: true + lookbehind: true, + alias: 'punctuation' } }); diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-haml.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-haml.js index d1930d9ea7..99fc85df10 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-haml.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-haml.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css","prism/components/prism-coffeescript","prism/components/prism-erb","prism/components/prism-javascript","prism/components/prism-less","prism/components/prism-markdown","prism/components/prism-ruby","prism/components/prism-scss","prism/components/prism-textile"], function () { +define(["prism/prism","prism/components/prism-ruby"], function () { /* TODO Handle multiline code after tag %foo= some | @@ -21,16 +21,12 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" { pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(?:(?:\r?\n|\r)\2[\t ]+.*,[\t ]*)*(?:(?:\r?\n|\r)\2[\t ]+.+)/, lookbehind: true, - inside: { - rest: Prism.languages.ruby - } + inside: Prism.languages.ruby }, { pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(?:(?:\r?\n|\r)\2[\t ]+.*\|[\t ]*)*/, lookbehind: true, - inside: { - rest: Prism.languages.ruby - } + inside: Prism.languages.ruby } ], @@ -49,9 +45,7 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" 'markup': { pattern: /((?:^|\r?\n|\r)[\t ]*)<.+/, lookbehind: true, - inside: { - rest: Prism.languages.markup - } + inside: Prism.languages.markup }, 'doctype': { pattern: /((?:^|\r?\n|\r)[\t ]*)!!!(?: .+)?/, @@ -68,9 +62,7 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" // Allows for one nested group of braces pattern: /(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/, lookbehind: true, - inside: { - rest: Prism.languages.ruby - } + inside: Prism.languages.ruby }, { pattern: /\([^)]+\)/, @@ -85,9 +77,7 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" }, { pattern: /\[[^\]]+\]/, - inside: { - rest: Prism.languages.ruby - } + inside: Prism.languages.ruby } ], 'punctuation': /[<>]/ @@ -96,9 +86,7 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" 'code': { pattern: /((?:^|\r?\n|\r)[\t ]*(?:[~-]|[&!]?=)).+/, lookbehind: true, - inside: { - rest: Prism.languages.ruby - } + inside: Prism.languages.ruby }, // Interpolations in plain text 'interpolation': { @@ -137,7 +125,7 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" 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)), + pattern: RegExp(filter_pattern.replace('{{filter_name}}', function () { return filter.filter; })), lookbehind: true, inside: { 'filter-name': { @@ -153,4 +141,5 @@ define(["prism/prism","prism/components/prism-ruby","prism/components/prism-css" Prism.languages.insertBefore('haml', 'filter', all_filters); }(Prism)); + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-handlebars.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-handlebars.js index 938232c1bd..03efb1427d 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-handlebars.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-handlebars.js @@ -22,8 +22,8 @@ define(["prism/prism","prism/components/prism-markup-templating"], function () { variable: /[\s\S]+/ } }, - 'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/, - 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/ + 'punctuation': /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/, + 'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/ }; Prism.hooks.add('before-tokenize', function(env) { diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-haskell.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-haskell.js index 83192713d9..41b7840a11 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-haskell.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-haskell.js @@ -29,7 +29,7 @@ Prism.languages.haskell = { // 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][\w']*\.)*[_a-z][\w']*`/, + 'operator': /\s\.\s|[-!#$%*+=?&@|~.:<>^\\\/]*\.[-!#$%*+=?&@|~.:<>^\\\/]+|[-!#$%*+=?&@|~.:<>^\\\/]+\.[-!#$%*+=?&@|~.:<>^\\\/]*|[-!#$%*+=?&@|~:<>^\\\/]+|`(?:[A-Z][\w']*\.)*[_a-z][\w']*`/, // In Haskell, nearly everything is a variable, do not highlight these. 'hvariable': /\b(?:[A-Z][\w']*\.)*[_a-z][\w']*\b/, 'constant': /\b(?:[A-Z][\w']*\.)*[A-Z][\w']*\b/, @@ -37,4 +37,5 @@ Prism.languages.haskell = { }; Prism.languages.hs = Prism.languages.haskell; + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-http.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-http.js index 8cf72c2219..991ee38593 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-http.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-http.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-javascript","prism/components/prism-markup"], function () { +define(["prism/prism"], function () { (function (Prism) { Prism.languages.http = { 'request-line': { @@ -64,12 +64,10 @@ define(["prism/prism","prism/components/prism-javascript","prism/components/pris options = options || {}; var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType; - options[contentType] = { + options[contentType.replace(/\//g, '-')] = { pattern: RegExp('(content-type:\\s*' + pattern + '[\\s\\S]*?)(?:\\r?\\n|\\r){2}[\\s\\S]*', 'i'), lookbehind: true, - inside: { - rest: httpLanguages[contentType] - } + inside: httpLanguages[contentType] }; } } diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-io.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-io.js index 08dac3dcff..7791dc7cea 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-io.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-io.js @@ -27,7 +27,7 @@ Prism.languages.io = { 'builtin':/\b(?:Array|AudioDevice|AudioMixer|Block|Box|Buffer|CFunction|CGI|Color|Curses|DBM|DNSResolver|DOConnection|DOProxy|DOServer|Date|Directory|Duration|DynLib|Error|Exception|FFT|File|Fnmatch|Font|Future|GL|GLE|GLScissor|GLU|GLUCylinder|GLUQuadric|GLUSphere|GLUT|Host|Image|Importer|LinkList|List|Lobby|Locals|MD5|MP3Decoder|MP3Encoder|Map|Message|Movie|Notification|Number|Object|OpenGL|Point|Protos|Regex|SGML|SGMLElement|SGMLParser|SQLite|Server|Sequence|ShowMessage|SleepyCat|SleepyCatCursor|Socket|SocketManager|Sound|Soup|Store|String|Tree|UDPSender|UPDReceiver|URL|User|Warning|WeakLink|Random|BigNum|Sequence)\b/, 'boolean': /\b(?:true|false|nil)\b/, 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e-?\d+)?/i, - 'operator': /[=!*/%+-^&|]=|>>?=?|<>?=?|<>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m, + pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m, lookbehind: true } }); + Prism.languages.insertBefore('java', 'string', { + 'triple-quoted-string': { + // http://openjdk.java.net/jeps/355#Description + pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/, + greedy: true, + alias: 'string' + } + }); + Prism.languages.insertBefore('java', 'class-name', { 'annotation': { alias: 'punctuation', @@ -36,7 +45,7 @@ define(["prism/prism","prism/components/prism-clike"], function () { lookbehind: true }, 'namespace': { - pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/, + pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(?:\.[a-z]\w*)+/, lookbehind: true, inside: { 'punctuation': /\./, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoc.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoc.js index cfeda2fd51..de1ff547e0 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoc.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoc.js @@ -1,9 +1,9 @@ -define(["prism/prism","prism/components/prism-markup","prism/components/prism-java","prism/components/prism-javadoclike","prism/components/prism-scala"], function () { +define(["prism/prism","prism/components/prism-markup","prism/components/prism-java","prism/components/prism-javadoclike"], function () { (function (Prism) { var codeLines = { 'code': { - pattern: /(^(\s*(?:\*\s*)*)).*[^*\s].+$/m, + pattern: /(^(?:\s*(?:\*\s*)*)).*[^*\s].+$/m, lookbehind: true, inside: Prism.languages.java, alias: 'language-java' diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoclike.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoclike.js index 5e46d4d5f3..385dab04f0 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoclike.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javadoclike.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-java","prism/components/prism-javascript","prism/components/prism-php"], function () { +define(["prism/prism"], function () { (function (Prism) { var javaDocLike = Prism.languages.javadoclike = { @@ -36,6 +36,7 @@ define(["prism/prism","prism/components/prism-java","prism/components/prism-java var definition = {}; definition[tokenName] = { pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/, + lookbehind: true, alias: 'comment' }; diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javascript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javascript.js index af00d3fc8d..fac96be33d 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-javascript.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-javascript.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-clike","prism/components/prism-markup"], function () { +define(["prism/prism","prism/components/prism-clike"], function () { Prism.languages.javascript = Prism.languages.extend('clike', { 'class-name': [ Prism.languages.clike['class-name'], @@ -13,27 +13,27 @@ Prism.languages.javascript = Prism.languages.extend('clike', { lookbehind: true }, { - pattern: /(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/, + pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/, lookbehind: true }, ], 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/, // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/, - 'operator': /-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ + 'function': /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/, + 'operator': /--|\+\+|\*\*=?|=>|&&|\|\||[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?[.?]?|[~:]/ }); Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/; Prism.languages.insertBefore('javascript', 'keyword', { 'regex': { - pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/, + pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*[\s\S]*?\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/, lookbehind: true, greedy: true }, // This must be declared before keyword because we use "function" inside the look-forward 'function-variable': { - pattern: /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/, + pattern: /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/, alias: 'function' }, 'parameter': [ @@ -62,11 +62,16 @@ Prism.languages.insertBefore('javascript', 'keyword', { Prism.languages.insertBefore('javascript', 'string', { 'template-string': { - pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|[^\\`])*`/, + pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/, greedy: true, inside: { + 'template-punctuation': { + pattern: /^`|`$/, + alias: 'string' + }, 'interpolation': { - pattern: /\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/, + pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/, + lookbehind: true, inside: { 'interpolation-punctuation': { pattern: /^\${|}$/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jolie.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jolie.js index e1e910c7a6..1cdc70bf3f 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jolie.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jolie.js @@ -24,7 +24,7 @@ Prism.languages.insertBefore( 'jolie', 'keyword', { pattern: /(\bAggregates\s*:\s*)(?:\w+(?:\s+with\s+\w+)?\s*,\s*)*\w+(?:\s+with\s+\w+)?/, lookbehind: true, inside: { - 'withExtension': { + 'with-extension': { pattern: /\bwith\s+\w+/, inside: { 'keyword' : /\bwith\b/ @@ -54,4 +54,5 @@ Prism.languages.insertBefore( 'jolie', 'keyword', { } } }); + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jq.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jq.js index 92447b5f9c..610b41a6c2 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jq.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jq.js @@ -2,7 +2,7 @@ define(["prism/prism"], function () { (function (Prism) { var interpolation = /\\\((?:[^()]|\([^()]*\))*\)/.source; - var string = RegExp(/"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, interpolation)); + var string = RegExp(/"(?:[^"\r\n\\]|\\[^\r\n(]|__)*"/.source.replace(/__/g, function () { return interpolation; })); var stringInterpolation = { 'interpolation': { pattern: RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + interpolation), diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-extras.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-extras.js index cb08c4cac0..0f8571aff3 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-extras.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-extras.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-javascript","prism/components/prism-actionscript","prism/components/prism-coffeescript","prism/components/prism-flow","prism/components/prism-n4js","prism/components/prism-typescript"], function () { +define(["prism/prism","prism/components/prism-javascript"], function () { (function (Prism) { Prism.languages.insertBefore('javascript', 'function-variable', { @@ -61,7 +61,7 @@ define(["prism/prism","prism/components/prism-javascript","prism/components/pris Prism.languages.insertBefore('javascript', 'punctuation', { 'property-access': { - pattern: /(\.\s*)[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*/, + pattern: /(\.\s*)#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*/, lookbehind: true }, 'maybe-class-name': { diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-templates.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-templates.js new file mode 100644 index 0000000000..1dc384d69e --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-js-templates.js @@ -0,0 +1,349 @@ +define(["prism/prism","prism/components/prism-javascript"], function () { +(function (Prism) { + + var templateString = Prism.languages.javascript['template-string']; + + // see the pattern in prism-javascript.js + var templateLiteralPattern = templateString.pattern.source; + var interpolationObject = templateString.inside['interpolation']; + var interpolationPunctuationObject = interpolationObject.inside['interpolation-punctuation']; + var interpolationPattern = interpolationObject.pattern.source; + + + /** + * Creates a new pattern to match a template string with a special tag. + * + * This will return `undefined` if there is no grammar with the given language id. + * + * @param {string} language The language id of the embedded language. E.g. `markdown`. + * @param {string} tag The regex pattern to match the tag. + * @returns {object | undefined} + * @example + * createTemplate('css', /\bcss/.source); + */ + function createTemplate(language, tag) { + if (!Prism.languages[language]) { + return undefined; + } + + return { + pattern: RegExp('((?:' + tag + ')\\s*)' + templateLiteralPattern), + lookbehind: true, + greedy: true, + inside: { + 'template-punctuation': { + pattern: /^`|`$/, + alias: 'string' + }, + 'embedded-code': { + pattern: /[\s\S]+/, + alias: language + } + } + }; + } + + + Prism.languages.javascript['template-string'] = [ + // styled-jsx: + // css`a { color: #25F; }` + // styled-components: + // styled.h1`color: red;` + createTemplate('css', /\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source), + + // html`

` + // div.innerHTML = `

` + createTemplate('html', /\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source), + + // svg`` + createTemplate('svg', /\bsvg/.source), + + // md`# h1`, markdown`## h2` + createTemplate('markdown', /\b(?:md|markdown)/.source), + + // gql`...`, graphql`...`, graphql.experimental`...` + createTemplate('graphql', /\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source), + + // vanilla template string + templateString + ].filter(Boolean); + + + /** + * Returns a specific placeholder literal for the given language. + * + * @param {number} counter + * @param {string} language + * @returns {string} + */ + function getPlaceholder(counter, language) { + return '___' + language.toUpperCase() + '_' + counter + '___'; + } + + /** + * Returns the tokens of `Prism.tokenize` but also runs the `before-tokenize` and `after-tokenize` hooks. + * + * @param {string} code + * @param {any} grammar + * @param {string} language + * @returns {(string|Token)[]} + */ + function tokenizeWithHooks(code, grammar, language) { + var env = { + code: code, + grammar: grammar, + language: language + }; + Prism.hooks.run('before-tokenize', env); + env.tokens = Prism.tokenize(env.code, env.grammar); + Prism.hooks.run('after-tokenize', env); + return env.tokens; + } + + /** + * Returns the token of the given JavaScript interpolation expression. + * + * @param {string} expression The code of the expression. E.g. `"${42}"` + * @returns {Token} + */ + function tokenizeInterpolationExpression(expression) { + var tempGrammar = {}; + tempGrammar['interpolation-punctuation'] = interpolationPunctuationObject; + + /** @type {Array} */ + var tokens = Prism.tokenize(expression, tempGrammar); + if (tokens.length === 3) { + /** + * The token array will look like this + * [ + * ["interpolation-punctuation", "${"] + * "..." // JavaScript expression of the interpolation + * ["interpolation-punctuation", "}"] + * ] + */ + + var args = [1, 1]; + args.push.apply(args, tokenizeWithHooks(tokens[1], Prism.languages.javascript, 'javascript')); + + tokens.splice.apply(tokens, args); + } + + return new Prism.Token('interpolation', tokens, interpolationObject.alias, expression); + } + + /** + * Tokenizes the given code with support for JavaScript interpolation expressions mixed in. + * + * This function has 3 phases: + * + * 1. Replace all JavaScript interpolation expression with a placeholder. + * The placeholder will have the syntax of a identify of the target language. + * 2. Tokenize the code with placeholders. + * 3. Tokenize the interpolation expressions and re-insert them into the tokenize code. + * The insertion only works if a placeholder hasn't been "ripped apart" meaning that the placeholder has been + * tokenized as two tokens by the grammar of the embedded language. + * + * @param {string} code + * @param {object} grammar + * @param {string} language + * @returns {Token} + */ + function tokenizeEmbedded(code, grammar, language) { + // 1. First filter out all interpolations + + // because they might be escaped, we need a lookbehind, so we use Prism + /** @type {(Token|string)[]} */ + var _tokens = Prism.tokenize(code, { + 'interpolation': { + pattern: RegExp(interpolationPattern), + lookbehind: true + } + }); + + // replace all interpolations with a placeholder which is not in the code already + var placeholderCounter = 0; + /** @type {Object} */ + var placeholderMap = {}; + var embeddedCode = _tokens.map(function (token) { + if (typeof token === 'string') { + return token; + } else { + var interpolationExpression = token.content; + + var placeholder; + while (code.indexOf(placeholder = getPlaceholder(placeholderCounter++, language)) !== -1) { } + placeholderMap[placeholder] = interpolationExpression; + return placeholder; + } + }).join(''); + + + // 2. Tokenize the embedded code + + var embeddedTokens = tokenizeWithHooks(embeddedCode, grammar, language); + + + // 3. Re-insert the interpolation + + var placeholders = Object.keys(placeholderMap); + placeholderCounter = 0; + + /** + * + * @param {(Token|string)[]} tokens + * @returns {void} + */ + function walkTokens(tokens) { + for (var i = 0; i < tokens.length; i++) { + if (placeholderCounter >= placeholders.length) { + return; + } + + var token = tokens[i]; + + if (typeof token === 'string' || typeof token.content === 'string') { + var placeholder = placeholders[placeholderCounter]; + var s = typeof token === 'string' ? token : /** @type {string} */ (token.content); + + var index = s.indexOf(placeholder); + if (index !== -1) { + ++placeholderCounter; + + var before = s.substring(0, index); + var middle = tokenizeInterpolationExpression(placeholderMap[placeholder]); + var after = s.substring(index + placeholder.length); + + var replacement = []; + if (before) { + replacement.push(before); + } + replacement.push(middle); + if (after) { + var afterTokens = [after]; + walkTokens(afterTokens); + replacement.push.apply(replacement, afterTokens); + } + + if (typeof token === 'string') { + tokens.splice.apply(tokens, [i, 1].concat(replacement)); + i += replacement.length - 1; + } else { + token.content = replacement; + } + } + } else { + var content = token.content; + if (Array.isArray(content)) { + walkTokens(content); + } else { + walkTokens([content]); + } + } + } + } + walkTokens(embeddedTokens); + + return new Prism.Token(language, embeddedTokens, 'language-' + language, code); + } + + /** + * The languages for which JS templating will handle tagged template literals. + * + * JS templating isn't active for only JavaScript but also related languages like TypeScript, JSX, and TSX. + */ + var supportedLanguages = { + 'javascript': true, + 'js': true, + 'typescript': true, + 'ts': true, + 'jsx': true, + 'tsx': true, + }; + Prism.hooks.add('after-tokenize', function (env) { + if (!(env.language in supportedLanguages)) { + return; + } + + /** + * Finds and tokenizes all template strings with an embedded languages. + * + * @param {(Token | string)[]} tokens + * @returns {void} + */ + function findTemplateStrings(tokens) { + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + continue; + } + + var content = token.content; + if (!Array.isArray(content)) { + if (typeof content !== 'string') { + findTemplateStrings([content]); + } + continue; + } + + if (token.type === 'template-string') { + /** + * A JavaScript template-string token will look like this: + * + * ["template-string", [ + * ["template-punctuation", "`"], + * ( + * An array of "string" and "interpolation" tokens. This is the simple string case. + * or + * ["embedded-code", "..."] This is the token containing the embedded code. + * It also has an alias which is the language of the embedded code. + * ), + * ["template-punctuation", "`"] + * ]] + */ + + var embedded = content[1]; + if (content.length === 3 && typeof embedded !== 'string' && embedded.type === 'embedded-code') { + // get string content + var code = stringContent(embedded); + + var alias = embedded.alias; + var language = Array.isArray(alias) ? alias[0] : alias; + + var grammar = Prism.languages[language]; + if (!grammar) { + // the embedded language isn't registered. + continue; + } + + content[1] = tokenizeEmbedded(code, grammar, language); + } + } else { + findTemplateStrings(content); + } + } + } + + findTemplateStrings(env.tokens); + }); + + + /** + * Returns the string content of a token or token stream. + * + * @param {string | Token | (string | Token)[]} value + * @returns {string} + */ + function stringContent(value) { + if (typeof value === 'string') { + return value; + } else if (Array.isArray(value)) { + return value.map(stringContent).join(''); + } else { + return stringContent(value.content); + } + } + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsdoc.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsdoc.js index 79865ce4ce..fbf6cbc014 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsdoc.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsdoc.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-javascript","prism/components/prism-javadoclike","prism/components/prism-actionscript","prism/components/prism-coffeescript"], function () { +define(["prism/prism","prism/components/prism-javascript","prism/components/prism-javadoclike"], function () { (function (Prism) { var javascript = Prism.languages.javascript; diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-json.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-json.js index c2ce8f9e15..58cfc2be5b 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-json.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-json.js @@ -9,7 +9,7 @@ Prism.languages.json = { greedy: true }, 'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, - 'number': /-?\d+\.?\d*(e[+-]?\d+)?/i, + 'number': /-?\d+\.?\d*(?:e[+-]?\d+)?/i, 'punctuation': /[{}[\],]/, 'operator': /:/, 'boolean': /\b(?:true|false)\b/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsx.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsx.js index cd8281d726..c3e60df7bf 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsx.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-jsx.js @@ -1,10 +1,10 @@ -define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript","prism/components/prism-jsdoc","prism/components/prism-js-extras"], function () { +define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript"], function () { (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.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i; +Prism.languages.jsx.tag.pattern= /<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:$-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}))*\s*\/?)?>/i; Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i; Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i; @@ -12,7 +12,7 @@ Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z Prism.languages.insertBefore('inside', 'attr-name', { 'spread': { - pattern: /\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/, + pattern: /\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}/, inside: { 'punctuation': /\.{3}|[{}.]/, 'attr-value': /\w+/ @@ -23,7 +23,7 @@ Prism.languages.insertBefore('inside', 'attr-name', { Prism.languages.insertBefore('inside', 'attr-value',{ 'script': { // Allow for two levels of nesting - pattern: /=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i, + pattern: /=(?:\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i, inside: { 'script-punctuation': { pattern: /^=(?={)/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-kotlin.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-kotlin.js index cf5fc48a09..d61dd9b73b 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-kotlin.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-kotlin.js @@ -43,7 +43,7 @@ define(["prism/prism","prism/components/prism-clike"], function () { { pattern: /\$\{[^}]+\}/, inside: { - delimiter: { + 'delimiter': { pattern: /^\$\{|\}$/, alias: 'variable' }, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-latte.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-latte.js new file mode 100644 index 0000000000..528f2043bd --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-latte.js @@ -0,0 +1,72 @@ +define(["prism/prism","prism/components/prism-clike","prism/components/prism-markup-templating","prism/components/prism-php"], function () { +(function (Prism) { + Prism.languages.latte = { + 'comment': /^\{\*[\s\S]*/, + 'ld': { + pattern: /^\{(?:[=_]|\/?(?!\d|\w+\()\w+|)/, + inside: { + 'punctuation': /^\{\/?/, + 'tag': { + pattern: /.+/, + alias: 'important' + } + } + }, + 'rd': { + pattern: /\}$/, + inside: { + 'punctuation': /.+/ + } + }, + 'php': { + pattern: /\S(?:[\s\S]*\S)?/, + alias: 'language-php', + inside: Prism.languages.php + } + }; + + var markupLatte = Prism.languages.extend('markup', {}); + Prism.languages.insertBefore('inside', 'attr-value', { + 'n-attr': { + pattern: /n:[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+))?/, + inside: { + 'attr-name': { + pattern: /^[^\s=]+/, + alias: 'important' + }, + 'attr-value': { + pattern: /=[\s\S]+/, + inside: { + 'punctuation': [ + /^=/, + { + pattern: /^(\s*)["']|["']$/, + lookbehind: true + } + ], + 'php': { + pattern: /\S(?:[\s\S]*\S)?/, + inside: Prism.languages.php + } + } + }, + } + }, + }, markupLatte.tag); + + Prism.hooks.add('before-tokenize', function(env) { + if (env.language !== 'latte') { + return; + } + var lattePattern = /\{\*[\s\S]*?\*\}|\{[^'"\s{}*](?:[^"'/{}]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|\/\*[\s\S]*?\*\/)*?\}/g; + Prism.languages['markup-templating'].buildPlaceholders(env, 'latte', lattePattern); + env.grammar = markupLatte; + }); + + Prism.hooks.add('after-tokenize', function(env) { + Prism.languages['markup-templating'].tokenizePlaceholders(env, 'latte'); + }); + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-less.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-less.js index 9e88c659d3..3b52f29197 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-less.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-less.js @@ -16,14 +16,14 @@ Prism.languages.less = Prism.languages.extend('css', { } ], 'atrule': { - pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i, + pattern: /@[\w-]+?(?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};])*?(?=\s*\{)/, inside: { 'punctuation': /[:()]/ } }, // selectors and mixins are considered the same 'selector': { - pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/, + pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@])*?(?=\s*\{)/, inside: { // mixin parameters 'variable': /@+[\w-]+/ diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-lilypond.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-lilypond.js new file mode 100644 index 0000000000..5ca1553dbc --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-lilypond.js @@ -0,0 +1,72 @@ +define(["prism/prism","prism/components/prism-scheme"], function () { +(function (Prism) { + + var schemeExpression = /\((?:[^();"#\\]|\\[\s\S]|;.*|"(?:[^"\\]|\\.)*"|#(?:\{(?:(?!#\})[\s\S])*#\}|[^{])|)*\)/.source; + // allow for up to pow(2, recursivenessLog2) many levels of recursive brace expressions + // For some reason, this can't be 4 + var recursivenessLog2 = 5; + for (var i = 0; i < recursivenessLog2; i++) { + schemeExpression = schemeExpression.replace(//g, function () { return schemeExpression; }); + } + schemeExpression = schemeExpression.replace(//g, /[^\s\S]/.source); + + + var lilypond = Prism.languages.lilypond = { + 'comment': /%(?:(?!\{).*|\{[\s\S]*?%\})/, + 'embedded-scheme': { + pattern: RegExp(/(^|[=\s])#(?:"(?:[^"\\]|\\.)*"|[^\s()"]*(?:[^\s()]|))/.source.replace(//g, function () { return schemeExpression; }), 'm'), + lookbehind: true, + greedy: true, + inside: { + 'scheme': { + pattern: /^(#)[\s\S]+$/, + lookbehind: true, + alias: 'language-scheme', + inside: { + 'embedded-lilypond': { + pattern: /#\{[\s\S]*?#\}/, + greedy: true, + inside: { + 'punctuation': /^#\{|#\}$/, + 'lilypond': { + pattern: /[\s\S]+/, + alias: 'language-lilypond', + inside: null // see below + } + } + }, + rest: Prism.languages.scheme + } + }, + 'punctuation': /#/ + } + }, + 'string': { + pattern: /"(?:[^"\\]|\\.)*"/, + greedy: true + }, + 'class-name': { + pattern: /(\\new\s+)[\w-]+/, + lookbehind: true + }, + 'keyword': { + pattern: /\\[a-z][-\w]*/i, + inside: { + 'punctuation': /^\\/ + } + }, + 'operator': /[=|]|<<|>>/, + 'punctuation': { + pattern: /(^|[a-z\d])(?:'+|,+|[_^]?-[_^]?(?:[-+^!>._]|(?=\d))|[_^]\.?|[.!])|[{}()[\]<>^~]|\\[()[\]<>\\!]|--|__/, + lookbehind: true + }, + 'number': /\b\d+(?:\/\d+)?\b/ + }; + + lilypond['embedded-scheme'].inside['scheme'].inside['embedded-lilypond'].inside['lilypond'].inside = lilypond; + + Prism.languages.ly = lilypond; + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-lisp.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-lisp.js index 1b178ea3fc..482e12b9c7 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-lisp.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-lisp.js @@ -131,7 +131,7 @@ define(["prism/prism"], function () { }, punctuation: [ // open paren, brackets, and close paren - /(['`,]?\(|[)\[\]])/, + /(?:['`,]?\(|[)\[\]])/, // cons { pattern: /(\s)\.(?=\s)/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-livescript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-livescript.js index cf8995826e..7e7efb089a 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-livescript.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-livescript.js @@ -48,7 +48,7 @@ Prism.languages.livescript = { ], 'regex': [ { - pattern: /\/\/(\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/, + pattern: /\/\/(?:\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/, greedy: true, inside: { 'comment': { @@ -58,7 +58,7 @@ Prism.languages.livescript = { } }, { - pattern: /\/(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}/, + pattern: /\/(?:\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}/, greedy: true } ], @@ -118,4 +118,5 @@ Prism.languages.livescript = { }; Prism.languages.livescript['interpolated-string'].inside['interpolation'].inside.rest = Prism.languages.livescript; + return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-llvm.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-llvm.js new file mode 100644 index 0000000000..8581628498 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-llvm.js @@ -0,0 +1,22 @@ +define(["prism/prism"], function () { +(function(Prism) { + Prism.languages.llvm = { + 'comment': /;.*/, + 'string': { + pattern: /"[^"]*"/, + greedy: true, + }, + 'boolean': /\b(?:true|false)\b/, + 'variable': /[%@!#](?:(?!\d)(?:[-$.\w]|\\[a-f\d]{2})+|\d+)/i, + 'label': /(?!\d)(?:[-$.\w]|\\[a-f\d]{2})+:/i, + 'type': { + pattern: /\b(?:double|float|fp128|half|i[1-9]\d*|label|metadata|ppc_fp128|token|void|x86_fp80|x86_mmx)\b/, + alias: 'class-name', + }, + 'keyword': /\b[a-z_][a-z_0-9]*\b/, + 'number': /[+-]?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b|\b0x[\dA-Fa-f]+\b|\b0xK[\dA-Fa-f]{20}\b|\b0x[ML][\dA-Fa-f]{32}\b|\b0xH[\dA-Fa-f]{4}\b/, + 'punctuation': /[{}[\];(),.!*=<>]/, + }; +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-markdown.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-markdown.js index 1781a3686f..4a19b7aed2 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-markdown.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-markdown.js @@ -2,7 +2,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { (function (Prism) { // Allow only one line break - var inner = /\\.|[^\\\n\r_]|(?:\r?\n|\r)(?!\r?\n|\r)/.source; + var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?!\n|\r\n?))/.source; /** * This function is intended for the creation of the bold or italic pattern. @@ -16,7 +16,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { * @returns {RegExp} */ function createInline(pattern, starAlternative) { - pattern = pattern.replace(//g, inner); + pattern = pattern.replace(//g, function () { return inner; }); if (starAlternative) { pattern = pattern + '|' + pattern.replace(/_/g, '\\*'); } @@ -24,6 +24,11 @@ define(["prism/prism","prism/components/prism-markup"], function () { } + var tableCell = /(?:\\.|``.+?``|`[^`\r\n]+`|[^\\|\r\n`])+/.source; + var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|$)/.source.replace(/__/g, function () { return tableCell; }); + var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source; + + Prism.languages.markdown = Prism.languages.extend('markup', {}); Prism.languages.insertBefore('markdown', 'prolog', { 'blockquote': { @@ -31,16 +36,51 @@ define(["prism/prism","prism/components/prism-markup"], function () { pattern: /^>(?:[\t ]*>)*/m, alias: 'punctuation' }, + 'table': { + pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'), + inside: { + 'table-data-rows': { + pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'), + lookbehind: true, + inside: { + 'table-data': { + pattern: RegExp(tableCell), + inside: Prism.languages.markdown + }, + 'punctuation': /\|/ + } + }, + 'table-line': { + pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'), + lookbehind: true, + inside: { + 'punctuation': /\||:?-{3,}:?/ + } + }, + 'table-header-row': { + pattern: RegExp('^' + tableRow + '$'), + inside: { + 'table-header': { + pattern: RegExp(tableCell), + alias: 'important', + inside: Prism.languages.markdown + }, + 'punctuation': /\|/ + } + } + } + }, 'code': [ { - // Prefixed by 4 spaces or 1 tab - pattern: /^(?: {4}|\t).+/m, + // Prefixed by 4 spaces or 1 tab and preceded by an empty line + pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/, + lookbehind: true, alias: 'keyword' }, { // `code` // ``code`` - pattern: /``.+?``|`[^`\n]+`/, + pattern: /``.+?``|`[^`\r\n]+`/, alias: 'keyword' }, { @@ -51,7 +91,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { greedy: true, inside: { 'code-block': { - pattern: /^(```.*(?:\r?\n|\r))[\s\S]+?(?=(?:\r?\n|\r)^```$)/m, + pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m, lookbehind: true }, 'code-language': { @@ -69,7 +109,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { // title 2 // ------- - pattern: /\S.*(?:\r?\n|\r)(?:==+|--+)/, + pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m, alias: 'important', inside: { punctuation: /==+$|--+$/ @@ -125,7 +165,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { // __strong__ // allow one nested instance of italic text using the same delimiter - pattern: createInline(/__(?:|_(?:)+_)+__/.source, true), + pattern: createInline(/__(?:(?!_)|_(?:(?!_))+_)+__/.source, true), lookbehind: true, greedy: true, inside: { @@ -142,7 +182,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { // _em_ // allow one nested instance of bold text using the same delimiter - pattern: createInline(/_(?:|__(?:)+__)+_/.source, true), + pattern: createInline(/_(?:(?!_)|__(?:(?!_))+__)+_/.source, true), lookbehind: true, greedy: true, inside: { @@ -157,9 +197,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { 'strike': { // ~~strike through~~ // ~strike~ - - // extra _ is because the inner pattern intentionally doesn't include it because of bold and italic - pattern: createInline(/(~~?)(?:|_)+?\2/.source, false), + pattern: createInline(/(~~?)(?:(?!~))+?\2/.source, false), lookbehind: true, greedy: true, inside: { @@ -173,13 +211,21 @@ define(["prism/prism","prism/components/prism-markup"], function () { }, 'url': { // [example](http://example.com "Optional title") + // [example][id] // [example] [id] - pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/, + pattern: createInline(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[(?:(?!\]))+\])/.source, false), + lookbehind: true, + greedy: true, inside: { 'variable': { - pattern: /(!?\[)[^\]]+(?=\]$)/, + pattern: /(\[)[^\]]+(?=\]$)/, lookbehind: true }, + 'content': { + pattern: /(^!?\[)[^\]]+(?=\])/, + lookbehind: true, + inside: {} // see below + }, 'string': { pattern: /"(?:\\.|[^"\\])*"(?=\)$)/ } @@ -187,7 +233,7 @@ define(["prism/prism","prism/components/prism-markup"], function () { } }); - ['bold', 'italic', 'strike'].forEach(function (token) { + ['url', 'bold', 'italic', 'strike'].forEach(function (token) { ['url', 'bold', 'italic', 'strike'].forEach(function (inside) { if (token !== inside) { Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside]; @@ -235,7 +281,12 @@ define(["prism/prism","prism/components/prism-markup"], function () { typeof codeLang.content === 'string') { // this might be a language that Prism does not support - var alias = 'language-' + codeLang.content.trim().split(/\s+/)[0].toLowerCase(); + + // do some replacements to support C++, C#, and F# + var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp') + // only use the first word + lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase(); + var alias = 'language-' + lang; // add alias if (!codeBlock.alias) { @@ -270,13 +321,23 @@ define(["prism/prism","prism/components/prism-markup"], function () { var grammar = Prism.languages[codeLang]; if (!grammar) { - return; - } + if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) { + var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16); + env.attributes['id'] = id; - // reverse Prism.util.encode - var code = env.content.replace(/</g, '<').replace(/&/g, '&'); + Prism.plugins.autoloader.loadLanguages(codeLang, function () { + var ele = document.getElementById(id); + if (ele) { + ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang); + } + }); + } + } else { + // reverse Prism.util.encode + var code = env.content.replace(/</g, '<').replace(/&/g, '&'); - env.content = Prism.highlight(code, grammar, codeLang); + env.content = Prism.highlight(code, grammar, codeLang); + } }); Prism.languages.md = Prism.languages.markdown; diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-markup.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-markup.js index 3469a88a19..e1c955878c 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-markup.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-markup.js @@ -2,7 +2,10 @@ define(["prism/prism"], function () { Prism.languages.markup = { 'comment': //, 'prolog': /<\?[\s\S]+?\?>/, - 'doctype': //i, + 'doctype': { + pattern: /"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:(?!)*\]\s*)?>/i, + greedy: true + }, 'cdata': //i, 'tag': { pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i, @@ -85,7 +88,7 @@ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', { var def = {}; def[tagName] = { - pattern: RegExp(/(<__[\s\S]*?>)(?:\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, tagName), 'i'), + pattern: RegExp(/(<__[\s\S]*?>)(?:\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'), lookbehind: true, greedy: true, inside: inside diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-moonscript.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-moonscript.js new file mode 100644 index 0000000000..64c9d0a0fa --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-moonscript.js @@ -0,0 +1,60 @@ +define(["prism/prism"], function () { +Prism.languages.moonscript = { + 'comment': /--.*/, + 'string': [ + { + pattern: /'[^']*'|\[(=*)\[[\s\S]*?\]\1\]/, + greedy: true + }, + { + pattern: /"[^"]*"/, + greedy: true, + inside: { + 'interpolation': { + pattern: /#\{[^{}]*\}/, + inside: { + 'moonscript': { + pattern: /(^#\{)[\s\S]+(?=\})/, + lookbehind: true, + inside: null // see beow + }, + 'interpolation-punctuation': { + pattern: /#\{|\}/, + alias: 'punctuation' + } + } + } + } + } + ], + 'class-name': [ + { + pattern: /(\b(?:class|extends)[ \t]+)\w+/, + lookbehind: true + }, + // class-like names start with a capital letter + /\b[A-Z]\w*/ + ], + 'keyword': /\b(?:class|continue|do|else|elseif|export|extends|for|from|if|import|in|local|nil|return|self|super|switch|then|unless|using|when|while|with)\b/, + 'variable': /@@?\w*/, + 'property': { + pattern: /\b(?!\d)\w+(?=:)|(:)(?!\d)\w+/, + lookbehind: true + }, + 'function': { + pattern: /\b(?:_G|_VERSION|assert|collectgarbage|coroutine\.(?:running|create|resume|status|wrap|yield)|debug\.(?:debug|gethook|getinfo|getlocal|getupvalue|setlocal|setupvalue|sethook|traceback|getfenv|getmetatable|getregistry|setfenv|setmetatable)|dofile|error|getfenv|getmetatable|io\.(?:stdin|stdout|stderr|close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|ipairs|load|loadfile|loadstring|math\.(?:abs|acos|asin|atan|atan2|ceil|sin|cos|tan|deg|exp|floor|log|log10|max|min|fmod|modf|cosh|sinh|tanh|pow|rad|sqrt|frexp|ldexp|random|randomseed|pi)|module|next|os\.(?:clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\.(?:cpath|loaded|loadlib|path|preload|seeall)|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|string\.(?:byte|char|dump|find|len|lower|rep|sub|upper|format|gsub|gmatch|match|reverse)|table\.(?:maxn|concat|sort|insert|remove)|tonumber|tostring|type|unpack|xpcall)\b/, + inside: { + 'punctuation': /\./ + } + }, + 'boolean': /\b(?:false|true)\b/, + 'number': /(?:\B\.\d+|\b\d+\.\d+|\b\d+(?=[eE]))(?:[eE][-+]?\d+)?\b|\b(?:0x[a-fA-F\d]+|\d+)(?:U?LL)?\b/, + 'operator': /\.{3}|[-=]>|~=|(?:[-+*/%<>!=]|\.\.)=?|[:#^]|\b(?:and|or)\b=?|\b(?:not)\b/, + 'punctuation': /[.,()[\]{}\\]/ +}; + +Prism.languages.moonscript.string[1].inside.interpolation.inside.moonscript.inside = Prism.languages.moonscript; + +Prism.languages.moon = Prism.languages.moonscript; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-n4js.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-n4js.js index f5b1c7f71a..1d6b902e68 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-n4js.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-n4js.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-javascript","prism/components/prism-jsdoc"], function () { +define(["prism/prism","prism/components/prism-javascript"], function () { Prism.languages.n4js = Prism.languages.extend('javascript', { // Keywords from N4JS language spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html 'keyword': /\b(?:any|Array|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/ diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-neon.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-neon.js new file mode 100644 index 0000000000..461131c720 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-neon.js @@ -0,0 +1,44 @@ +define(["prism/prism"], function () { +Prism.languages.neon = { + 'comment': { + pattern: /#.*/, + greedy: true + }, + 'datetime': { + pattern: /(^|[[{(=:,\s])\d\d\d\d-\d\d?-\d\d?(?:(?:[Tt]| +)\d\d?:\d\d:\d\d(?:\.\d*)? *(?:Z|[-+]\d\d?(?::?\d\d)?)?)?(?=$|[\]}),\s])/, + lookbehind: true, + alias: 'number' + }, + 'key': { + pattern: /(^|[[{(,\s])[^,:=[\]{}()'"\s]+(?=\s*:(?:$|[\]}),\s])|\s*=)/, + lookbehind: true, + alias: 'atrule' + }, + 'number': { + pattern: /(^|[[{(=:,\s])[+-]?(?:0x[\da-fA-F]+|0o[0-7]+|0b[01]+|(?:\d+\.?\d*|\.?\d+)(?:[eE][+-]?\d+)?)(?=$|[\]}),:=\s])/, + lookbehind: true + }, + 'boolean': { + pattern: /(^|[[{(=:,\s])(?:true|false|yes|no)(?=$|[\]}),:=\s])/i, + lookbehind: true + }, + 'null': { + pattern: /(^|[[{(=:,\s])(?:null)(?=$|[\]}),:=\s])/i, + lookbehind: true, + alias: 'keyword' + }, + 'string': { + pattern: /(^|[[{(=:,\s])(?:('''|""")\r?\n(?:(?:[^\r\n]|\r?\n(?![\t ]*\2))*\r?\n)?[\t ]*\2|'[^'\r\n]*'|"(?:\\.|[^"\r\n])*")/, + lookbehind: true, + greedy: true + }, + 'literal': { + pattern: /(^|[[{(=:,\s])(?:[^#"\',:=[\]{}()\s`-]|[:-][^"\',=[\]{}()\s])(?:[^,:=\]})(\s]+|:(?![\s,\]})]|$)|[ \t]+[^#,:=\]})(\s])*/, + lookbehind: true, + alias: 'string', + }, + 'punctuation': /[,:=[\]{}()-]/, +}; + + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-nsis.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-nsis.js index efcd88be91..3b0d930ef7 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-nsis.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-nsis.js @@ -6,7 +6,7 @@ define(["prism/prism"], function () { */ Prism.languages.nsis = { 'comment': { - pattern: /(^|[^\\])(\/\*[\s\S]*?\*\/|[#;].*)/, + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|[#;].*)/, lookbehind: true }, 'string': { @@ -17,7 +17,7 @@ define(["prism/prism"], function () { pattern: /(^\s*)(?:Abort|Add(?:BrandingImage|Size)|AdvSplash|Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(?:Font|Gradient|Image)|BrandingText|BringToFront|Call(?:InstDLL)?|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(?:Directory|Font|ShortCut)|Delete(?:INISec|INIStr|RegKey|RegValue)?|Detail(?:Print|sButtonText)|Dialer|Dir(?:Text|Var|Verify)|EnableWindow|Enum(?:RegKey|RegValue)|Exch|Exec(?:Shell(?:Wait)?|Wait)?|ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)?|Find(?:Close|First|Next|Window)|FlushINI|Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|ErrorLevel|FileTime(?:Local)?|FullPathName|Function(?:Address|End)?|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(?:Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|InstProgressFlags|Inst(?:Type(?:GetText|SetText)?)|Int(?:64|Ptr)?CmpU?|Int(?:64)?Fmt|Int(?:Ptr)?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(?:Callbacks)?|PE(?:DllCharacteristics|SubsysVer)|Pop|Push|Quit|Read(?:EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(?:End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)?|SendMessage|Set(?:AutoClose|BrandingImage|Compress|Compressor(?:DictSize)?|CtlColors|CurInstType|DatablockOptimize|DateSave|Details(?:Print|View)|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(?:InstDetails|UninstDetails|Window)|Silent(?:Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(?:CmpS?|Cpy|Len)|SubCaption|System|Unicode|Uninstall(?:ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(?:AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|Write(?:INIStr|Reg(?:Bin|DWORD|ExpandStr|MultiStr|None|Str)|Uninstaller)|XPStyle)\b/m, lookbehind: true }, - '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|LM)(32|64)?|DD|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/, + '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|LM)(?:32|64)?|DD|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/, 'constant': /\${[\w\.:\^-]+}|\$\([\w\.:\^-]+\)/i, 'variable': /\$\w+/i, 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-ocaml.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-ocaml.js index 7a3913e8e2..6b68af363c 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-ocaml.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-ocaml.js @@ -12,18 +12,32 @@ Prism.languages.ocaml = { } ], 'number': /\b(?:0x[\da-f][\da-f_]+|(?:0[bo])?\d[\d_]*\.?[\d_]*(?:e[+-]?[\d_]+)?)/i, - 'type': { - pattern: /\B['`]\w*/, - alias: 'variable' - }, 'directive': { pattern: /\B#\w+/, + alias: 'important' + }, + 'label': { + pattern: /\B~\w+/, + alias: 'function' + }, + 'type_variable': { + pattern: /\B'\w+/, alias: 'function' }, - 'keyword': /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|prefix|private|rec|then|sig|struct|to|try|type|val|value|virtual|where|while|with)\b/, + 'variant': { + pattern: /`\w+/, + alias: 'variable' + }, + 'module': { + pattern: /\b[A-Z]\w+/, + alias: 'variable' + }, + // For the list of keywords and operators, + // see: http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec84 + 'keyword': /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/, 'boolean': /\b(?:false|true)\b/, // Custom operators are allowed - 'operator': /:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lxor|lsl|lsr|mod|nor|or)\b/, + 'operator': /:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/, 'punctuation': /[(){}\[\]|_.,:;]/ }; return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-opencl.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-opencl.js index f31901cc44..311f09212e 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-opencl.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-opencl.js @@ -1,19 +1,20 @@ -define(["prism/prism","prism/components/prism-cpp","prism/components/prism-c","prism/components/prism-cpp"], function () { +define(["prism/prism","prism/components/prism-c"], function () { (function (Prism) { /* OpenCL kernel language */ Prism.languages.opencl = Prism.languages.extend('c', { // Extracted from the official specs (2.0) and http://streamcomputing.eu/downloads/?opencl.lang (opencl-keywords, opencl-types) and http://sourceforge.net/tracker/?func=detail&aid=2957794&group_id=95717&atid=612384 (Words2, partly Words3) + // https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/scalarDataTypes.html + // https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/otherDataTypes.html 'keyword': /\b(?:__attribute__|(?:__)?(?:constant|global|kernel|local|private|read_only|read_write|write_only)|_cl_(?:command_queue|context|device_id|event|kernel|mem|platform_id|program|sampler)|auto|break|case|cl_(?:image_format|mem_fence_flags)|clk_event_t|complex|const|continue|default|do|(?:float|double)(?:16(?:x(?:1|16|2|4|8))?|1x(?:1|16|2|4|8)|2(?:x(?:1|16|2|4|8))?|3|4(?:x(?:1|16|2|4|8))?|8(?:x(?:1|16|2|4|8))?)?|else|enum|event_t|extern|for|goto|(?:u?(?:char|short|int|long)|half|quad|bool)(?:2|3|4|8|16)?|if|image(?:1d_(?:array_|buffer_)?t|2d_(?:array_(?:depth_|msaa_depth_|msaa_)?|depth_|msaa_depth_|msaa_)?t|3d_t)|imaginary|inline|intptr_t|ndrange_t|packed|pipe|ptrdiff_t|queue_t|register|reserve_id_t|restrict|return|sampler_t|signed|size_t|sizeof|static|struct|switch|typedef|uintptr_t|uniform|union|unsigned|void|volatile|while)\b/, - // Extracted from http://streamcomputing.eu/downloads/?opencl.lang (global-vars, opencl-dev) - 'function-opencl-kernel': { - pattern: /\b(?:abs(?:_diff)?|a?(?:cos|sin)(?:h|pi)?|add_sat|aligned|all|and|any|async(?:_work_group_copy|_work_group_strided_copy)?|atan(?:2?(?:pi)?|h)?|atom_(?:add|and|cmpxchg|dec|inc|max|min|or|sub|xchg|xor)|barrier|bitselect|cbrt|ceil|clamp|clz|copies|copysign|cross|degrees|distance|dot|endian|erf|erfc|exp(?:2|10)?|expm1|fabs|fast_(?:distance|length|normalize)|fdim|floor|fma|fmax|fmin|fract|frexp|fro|from|get_(?:global_(?:id|offset|size)|group_id|image_(?:channel_data_type|channel_order|depth|dim|height|width)|local(?:_id|_size)|num_groups|work_dim)|hadd|(?:half|native)_(?:cos|divide|exp(?:2|10)?|log(?:2|10)?|powr|recip|r?sqrt|sin|tan)|hypot|ilogb|is(?:equal|finite|greater(?:equal)?|inf|less(?:equal|greater)?|nan|normal|notequal|(?:un)?ordered)|ldexp|length|lgamma|lgamma_r|log(?:b|1p|2|10)?|mad(?:24|_hi|_sat)?|max|mem(?:_fence)?|min|mix|modf|mul24|mul_hi|nan|nextafter|normalize|pow[nr]?|prefetch|radians|read_(?:image)(?:f|h|u?i)|read_mem_fence|remainder|remquo|reqd_work_group_size|rhadd|rint|rootn|rotate|round|rsqrt|select|shuffle2?|sign|signbit|sincos|smoothstep|sqrt|step|sub_sat|tan|tanh|tanpi|tgamma|to|trunc|upsample|vec_(?:step|type_hint)|v(?:load|store)(?:_half)?(?:2|3|4|8|16)?|v(?:loada_half|storea?(?:_half)?)(?:2|3|4|8|16)?(?:_(?:rte|rtn|rtp|rtz))?|wait_group_events|work_group_size_hint|write_image(?:f|h|u?i)|write_mem_fence)\b/, - alias: 'function' - }, // Extracted from http://streamcomputing.eu/downloads/?opencl.lang (opencl-const) + // Math Constants: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/mathConstants.html + // Macros and Limits: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/macroLimits.html 'constant-opencl-kernel': { - pattern: /\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:LOCAL|GLOBAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT)_(?:DIG|EPSILON|MANT_DIG|(?:MIN|MAX)(?:(?:_10)?_EXP)?)|FLT_RADIX|HUGE_VALF|INFINITY|(?:INT|LONG|SCHAR|SHRT|UCHAR|UINT|ULONG)_(?:MAX|MIN)|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN(?:2|10)|LOG(?:10|2)E?|PI[24]?|SQRT(?:1_2|2))|NAN)\b/, + pattern: /\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:LOCAL|GLOBAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT|HALF)_(?:DIG|EPSILON|MANT_DIG|(?:MIN|MAX)(?:(?:_10)?_EXP)?)|FLT_RADIX|HUGE_VALF?|INFINITY|(?:INT|LONG|SCHAR|SHRT)_(?:MAX|MIN)|(?:UCHAR|USHRT|UINT|ULONG)_MAX|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN(?:2|10)|LOG(?:10|2)E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN)\b/, alias: 'constant' - } + }, + 'boolean': /\b(?:false|true)\b/, + 'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]*/i }); var attributes = { @@ -40,13 +41,17 @@ define(["prism/prism","prism/components/prism-cpp","prism/components/prism-c","p /* OpenCL host API */ Prism.languages.insertBefore('c', 'keyword', attributes); - // Extracted from doxygen class list http://github.khronos.org/OpenCL-CLHPP/annotated.html - attributes['type-opencl-host-c++'] = { - pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image|Image1D|Image1DArray|Image1DBuffer|Image2D|Image2DArray|Image2DGL|Image3D|Image3DGL|ImageFormat|ImageGL|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|Sampler|SVMAllocator|SVMTraitAtomic|SVMTraitCoarse|SVMTraitFine|SVMTraitReadOnly|SVMTraitReadWrite|SVMTraitWriteOnly|UserEvent)\b/, - alias: 'keyword' - }; + // C++ includes everything from the OpenCL C host API plus the classes defined in cl2.h - Prism.languages.insertBefore('cpp', 'keyword', attributes); + if (Prism.languages.cpp) { + // Extracted from doxygen class list http://github.khronos.org/OpenCL-CLHPP/annotated.html + attributes['type-opencl-host-cpp'] = { + pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image|Image1D|Image1DArray|Image1DBuffer|Image2D|Image2DArray|Image2DGL|Image3D|Image3DGL|ImageFormat|ImageGL|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|Sampler|SVMAllocator|SVMTraitAtomic|SVMTraitCoarse|SVMTraitFine|SVMTraitReadOnly|SVMTraitReadWrite|SVMTraitWriteOnly|UserEvent)\b/, + alias: 'keyword' + }; + + Prism.languages.insertBefore('cpp', 'keyword', attributes); + } }(Prism)); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-pascaligo.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pascaligo.js new file mode 100644 index 0000000000..3431b6f1e1 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pascaligo.js @@ -0,0 +1,65 @@ +define(["prism/prism"], function () { +(function (Prism) { + + // Pascaligo is a layer 2 smart contract language for the tezos blockchain + + var braces = /\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\)/.source; + var type = /(?:\w+(?:)?|)/.source.replace(//g, function () { return braces; }); + + var pascaligo = Prism.languages.pascaligo = { + 'comment': /\(\*[\s\S]+?\*\)|\/\/.*/, + 'string': { + pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1|\^[a-z]/i, + greedy: true + }, + 'class-name': [ + { + pattern: RegExp(/(\btype\s+\w+\s+is\s+)/.source.replace(//g, function () { return type; }), 'i'), + lookbehind: true, + inside: null // see below + }, + { + pattern: RegExp(/(?=\s+is\b)/.source.replace(//g, function () { return type; }), 'i'), + inside: null // see below + }, + { + pattern: RegExp(/(:\s*)/.source.replace(//g, function () { return type; })), + lookbehind: true, + inside: null // see below + } + ], + 'keyword': { + pattern: /(^|[^&])\b(?:begin|block|case|const|else|end|fail|for|from|function|if|is|nil|of|remove|return|skip|then|type|var|while|with)\b/i, + lookbehind: true + }, + 'boolean': { + pattern: /(^|[^&])\b(?:True|False)\b/i, + lookbehind: true + }, + 'builtin': { + pattern: /(^|[^&])\b(?:bool|int|list|map|nat|record|string|unit)\b/i, + lookbehind: true + }, + 'function': /\w+(?=\s*\()/i, + 'number': [ + // Hexadecimal, octal and binary + /%[01]+|&[0-7]+|\$[a-f\d]+/i, + // Decimal + /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?(?:mtz|n)?/i + ], + 'operator': /->|=\/=|\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=|]|\b(?:and|mod|or)\b/, + 'punctuation': /\(\.|\.\)|[()\[\]:;,.{}]/ + }; + + var classNameInside = ['comment', 'keyword', 'builtin', 'operator', 'punctuation'].reduce(function (accum, key) { + accum[key] = pascaligo[key]; + return accum; + }, {}); + + pascaligo["class-name"].forEach(function (p) { + p.inside = classNameInside; + }); + +}(Prism)); + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-pcaxis.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pcaxis.js new file mode 100644 index 0000000000..bf79a1e184 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pcaxis.js @@ -0,0 +1,56 @@ +define(["prism/prism"], function () { +Prism.languages.pcaxis = { + 'string': /"[^"]*"/, + 'keyword': { + pattern: /((?:^|;)\s*)[-A-Z\d]+(?:\s*\[[-\w]+\])?(?:\s*\("[^"]*"(?:,\s*"[^"]*")*\))?(?=\s*=)/, + lookbehind: true, + greedy: true, + inside: { + 'keyword': /^[-A-Z\d]+/, + 'language': { + pattern: /^(\s*)\[[-\w]+\]/, + lookbehind: true, + inside: { + 'punctuation': /^\[|\]$/, + 'property': /[-\w]+/ + } + }, + 'sub-key': { + pattern: /^(\s*)[\s\S]+/, + lookbehind: true, + inside: { + 'parameter': { + pattern: /"[^"]*"/, + alias: 'property' + }, + 'punctuation': /^\(|\)$|,/ + } + } + } + }, + 'operator': /=/, + 'tlist': { + pattern: /TLIST\s*\(\s*\w+(?:(?:\s*,\s*"[^"]*")+|\s*,\s*"[^"]*"-"[^"]*")?\s*\)/, + greedy: true, + inside: { + 'function': /^TLIST/, + 'property': { + pattern: /^(\s*\(\s*)\w+/, + lookbehind: true + }, + 'string': /"[^"]*"/, + 'punctuation': /[(),]/, + 'operator': /-/ + } + }, + 'punctuation': /[;,]/, + 'number': { + pattern: /(^|\s)\d+(?:\.\d+)?(?!\S)/, + lookbehind: true + }, + 'boolean': /YES|NO/, +}; + +Prism.languages.px = Prism.languages.pcaxis; + +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-perl.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-perl.js index 30c8e8d914..afa8d51893 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-perl.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-perl.js @@ -18,31 +18,31 @@ Prism.languages.perl = { pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/, greedy: true }, - + // q a...a { pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1/, greedy: true }, - + // q(...) { pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/, greedy: true }, - + // q{...} { pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/, greedy: true }, - + // q[...] { pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/, greedy: true }, - + // q<...> { pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/, @@ -68,31 +68,31 @@ Prism.languages.perl = { pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, greedy: true }, - + // m a...a { pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:(?!\1)[^\\]|\\[\s\S])*\1[msixpodualngc]*/, greedy: true }, - + // m(...) { pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/, greedy: true }, - + // m{...} { pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/, greedy: true }, - + // m[...] { pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/, greedy: true }, - + // m<...> { pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/, @@ -107,48 +107,48 @@ Prism.languages.perl = { lookbehind: true, greedy: true }, - + // s a...a...a { pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2[msixpodualngcer]*/, lookbehind: true, greedy: true }, - + // s(...)(...) { pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/, lookbehind: true, greedy: true }, - + // s{...}{...} { pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/, lookbehind: true, greedy: true }, - + // s[...][...] { pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/, lookbehind: true, greedy: true }, - + // s<...><...> { pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/, lookbehind: true, greedy: true }, - + // /.../ // The look-ahead tries to prevent two divisions on // the same line from being highlighted as regex. // This does not support multi-line regex. { - pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/, + pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/, greedy: true } ], diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-php.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-php.js index 2f5a9f5482..5e8c995570 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-php.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-php.js @@ -65,9 +65,7 @@ define(["prism/prism","prism/components/prism-clike","prism/components/prism-mar var string_interpolation = { pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/, lookbehind: true, - inside: { - rest: Prism.languages.php - } + inside: Prism.languages.php }; Prism.languages.insertBefore('php', 'string', { @@ -122,7 +120,7 @@ define(["prism/prism","prism/components/prism-clike","prism/components/prism-mar return; } - var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/ig; + var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/ig; Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern); }); diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-phpdoc.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-phpdoc.js index db908791b6..056a39f7a8 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-phpdoc.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-phpdoc.js @@ -1,7 +1,7 @@ define(["prism/prism","prism/components/prism-php","prism/components/prism-javadoclike"], function () { (function (Prism) { - var typeExpression = /(?:[a-zA-Z]\w*|[|\\[\]])+/.source; + var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source; Prism.languages.phpdoc = Prism.languages.extend('javadoclike', { 'parameter': { diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-powerquery.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-powerquery.js new file mode 100644 index 0000000000..c894c24881 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-powerquery.js @@ -0,0 +1,57 @@ +define(["prism/prism"], function () { +// https://docs.microsoft.com/en-us/powerquery-m/power-query-m-language-specification + +Prism.languages.powerquery = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:\/\/).*)/, + lookbehind: true + }, + 'quoted-identifier': { + pattern: /#"(?:[^"\r\n]|"")*"(?!")/, + greedy: true, + alias: 'variable' + }, + 'string': { + pattern: /"(?:[^"\r\n]|"")*"(?!")/, + greedy: true + }, + 'constant': [ + /\bDay\.(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)\b/, + /\bTraceLevel\.(?:Critical|Error|Information|Verbose|Warning)\b/, + /\bOccurrence\.(?:First|Last|All)\b/, + /\bOrder\.(?:Ascending|Descending)\b/, + /\bRoundingMode\.(?:AwayFromZero|Down|ToEven|TowardZero|Up)\b/, + /\bMissingField\.(?:Error|Ignore|UseNull)\b/, + /\bQuoteStyle\.(?:Csv|None)\b/, + /\bJoinKind\.(?:Inner|LeftOuter|RightOuter|FullOuter|LeftAnti|RightAnti)\b/, + /\bGroupKind\.(?:Global|Local)\b/, + /\bExtraValues\.(?:List|Ignore|Error)\b/, + /\bJoinAlgorithm\.(?:Dynamic|PairwiseHash|SortMerge|LeftHash|RightHash|LeftIndex|RightIndex)\b/, + /\bJoinSide\.(?:Left|Right)\b/, + /\bPrecision\.(?:Double|Decimal)\b/, + /\bRelativePosition\.From(?:End|Start)\b/, + /\bTextEncoding\.(?:Ascii|BigEndianUnicode|Unicode|Utf8|Utf16|Windows)\b/, + /\b(?:Any|Binary|Date|DateTime|DateTimeZone|Duration|Int8|Int16|Int32|Int64|Function|List|Logical|None|Number|Record|Table|Text|Time)\.Type\b/, + /\bnull\b/ + ], + 'boolean': /\b(?:true|false)\b/, + 'keyword': /\b(?:and|as|each|else|error|if|in|is|let|meta|not|nullable|optional|or|otherwise|section|shared|then|try|type)\b|#(?:binary|date|datetime|datetimezone|duration|infinity|nan|sections|shared|table|time)\b/, + 'function': { + pattern: /(^|[^#\w.])(?!\d)[\w.]+(?=\s*\()/, + lookbehind: true + }, + 'data-type': { + pattern: /\b(?:any|anynonnull|binary|date|datetime|datetimezone|duration|function|list|logical|none|number|record|table|text|time|type)\b/, + alias: 'variable' + }, + 'number': { + pattern: /\b0x[\da-f]+\b|(?:[+-]?(?:\b\d+\.)?\b\d+|[+-]\.\d+|(^|[^.])\B\.\d+)(?:e[+-]?\d+)?\b/i, + lookbehind: true + }, + 'operator': /[-+*\/&?@^]|<(?:=>?|>)?|>=?|=>?|\.\.\.?/, + 'punctuation': /[,;\[\](){}]/ +}; + +Prism.languages.pq = Prism.languages['powerquery']; +Prism.languages.mscript = Prism.languages['powerquery'] +return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-powershell.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-powershell.js index 386e109756..3de38ffa7a 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-powershell.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-powershell.js @@ -46,7 +46,7 @@ define(["prism/prism"], function () { // per http://technet.microsoft.com/en-us/library/hh847744.aspx 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i, 'operator': { - pattern: /(\W?)(?:!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(?:and|x?or)|(?:Not)?(?:Like|Match|Contains|In)|Replace|Join|is(?:Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i, + pattern: /(\W?)(?:!|-(?:eq|ne|gt|ge|lt|le|sh[lr]|not|b?(?:and|x?or)|(?:Not)?(?:Like|Match|Contains|In)|Replace|Join|is(?:Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i, lookbehind: true }, 'punctuation': /[|{}[\];(),.]/ diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-protobuf.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-protobuf.js index df410431d8..6538d36325 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-protobuf.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-protobuf.js @@ -1,11 +1,39 @@ define(["prism/prism","prism/components/prism-clike"], function () { -Prism.languages.protobuf = Prism.languages.extend('clike', { - keyword: /\b(?:package|import|message|enum)\b/, - builtin: /\b(?:required|repeated|optional|reserved)\b/, - primitive: { - pattern: /\b(?:double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/, - alias: 'symbol' - } -}); +(function (Prism) { + + var builtinTypes = /\b(?:double|float|[su]?int(?:32|64)|s?fixed(?:32|64)|bool|string|bytes)\b/; + + Prism.languages.protobuf = Prism.languages.extend('clike', { + 'class-name': { + pattern: /(\b(?:enum|extend|message|service)\s+)[A-Za-z_]\w*(?=\s*\{)/, + lookbehind: true + }, + 'keyword': /\b(?:enum|extend|extensions|import|message|oneof|option|optional|package|public|repeated|required|reserved|service|syntax|to)\b/ + }); + + Prism.languages.insertBefore('protobuf', 'operator', { + 'map': { + pattern: /\bmap<\s*[\w.]+\s*,\s*[\w.]+\s*>(?=\s+[A-Za-z_]\w*\s*[=;])/, + alias: 'class-name', + inside: { + 'punctuation': /[<>.,]/, + 'builtin': builtinTypes + } + }, + 'builtin': builtinTypes, + 'positional-class-name': { + pattern: /(?:\b|\B\.)[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?=\s+[A-Za-z_]\w*\s*[=;])/, + alias: 'class-name', + inside: { + 'punctuation': /\./ + } + }, + 'annotation': { + pattern: /(\[\s*)[A-Za-z_]\w*(?=\s*=)/, + lookbehind: true + } + }); + +}(Prism)); return Prism; }) \ No newline at end of file diff --git a/wcfsetup/install/files/js/3rdParty/prism/components/prism-pug.js b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pug.js index 83af1893fe..db728fdfe0 100644 --- a/wcfsetup/install/files/js/3rdParty/prism/components/prism-pug.js +++ b/wcfsetup/install/files/js/3rdParty/prism/components/prism-pug.js @@ -1,4 +1,4 @@ -define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript","prism/components/prism-coffeescript","prism/components/prism-ejs","prism/components/prism-handlebars","prism/components/prism-less","prism/components/prism-livescript","prism/components/prism-markdown","prism/components/prism-scss","prism/components/prism-stylus","prism/components/prism-twig"], function () { +define(["prism/prism","prism/components/prism-markup","prism/components/prism-javascript"], function () { (function(Prism) { // TODO: // - Add CSS highlighting inside