MediaWiki:Gadget-prism-language-perl.js

来自萌娘共享
跳转至: 导航搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
  1. /**
  2. * -------------------------------------------------------------------------
  3. * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
  4. * -------------------------------------------------------------------------
  5. */
  6. var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/prism-language-perl/Gadget-prism-language-perl.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=103d1a563ea4ccc8ff29fb55c9bcd88329a56eb5|shortId=103d1a56|summary=feat: rename (#594)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}';
  7. /* <pre> */
  8. "use strict";
  9. (function (Prism) {
  10. var brackets = /(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;
  11. Prism.languages.perl = {
  12. 'comment': [
  13. {
  14. pattern: /(^\s*)=\w[\s\S]*?=cut.*/m,
  15. lookbehind: true,
  16. greedy: true
  17. },
  18. {
  19. pattern: /(^|[^\\$])#.*/,
  20. lookbehind: true,
  21. greedy: true
  22. }
  23. ],
  24. 'string': [
  25. {
  26. pattern: RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source +
  27. '(?:' +
  28. [
  29. /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
  30. /([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
  31. brackets,
  32. ].join('|') +
  33. ')'),
  34. greedy: true
  35. },
  36. {
  37. pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,
  38. greedy: true
  39. },
  40. {
  41. pattern: /'(?:[^'\\\r\n]|\\.)*'/,
  42. greedy: true
  43. }
  44. ],
  45. 'regex': [
  46. {
  47. pattern: RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source +
  48. '(?:' +
  49. [
  50. /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
  51. /([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
  52. brackets,
  53. ].join('|') +
  54. ')' +
  55. /[msixpodualngc]*/.source),
  56. greedy: true
  57. },
  58. {
  59. pattern: RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source +
  60. '(?:' +
  61. [
  62. /([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
  63. /([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,
  64. brackets + /\s*/.source + brackets,
  65. ].join('|') +
  66. ')' +
  67. /[msixpodualngcer]*/.source),
  68. lookbehind: true,
  69. greedy: true
  70. },
  71. {
  72. pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,
  73. greedy: true
  74. }
  75. ],
  76. 'variable': [
  77. /[&*$@%]\{\^[A-Z]+\}/,
  78. /[&*$@%]\^[A-Z_]/,
  79. /[&*$@%]#?(?=\{)/,
  80. /[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,
  81. /[&*$@%]\d+/,
  82. /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
  83. ],
  84. 'filehandle': {
  85. pattern: /<(?![<=])\S*?>|\b_\b/,
  86. alias: 'symbol'
  87. },
  88. 'v-string': {
  89. pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
  90. alias: 'string'
  91. },
  92. 'function': {
  93. pattern: /(\bsub[ \t]+)\w+/,
  94. lookbehind: true
  95. },
  96. 'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
  97. 'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
  98. 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,
  99. 'punctuation': /[{}[\];(),:]/
  100. };
  101. }(Prism));
  102. /* </pre> */