aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py2/pygments/lexers/php.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/python/Pygments/py2/pygments/lexers/php.py
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py2/pygments/lexers/php.py')
-rw-r--r--contrib/python/Pygments/py2/pygments/lexers/php.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/contrib/python/Pygments/py2/pygments/lexers/php.py b/contrib/python/Pygments/py2/pygments/lexers/php.py
index 78e4c72d3b..bd4a237666 100644
--- a/contrib/python/Pygments/py2/pygments/lexers/php.py
+++ b/contrib/python/Pygments/py2/pygments/lexers/php.py
@@ -5,18 +5,18 @@
Lexers for PHP and related languages.
- :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
-from pygments.lexer import RegexLexer, include, bygroups, default, using, \
- this, words
+from pygments.lexer import RegexLexer, include, bygroups, default, using, \
+ this, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Other
-from pygments.util import get_bool_opt, get_list_opt, iteritems, \
- shebang_matches
+from pygments.util import get_bool_opt, get_list_opt, iteritems, \
+ shebang_matches
__all__ = ['ZephirLexer', 'PhpLexer']
@@ -139,9 +139,9 @@ class PhpLexer(RegexLexer):
],
'php': [
(r'\?>', Comment.Preproc, '#pop'),
- (r'(<<<)([\'"]?)(' + _ident_inner + r')(\2\n.*?\n\s*)(\3)(;?)(\n)',
- bygroups(String, String, String.Delimiter, String, String.Delimiter,
- Punctuation, Text)),
+ (r'(<<<)([\'"]?)(' + _ident_inner + r')(\2\n.*?\n\s*)(\3)(;?)(\n)',
+ bygroups(String, String, String.Delimiter, String, String.Delimiter,
+ Punctuation, Text)),
(r'\s+', Text),
(r'#.*?\n', Comment.Single),
(r'//.*?\n', Comment.Single),
@@ -166,15 +166,15 @@ class PhpLexer(RegexLexer):
r'FALSE|print|for|require|continue|foreach|require_once|'
r'declare|return|default|static|do|switch|die|stdClass|'
r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|'
- r'virtual|endfor|include_once|while|endforeach|global|'
- r'endif|list|endswitch|new|endwhile|not|'
- r'array|E_ALL|NULL|final|php_user_filter|interface|'
+ r'virtual|endfor|include_once|while|endforeach|global|'
+ r'endif|list|endswitch|new|endwhile|not|'
+ r'array|E_ALL|NULL|final|php_user_filter|interface|'
r'implements|public|private|protected|abstract|clone|try|'
r'catch|throw|this|use|namespace|trait|yield|'
r'finally)\b', Keyword),
(r'(true|false|null)\b', Keyword.Constant),
- include('magicconstants'),
- (r'\$\{\$+' + _ident_inner + r'\}', Name.Variable),
+ include('magicconstants'),
+ (r'\$\{\$+' + _ident_inner + r'\}', Name.Variable),
(r'\$+' + _ident_inner, Name.Variable),
(_ident_inner, Name.Other),
(r'(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?', Number.Float),
@@ -187,35 +187,35 @@ class PhpLexer(RegexLexer):
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
(r'"', String.Double, 'string'),
],
- 'magicfuncs': [
- # source: http://php.net/manual/en/language.oop5.magic.php
- (words((
- '__construct', '__destruct', '__call', '__callStatic', '__get', '__set',
- '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke',
- '__set_state', '__clone', '__debugInfo',), suffix=r'\b'),
- Name.Function.Magic),
- ],
- 'magicconstants': [
- # source: http://php.net/manual/en/language.constants.predefined.php
- (words((
- '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__',
- '__TRAIT__', '__METHOD__', '__NAMESPACE__',),
- suffix=r'\b'),
- Name.Constant),
- ],
+ 'magicfuncs': [
+ # source: http://php.net/manual/en/language.oop5.magic.php
+ (words((
+ '__construct', '__destruct', '__call', '__callStatic', '__get', '__set',
+ '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke',
+ '__set_state', '__clone', '__debugInfo',), suffix=r'\b'),
+ Name.Function.Magic),
+ ],
+ 'magicconstants': [
+ # source: http://php.net/manual/en/language.constants.predefined.php
+ (words((
+ '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__',
+ '__TRAIT__', '__METHOD__', '__NAMESPACE__',),
+ suffix=r'\b'),
+ Name.Constant),
+ ],
'classname': [
(_ident_inner, Name.Class, '#pop')
],
'functionname': [
- include('magicfuncs'),
- (_ident_inner, Name.Function, '#pop'),
- default('#pop')
+ include('magicfuncs'),
+ (_ident_inner, Name.Function, '#pop'),
+ default('#pop')
],
'string': [
(r'"', String.Double, '#pop'),
(r'[^{$"\\]+', String.Double),
(r'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape),
- (r'\$' + _ident_inner + r'(\[\S+?\]|->' + _ident_inner + ')?',
+ (r'\$' + _ident_inner + r'(\[\S+?\]|->' + _ident_inner + ')?',
String.Interpol),
(r'(\{\$\{)(.*?)(\}\})',
bygroups(String.Interpol, using(this, _startinline=True),
@@ -225,7 +225,7 @@ class PhpLexer(RegexLexer):
String.Interpol)),
(r'(\$\{)(\S+)(\})',
bygroups(String.Interpol, Name.Variable, String.Interpol)),
- (r'[${\\]', String.Double)
+ (r'[${\\]', String.Double)
],
}
@@ -262,8 +262,8 @@ class PhpLexer(RegexLexer):
yield index, token, value
def analyse_text(text):
- if shebang_matches(text, r'php'):
- return True
+ if shebang_matches(text, r'php'):
+ return True
rv = 0.0
if re.search(r'<\?(?!xml)', text):
rv += 0.3