prism-phpdoc.js 824 B

123456789101112131415161718192021222324252627
  1. (function (Prism) {
  2. var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source;
  3. Prism.languages.phpdoc = Prism.languages.extend('javadoclike', {
  4. 'parameter': {
  5. pattern: RegExp('(@(?:global|param|property(?:-read|-write)?|var)\\s+(?:' + typeExpression + '\\s+)?)\\$\\w+'),
  6. lookbehind: true
  7. }
  8. });
  9. Prism.languages.insertBefore('phpdoc', 'keyword', {
  10. 'class-name': [
  11. {
  12. pattern: RegExp('(@(?:global|package|param|property(?:-read|-write)?|return|subpackage|throws|var)\\s+)' + typeExpression),
  13. lookbehind: true,
  14. inside: {
  15. 'keyword': /\b(?:array|bool|boolean|callback|double|false|float|int|integer|mixed|null|object|resource|self|string|true|void)\b/,
  16. 'punctuation': /[|\\[\]()]/
  17. }
  18. }
  19. ],
  20. });
  21. Prism.languages.javadoclike.addSupport('php', Prism.languages.phpdoc);
  22. }(Prism));