diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/prismjs/components/prism-puppet.js | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/prismjs/components/prism-puppet.js')
| -rw-r--r-- | node_modules/prismjs/components/prism-puppet.js | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/node_modules/prismjs/components/prism-puppet.js b/node_modules/prismjs/components/prism-puppet.js new file mode 100644 index 00000000..246129c2 --- /dev/null +++ b/node_modules/prismjs/components/prism-puppet.js @@ -0,0 +1,136 @@ +(function (Prism) { + Prism.languages.puppet = { + 'heredoc': [ + // Matches the content of a quoted heredoc string (subject to interpolation) + { + pattern: /(@\("([^"\r\n\/):]+)"(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r))*?[ \t]*\|?[ \t]*-?[ \t]*\2/, + lookbehind: true, + alias: 'string', + inside: { + // Matches the end tag + 'punctuation': /(?=\S).*\S(?= *$)/ + // See interpolation below + } + }, + // Matches the content of an unquoted heredoc string (no interpolation) + { + pattern: /(@\(([^"\r\n\/):]+)(?:\/[nrts$uL]*)?\).*(?:\r?\n|\r))(?:.*(?:\r?\n|\r))*?[ \t]*\|?[ \t]*-?[ \t]*\2/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: { + // Matches the end tag + 'punctuation': /(?=\S).*\S(?= *$)/ + } + }, + // Matches the start tag of heredoc strings + { + pattern: /@\("?(?:[^"\r\n\/):]+)"?(?:\/[nrts$uL]*)?\)/, + alias: 'string', + inside: { + 'punctuation': { + pattern: /(\().+?(?=\))/, + lookbehind: true + } + } + } + ], + 'multiline-comment': { + pattern: /(^|[^\\])\/\*[\s\S]*?\*\//, + lookbehind: true, + greedy: true, + alias: 'comment' + }, + 'regex': { + // Must be prefixed with the keyword "node" or a non-word char + pattern: /((?:\bnode\s+|[~=\(\[\{,]\s*|[=+]>\s*|^\s*))\/(?:[^\/\\]|\\[\s\S])+\/(?:[imx]+\b|\B)/, + lookbehind: true, + greedy: true, + inside: { + // Extended regexes must have the x flag. They can contain single-line comments. + 'extended-regex': { + pattern: /^\/(?:[^\/\\]|\\[\s\S])+\/[im]*x[im]*$/, + inside: { + 'comment': /#.*/ + } + } + } + }, + 'comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true, + greedy: true, + }, + 'string': { + // Allow for one nested level of double quotes inside interpolation + pattern: /(["'])(?:\$\{(?:[^'"}]|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}|(?!\1)[^\\]|\\[\s\S])*\1/, + greedy: true, + inside: { + 'double-quoted': { + pattern: /^"[\s\S]*"$/, + inside: { + // See interpolation below + } + } + } + }, + 'variable': { + pattern: /\$(?:::)?\w+(?:::\w+)*/, + inside: { + 'punctuation': /::/ + } + }, + 'attr-name': /(?:\w+|\*)(?=\s*=>)/, + 'function': [ + { + pattern: /(\.)(?!\d)\w+/, + lookbehind: true + }, + /\b(?:contain|debug|err|fail|include|info|notice|realize|require|tag|warning)\b|\b(?!\d)\w+(?=\()/ + ], + 'number': /\b(?:0x[a-f\d]+|\d+(?:\.\d+)?(?:e-?\d+)?)\b/i, + 'boolean': /\b(?:true|false)\b/, + // Includes words reserved for future use + 'keyword': /\b(?:application|attr|case|class|consumes|default|define|else|elsif|function|if|import|inherits|node|private|produces|type|undef|unless)\b/, + 'datatype': { + pattern: /\b(?:Any|Array|Boolean|Callable|Catalogentry|Class|Collection|Data|Default|Enum|Float|Hash|Integer|NotUndef|Numeric|Optional|Pattern|Regexp|Resource|Runtime|Scalar|String|Struct|Tuple|Type|Undef|Variant)\b/, + alias: 'symbol' + }, + 'operator': /=[=~>]?|![=~]?|<(?:<\|?|[=~|-])?|>[>=]?|->?|~>|\|>?>?|[*\/%+?]|\b(?:and|in|or)\b/, + 'punctuation': /[\[\]{}().,;]|:+/ + }; + + var interpolation = [ + { + // Allow for one nested level of braces inside interpolation + pattern: /(^|[^\\])\$\{(?:[^'"{}]|\{[^}]*\}|(["'])(?:(?!\2)[^\\]|\\[\s\S])*\2)+\}/, + lookbehind: true, + inside: { + 'short-variable': { + // Negative look-ahead prevent wrong highlighting of functions + pattern: /(^\$\{)(?!\w+\()(?:::)?\w+(?:::\w+)*/, + lookbehind: true, + alias: 'variable', + inside: { + 'punctuation': /::/ + } + }, + 'delimiter': { + pattern: /^\$/, + alias: 'variable' + }, + rest: Prism.languages.puppet + } + }, + { + pattern: /(^|[^\\])\$(?:::)?\w+(?:::\w+)*/, + lookbehind: true, + alias: 'variable', + inside: { + 'punctuation': /::/ + } + } + ]; + Prism.languages.puppet['heredoc'][0].inside.interpolation = interpolation; + Prism.languages.puppet['string'].inside['double-quoted'].inside.interpolation = interpolation; +}(Prism));
\ No newline at end of file |
