summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorRichard van Velzen <richard@goreply.com>2023-03-01 00:07:24 +0100
committerGitHub <noreply@github.com>2023-03-01 00:07:24 +0100
commit80357823f6252a8b99c05bbd5338cf3be80bd052 (patch)
tree139b5d1ed3b52ce0519ce9cd21ae992c7f31264f /pygments
parent875b85895fa5ab2094434796379288cd73ef0274 (diff)
downloadpygments-git-80357823f6252a8b99c05bbd5338cf3be80bd052.tar.gz
Improve lexing PHP's variable variable syntax (#2358)
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/php.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py
index c99daa4d..f48fa382 100644
--- a/pygments/lexers/php.py
+++ b/pygments/lexers/php.py
@@ -224,7 +224,7 @@ class PhpLexer(RegexLexer):
r'finally|match)\b', Keyword),
(r'(true|false|null)\b', Keyword.Constant),
include('magicconstants'),
- (r'\$\{\$+' + _ident_inner + r'\}', Name.Variable),
+ (r'\$\{', Name.Variable, 'variablevariable'),
(r'\$+' + _ident_inner, Name.Variable),
(_ident_inner, Name.Other),
(r'(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?', Number.Float),
@@ -237,6 +237,10 @@ class PhpLexer(RegexLexer):
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
(r'"', String.Double, 'string'),
],
+ 'variablevariable': [
+ (r'\}', Name.Variable, '#pop'),
+ include('php')
+ ],
'magicfuncs': [
# source: http://php.net/manual/en/language.oop5.magic.php
(words((