prism-keyman.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Prism.languages.keyman = {
  2. 'comment': {
  3. pattern: /\bc .*/i,
  4. greedy: true
  5. },
  6. 'string': {
  7. pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
  8. greedy: true
  9. },
  10. 'virtual-key': {
  11. pattern: /\[\s*(?:(?:ALT|CAPS|CTRL|LALT|LCTRL|NCAPS|RALT|RCTRL|SHIFT)\s+)*(?:[TKU]_[\w?]+|[A-E]\d\d?|"[^"\r\n]*"|'[^'\r\n]*')\s*\]/i,
  12. greedy: true,
  13. alias: 'function' // alias for styles
  14. },
  15. // https://help.keyman.com/developer/language/guide/headers
  16. 'header-keyword': {
  17. pattern: /&\w+/,
  18. alias: 'bold' // alias for styles
  19. },
  20. 'header-statement': {
  21. pattern: /\b(?:bitmap|bitmaps|caps always off|caps on only|copyright|hotkey|language|layout|message|name|shift frees caps|version)\b/i,
  22. alias: 'bold' // alias for styles
  23. },
  24. 'rule-keyword': {
  25. pattern: /\b(?:any|baselayout|beep|call|context|deadkey|dk|if|index|layer|notany|nul|outs|platform|reset|return|save|set|store|use)\b/i,
  26. alias: 'keyword'
  27. },
  28. 'structural-keyword': {
  29. pattern: /\b(?:ansi|begin|group|match|newcontext|nomatch|postkeystroke|readonly|unicode|using keys)\b/i,
  30. alias: 'keyword'
  31. },
  32. 'compile-target': {
  33. pattern: /\$(?:keyman|keymanonly|keymanweb|kmfl|weaver):/i,
  34. alias: 'property'
  35. },
  36. // U+####, x###, d### characters and numbers
  37. 'number': /\b(?:U\+[\dA-F]+|d\d+|x[\da-f]+|\d+)\b/i,
  38. 'operator': /[+>\\$]|\.\./,
  39. 'punctuation': /[()=,]/
  40. };