aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpystub <pystub@gmail.com>2018-01-24 23:26:48 +0200
committerGitHub <noreply@github.com>2018-01-24 23:26:48 +0200
commit0ff02a70f911327e8a1f92881f5ef43b7cd0e7c8 (patch)
tree47570ccc1811b9785232391c7eded6127c144563
parent5b8042ab1aa986d27e8974dbffe96bda6af61faf (diff)
downloadvis-0ff02a70f911327e8a1f92881f5ef43b7cd0e7c8.tar.gz
vis-0ff02a70f911327e8a1f92881f5ef43b7cd0e7c8.tar.xz
PHP lexer: stop line comments right before ?>
This allows to end PHP code sections. Otherwise token is treated as part of the comment and parser continues to parse whatever is after.
-rw-r--r--lua/lexers/php.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/lexers/php.lua b/lua/lexers/php.lua
index 6dae5ea..5653880 100644
--- a/lua/lexers/php.lua
+++ b/lua/lexers/php.lua
@@ -11,7 +11,7 @@ local M = {_NAME = 'php'}
local ws = token(l.WHITESPACE, l.space^1)
-- Comments.
-local line_comment = (P('//') + '#') * l.nonnewline^0
+local line_comment = (P('//') + '#') * (l.nonnewline - '?>')^0
local block_comment = '/*' * (l.any - '*/')^0 * P('*/')^-1
local comment = token(l.COMMENT, block_comment + line_comment)