[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = unrealscript
|
---|
| 4 | unrealscript.displayName = 'unrealscript'
|
---|
| 5 | unrealscript.aliases = ['uc', 'uscript']
|
---|
| 6 | function unrealscript(Prism) {
|
---|
| 7 | Prism.languages.unrealscript = {
|
---|
| 8 | comment: /\/\/.*|\/\*[\s\S]*?\*\//,
|
---|
| 9 | string: {
|
---|
| 10 | pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
---|
| 11 | greedy: true
|
---|
| 12 | },
|
---|
| 13 | category: {
|
---|
| 14 | pattern:
|
---|
| 15 | /(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,
|
---|
| 16 | lookbehind: true,
|
---|
| 17 | greedy: true,
|
---|
| 18 | alias: 'property'
|
---|
| 19 | },
|
---|
| 20 | metadata: {
|
---|
| 21 | pattern: /(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,
|
---|
| 22 | lookbehind: true,
|
---|
| 23 | greedy: true,
|
---|
| 24 | inside: {
|
---|
| 25 | property: /\b\w+(?=\s*=)/,
|
---|
| 26 | operator: /=/,
|
---|
| 27 | punctuation: /[<>|]/
|
---|
| 28 | }
|
---|
| 29 | },
|
---|
| 30 | macro: {
|
---|
| 31 | pattern: /`\w+/,
|
---|
| 32 | alias: 'property'
|
---|
| 33 | },
|
---|
| 34 | 'class-name': {
|
---|
| 35 | pattern:
|
---|
| 36 | /(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,
|
---|
| 37 | lookbehind: true
|
---|
| 38 | },
|
---|
| 39 | keyword:
|
---|
| 40 | /\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/,
|
---|
| 41 | function: /\b[a-z_]\w*(?=\s*\()/i,
|
---|
| 42 | boolean: /\b(?:false|true)\b/,
|
---|
| 43 | number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
---|
| 44 | // https://docs.unrealengine.com/udk/Three/UnrealScriptExpressions.html
|
---|
| 45 | operator:
|
---|
| 46 | />>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,
|
---|
| 47 | punctuation: /[()[\]{};,.]/
|
---|
| 48 | }
|
---|
| 49 | Prism.languages.uc = Prism.languages.uscript = Prism.languages.unrealscript
|
---|
| 50 | }
|
---|