0

Update to 8.0

This commit is contained in:
Rogaboru Kujimoshi
2014-06-08 21:04:39 +04:00
parent 81d0115677
commit a52831ccdb
134 changed files with 10392 additions and 4999 deletions

View File

@@ -4,109 +4,111 @@ Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Ivan Sagalaev <maniac@softwaremaniacs.org>
*/
hljs.LANGUAGES['php'] = function(hljs) {
function(hljs) {
var VARIABLE = {
className: 'variable', begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
className: 'variable', begin: '(\\$|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
};
var STRINGS = [
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
{
className: 'string',
begin: 'b"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'string',
begin: 'b\'', end: '\'',
contains: [hljs.BACKSLASH_ESCAPE]
}
];
var NUMBERS = [
hljs.C_NUMBER_MODE, // 0x..., 0..., decimal, float
hljs.BINARY_NUMBER_MODE // 0b...
];
var TITLE = {
className: 'title', begin: hljs.UNDERSCORE_IDENT_RE
var PREPROCESSOR = {
className: 'preprocessor', begin: /<\?(php)?|\?>/
};
var STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE, PREPROCESSOR],
variants: [
{
begin: 'b"', end: '"'
},
{
begin: 'b\'', end: '\''
},
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})
]
};
var NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]};
return {
aliases: ['php3', 'php4', 'php5', 'php6'],
case_insensitive: true,
defaultMode: {
keywords:
'and include_once list abstract global private echo interface as static endswitch ' +
'array null if endwhile or const for endforeach self var while isset public ' +
'protected exit foreach throw elseif include __FILE__ empty require_once do xor ' +
'return implements parent clone use __CLASS__ __LINE__ else break print eval new ' +
'catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ ' +
'enddeclare final try this switch continue endfor endif declare unset true false ' +
'namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.HASH_COMMENT_MODE,
{
keywords:
'and include_once list abstract global private echo interface as static endswitch ' +
'array null if endwhile or const for endforeach self var while isset public ' +
'protected exit foreach throw elseif include __FILE__ empty require_once do xor ' +
'return parent clone use __CLASS__ __LINE__ else break print eval new ' +
'catch __METHOD__ case exception default die require __FUNCTION__ ' +
'enddeclare final try switch continue endfor endif declare unset true false ' +
'trait goto instanceof insteadof __DIR__ __NAMESPACE__ ' +
'yield finally',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.HASH_COMMENT_MODE,
{
className: 'comment',
begin: '/\\*', end: '\\*/',
contains: [
{
className: 'phpdoc',
begin: '\\s@[A-Za-z]+'
},
PREPROCESSOR
]
},
{
className: 'comment',
begin: '/\\*', end: '\\*/',
contains: [{
className: 'phpdoc',
begin: '\\s@[A-Za-z]+'
}]
},
{
className: 'comment',
excludeBegin: true,
begin: '__halt_compiler.+?;', endsWithParent: true
},
{
className: 'string',
begin: '<<<[\'"]?\\w+[\'"]?$', end: '^\\w+;',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'preprocessor',
begin: '<\\?php',
relevance: 10
},
{
className: 'preprocessor',
begin: '\\?>'
},
VARIABLE,
{
className: 'function',
beginWithKeyword: true, end: '{',
keywords: 'function',
illegal: '\\$|\\[|%',
contains: [
TITLE,
{
className: 'params',
begin: '\\(', end: '\\)',
contains: [
'self',
VARIABLE,
hljs.C_BLOCK_COMMENT_MODE
].concat(STRINGS).concat(NUMBERS)
}
]
},
{
className: 'class',
beginWithKeyword: true, end: '{',
keywords: 'class',
illegal: '[:\\(\\$]',
contains: [
{
beginWithKeyword: true, endsWithParent: true,
keywords: 'extends',
contains: [TITLE]
},
TITLE
]
},
{
begin: '=>' // No markup, just a relevance booster
}
].concat(STRINGS).concat(NUMBERS)
}
begin: '__halt_compiler.+?;', endsWithParent: true,
keywords: '__halt_compiler', lexemes: hljs.UNDERSCORE_IDENT_RE
},
{
className: 'string',
begin: '<<<[\'"]?\\w+[\'"]?$', end: '^\\w+;',
contains: [hljs.BACKSLASH_ESCAPE]
},
PREPROCESSOR,
VARIABLE,
{
className: 'function',
beginKeywords: 'function', end: /[;{]/, excludeEnd: true,
illegal: '\\$|\\[|%',
contains: [
hljs.UNDERSCORE_TITLE_MODE,
{
className: 'params',
begin: '\\(', end: '\\)',
contains: [
'self',
VARIABLE,
hljs.C_BLOCK_COMMENT_MODE,
STRING,
NUMBER
]
}
]
},
{
className: 'class',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
illegal: /[:\(\$"]/,
contains: [
{
beginKeywords: 'extends implements',
relevance: 10
},
hljs.UNDERSCORE_TITLE_MODE
]
},
{
beginKeywords: 'namespace', end: ';',
illegal: /[\.']/,
contains: [hljs.UNDERSCORE_TITLE_MODE]
},
{
beginKeywords: 'use', end: ';',
contains: [hljs.UNDERSCORE_TITLE_MODE]
},
{
begin: '=>' // No markup, just a relevance booster
},
STRING,
NUMBER
]
};
}(hljs);
}