prism-unrealscript.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Prism.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': /\b\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. '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/,
  32. 'function': /\b[a-z_]\w*(?=\s*\()/i,
  33. 'boolean': /\b(?:false|true)\b/,
  34. 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  35. // https://docs.unrealengine.com/udk/Three/UnrealScriptExpressions.html
  36. 'operator': />>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,
  37. 'punctuation': /[()[\]{};,.]/
  38. };
  39. Prism.languages.uc = Prism.languages.uscript = Prism.languages.unrealscript;