diff -r bf5f777260a6 -r 21b0534faebc eric6/ThirdParty/Pygments/pygments/lexers/php.py --- a/eric6/ThirdParty/Pygments/pygments/lexers/php.py Tue Apr 21 19:44:19 2020 +0200 +++ b/eric6/ThirdParty/Pygments/pygments/lexers/php.py Tue Apr 21 19:47:10 2020 +0200 @@ -5,7 +5,7 @@ Lexers for PHP and related languages. - :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -15,7 +15,7 @@ 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 +from pygments.util import get_bool_opt, get_list_opt, shebang_matches __all__ = ['ZephirLexer', 'PhpLexer'] @@ -49,13 +49,14 @@ include('commentsandwhitespace'), (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' r'([gim]+\b|\B)', String.Regex, '#pop'), + (r'/', Operator, '#pop'), default('#pop') ], 'badregex': [ (r'\n', Text, '#pop') ], 'root': [ - (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'), + (r'^(?=\s|/)', Text, 'slashstartsregex'), include('commentsandwhitespace'), (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|' r'(<<|>>>?|==?|!=?|->|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), @@ -243,7 +244,7 @@ self._functions = set() if self.funcnamehighlighting: from pygments.lexers._php_builtins import MODULES - for key, value in iteritems(MODULES): + for key, value in MODULES.items(): if key not in self.disabledmodules: self._functions.update(value) RegexLexer.__init__(self, **options) @@ -261,6 +262,8 @@ yield index, token, value def analyse_text(text): + if shebang_matches(text, r'php'): + return True rv = 0.0 if re.search(r'<\?(?!xml)', text): rv += 0.3