summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-07 23:42:37 +0200
committerGeorg Brandl <georg@python.org>2014-10-07 23:42:37 +0200
commitdb4740faa0833a6af6a2e55b8353f5d6ac430b43 (patch)
treed10b492119b74c29fcf99a86816eabf51f279ea4
parent94dd20209796aa626bfc4b50f964eb9a6e9dc504 (diff)
downloadpygments-db4740faa0833a6af6a2e55b8353f5d6ac430b43.tar.gz
PHP: allow spaces before heredoc end token
-rw-r--r--pygments/lexers/php.py2
-rw-r--r--tests/examplefiles/test.php8
2 files changed, 9 insertions, 1 deletions
diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py
index 9bee6d2e..091cf93f 100644
--- a/pygments/lexers/php.py
+++ b/pygments/lexers/php.py
@@ -137,7 +137,7 @@ class PhpLexer(RegexLexer):
],
'php': [
(r'\?>', Comment.Preproc, '#pop'),
- (r'<<<([\'"]?)(' + _ident_inner + r')\1\n.*?\n\2\;?\n', String),
+ (r'<<<([\'"]?)(' + _ident_inner + r')\1\n.*?\n\s*\2;?\n', String),
(r'\s+', Text),
(r'#.*?\n', Comment.Single),
(r'//.*?\n', Comment.Single),
diff --git a/tests/examplefiles/test.php b/tests/examplefiles/test.php
index 218892fe..2ce4023e 100644
--- a/tests/examplefiles/test.php
+++ b/tests/examplefiles/test.php
@@ -504,4 +504,12 @@ function &byref() {
$x = array();
return $x;
}
+
+ echo <<<EOF
+
+ Test the heredocs...
+
+ EOF;
+
?>
+