UNPKG

2.03 kBJavaScriptView Raw
1Prism.languages.unrealscript = {
2 'comment': /\/\/.*|\/\*[\s\S]*?\*\//,
3 'string': {
4 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
5 greedy: true
6 },
7 'category': {
8 pattern: /(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,
9 lookbehind: true,
10 greedy: true,
11 alias: 'property'
12 },
13 'metadata': {
14 pattern: /(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,
15 lookbehind: true,
16 greedy: true,
17 inside: {
18 'property': /\w+(?=\s*=)/,
19 'operator': /=/,
20 'punctuation': /[<>|]/
21 }
22 },
23 'macro': {
24 pattern: /`\w+/,
25 alias: 'property'
26 },
27 'class-name': {
28 pattern: /(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,
29 lookbehind: true
30 },
31
32 'keyword': /\b(?:abstract|actor|array|auto|autoexpandcategories|bool|break|byte|case|class|classgroup|client|coerce|collapsecategories|config|const|continue|default|defaultproperties|delegate|dependson|deprecated|do|dontcollapsecategories|editconst|editinlinenew|else|enum|event|exec|export|extends|final|float|for|forcescriptorder|foreach|function|goto|guid|hidecategories|hidedropdown|if|ignores|implements|inherits|input|int|interface|iterator|latent|local|material|name|native|nativereplication|noexport|nontransient|noteditinlinenew|notplaceable|operator|optional|out|pawn|perobjectconfig|perobjectlocalized|placeable|postoperator|preoperator|private|protected|reliable|replication|return|server|showcategories|simulated|singular|state|static|string|struct|structdefault|structdefaultproperties|switch|texture|transient|travel|unreliable|until|var|vector|while|within)\b/,
33 'function': /[a-z_]\w*(?=\s*\()/i,
34
35 'boolean': /\b(?:false|true)\b/,
36 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
37 // https://docs.unrealengine.com/udk/Three/UnrealScriptExpressions.html
38 'operator': />>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:Cross|Dot|ClockwiseFrom)\b/,
39 'punctuation': /[()[\]{};,.]/
40};
41
42Prism.languages.uc = Prism.languages.uscript = Prism.languages.unrealscript;