]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/php.min.js
1 /*! `php` grammar compiled for Highlight.js 11.11.1 */
2 (()=>{var e
=(()=>{"use strict";return e
=>{
3 const t
=e
.regex
,a
=/(?![A-Za-z0-9])(?![$])/,r
=t
.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a
),n
=t
.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a
),o
=t
.concat(/[A-Z]+/,a
),c
={
4 scope:"variable",match:"\\$+"+r
},i
={scope:"subst",variants:[{begin:/\$\w+/},{
5 begin:/\{\$/,end:/\}/}]},s
=e
.inherit(e
.APOS_STRING_MODE
,{illegal:null
6 }),l
="[ \t\n]",d
={scope:"string",variants:[e
.inherit(e
.QUOTE_STRING_MODE
,{
7 illegal:null,contains:e
.QUOTE_STRING_MODE
.contains
.concat(i
)}),s
,{
8 begin:/<<<[ \t]*(?:(\w
+)|"(\w+)")\n/,end:/[ \t]*(\w
+)\b/,
9 contains:e
.QUOTE_STRING_MODE
.contains
.concat(i
),"on:begin":(e
,t
)=>{
10 t
.data
._beginMatch
=e
[1]||e
[2]},"on:end":(e
,t
)=>{
11 t
.data
._beginMatch
!==e
[1]&&t
.ignoreMatch()}},e
.END_SAME_AS_BEGIN({
12 begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w
+)\b/})]},_
={scope:"number",variants:[{
13 begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{
14 begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{
15 begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"
17 },p
=["false","null","true"],b
=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E
=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],u
={
18 keyword:b
,literal:(e
=>{const t
=[];return e
.forEach((e
=>{
19 t
.push(e
),e
.toLowerCase()===e
?t
.push(e
.toUpperCase()):t
.push(e
.toLowerCase())
20 })),t
})(p
),built_in:E
},g
=e
=>e
.map((e
=>e
.replace(/\|\d+$/,""))),h
={variants:[{
21 match:[/new/,t
.concat(l
,"+"),t
.concat("(?!",g(E
).join("\\b|"),"\\b)"),n
],scope:{
22 1:"keyword",4:"title.class"}}]},m
=t
.concat(r
,"\\b(?!\\()"),I
={variants:[{
23 match:[t
.concat(/::/,t
.lookahead(/(?!class\b)/)),m
],scope:{2:"variable.constant"
24 }},{match:[/::/,/class/],scope:{2:"variable.language"}},{
25 match:[n
,t
.concat(/::/,t
.lookahead(/(?!class\b)/)),m
],scope:{1:"title.class",
26 3:"variable.constant"}},{match:[n
,t
.concat("::",t
.lookahead(/(?!class\b)/))],
27 scope:{1:"title.class"}},{match:[n
,/::/,/class/],scope:{1:"title.class",
28 3:"variable.language"}}]},f
={scope:"attr",
29 match:t
.concat(r
,t
.lookahead(":"),t
.lookahead(/(?!::)/))},v
={relevance:0,
30 begin:/\(/,end:/\)/,keywords:u
,contains:[f
,c
,I
,e
.C_BLOCK_COMMENT_MODE
,d
,_
,h
]
32 match:[/\b/,t
.concat("(?!fn\\b|function\\b|",g(b
).join("\\b|"),"|",g(E
).join("\\b|"),"\\b)"),r
,t
.concat(l
,"*"),t
.lookahead(/(?=\()/)],
33 scope:{3:"title.function.invoke"},contains:[v
]};v
.contains
.push(O
)
34 ;const y
=[f
,I
,e
.C_BLOCK_COMMENT_MODE
,d
,_
,h
],w
={
35 begin:t
.concat(/#\[\s*\\?/,t
.either(n
,o
)),beginScope:"meta",end:/]/,
36 endScope:"meta",keywords:{literal:p
,keyword:["new","array"]},contains:[{
37 begin:/\[/,end:/]/,keywords:{literal:p
,keyword:["new","array"]},
38 contains:["self",...y
]},...y
,{scope:"meta",variants:[{match:n
},{match:o
}]}]}
39 ;return{case_insensitive:!1,keywords:u
,
40 contains:[w
,e
.HASH_COMMENT_MODE
,e
.COMMENT("//","$"),e
.COMMENT("/\\*","\\*/",{
41 contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,
42 keywords:"__halt_compiler",starts:{scope:"comment",end:e
.MATCH_NOTHING_RE
,
43 contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{
44 begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{
45 begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},c
,O
,I
,{
46 match:[/const/,/\s/,r
],scope:{1:"keyword",3:"variable.constant"}},h
,{
47 scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,
48 excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"
49 },e
.UNDERSCORE_TITLE_MODE
,{begin:"=>",endsParent:!0},{scope:"params",
50 begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:u
,
51 contains:["self",w
,c
,I
,e
.C_BLOCK_COMMENT_MODE
,d
,_
]}]},{scope:"class",variants:[{
52 beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",
53 illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{
54 beginKeywords:"extends implements"},e
.UNDERSCORE_TITLE_MODE
]},{
55 beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,
56 contains:[e
.inherit(e
.UNDERSCORE_TITLE_MODE
,{scope:"title.class"})]},{
57 beginKeywords:"use",relevance:0,end:";",contains:[{
58 match:/\b(as|const|function)\b/,scope:"keyword"},e
.UNDERSCORE_TITLE_MODE
]},d
,_
]}
59 }})();hljs
.registerLanguage("php",e
)})();