1
2
3
4
|
Prism.languages.glsl = Prism.languages.extend('c', {
keyword:
/\b(?:active|asm|atomic_uint|attribute|[ibdu]?vec[234]|bool|break|buffer|case|cast|centroid|class|coherent|common|const|continue|d?mat[234](?:x[234])?|default|discard|do|double|else|enum|extern|external|false|filter|fixed|flat|float|for|fvec[234]|goto|half|highp|hvec[234]|[iu]?sampler2DMS(?:Array)?|[iu]?sampler2DRect|[iu]?samplerBuffer|[iu]?samplerCube|[iu]?samplerCubeArray|[iu]?sampler[123]D|[iu]?sampler[12]DArray|[iu]?image2DMS(?:Array)?|[iu]?image2DRect|[iu]?imageBuffer|[iu]?imageCube|[iu]?imageCubeArray|[iu]?image[123]D|[iu]?image[12]DArray|if|in|inline|inout|input|int|interface|invariant|layout|long|lowp|mediump|namespace|noinline|noperspective|out|output|partition|patch|precise|precision|public|readonly|resource|restrict|return|sample|sampler[12]DArrayShadow|sampler[12]DShadow|sampler2DRectShadow|sampler3DRect|samplerCubeArrayShadow|samplerCubeShadow|shared|short|sizeof|smooth|static|struct|subroutine|superp|switch|template|this|true|typedef|uint|uniform|union|unsigned|using|varying|void|volatile|while|writeonly)\b/,
});
dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */// https://wren.io/
Prism.languages.wren = {
// Multiline comments in Wren can have nested multiline comments
// Comments: // and /* */
comment: [
{
// support 3 levels of nesting
// regex: \/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\/
pattern:
/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*))*\*\/)*\*\/)*\*\//,
greedy: true,
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true,
},
],
// Triple quoted strings are multiline but cannot have interpolation (raw strings)
// Based on prism-python.js
'triple-quoted-string': {
pattern: /"""[\s\S]*?"""/,
greedy: true,
alias: 'string',
},
// see below
'string-literal': null,
// #!/usr/bin/env wren on the first line
hashbang: {
pattern: /^#!\/.+/,
greedy: true,
alias: 'comment',
},
// Attributes are special keywords to add meta data to classes
attribute: {
// #! attributes are stored in class properties
// #!myvar = true
// #attributes are not stored and dismissed at compilation
pattern: /#!?[ \t\u3000]*\w+/,
alias: 'keyword',
},
'class-name': [
{
// class definition
// class Meta {}
pattern: /(\bclass\s+)\w+/,
lookbehind: true,
},
// A class must always start with an uppercase.
// File.read
/\b[A-Z][a-z\d_]*\b/,
],
// A constant can be a variable, class, property or method. Just named in all uppercase letters
constant: /\b[A-Z][A-Z\d_]*\b/,
null: {
pattern: /\bnull\b/,
alias: 'keyword',
},
keyword:
/\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/,
boolean: /\b(?:false|true)\b/,
number: /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
// Functions can be Class.method()
function: /\b[a-z_]\w*(?=\s*[({])/i,
operator: /<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/,
punctuation: /[\[\](){}.,;]/,
};
Prism.languages.wren['string-literal'] = {
// A single quote string is multiline and can have interpolation (similar to JS backticks ``)
pattern:
/(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/,
lookbehind: true,
greedy: true,
inside: {
interpolation: {
// "%(interpolation)"
pattern:
/((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/,
lookbehind: true,
inside: {
expression: {
pattern: /^(%\()[\s\S]+(?=\)$)/,
lookbehind: true,
inside: Prism.languages.wren,
},
'interpolation-punctuation': {
pattern: /^%\(|\)$/,
alias: 'punctuation',
},
},
},
string: /[\s\S]+/,
},
};
|