-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathphpdoc.js
41 lines (40 loc) · 1.28 KB
/
phpdoc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// @ts-nocheck
import refractorJavadoclike from './javadoclike.js'
import refractorPhp from './php.js'
phpdoc.displayName = 'phpdoc'
phpdoc.aliases = []
/** @type {import('../core.js').Syntax} */
export default function phpdoc(Prism) {
Prism.register(refractorJavadoclike)
Prism.register(refractorPhp)
;(function (Prism) {
var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source
Prism.languages.phpdoc = Prism.languages.extend('javadoclike', {
parameter: {
pattern: RegExp(
'(@(?:global|param|property(?:-read|-write)?|var)\\s+(?:' +
typeExpression +
'\\s+)?)\\$\\w+'
),
lookbehind: true
}
})
Prism.languages.insertBefore('phpdoc', 'keyword', {
'class-name': [
{
pattern: RegExp(
'(@(?:global|package|param|property(?:-read|-write)?|return|subpackage|throws|var)\\s+)' +
typeExpression
),
lookbehind: true,
inside: {
keyword:
/\b(?:array|bool|boolean|callback|double|false|float|int|integer|mixed|null|object|resource|self|string|true|void)\b/,
punctuation: /[|\\[\]()]/
}
}
]
})
Prism.languages.javadoclike.addSupport('php', Prism.languages.phpdoc)
})(Prism)
}