From 0ff02a70f911327e8a1f92881f5ef43b7cd0e7c8 Mon Sep 17 00:00:00 2001 From: pystub Date: Wed, 24 Jan 2018 23:26:48 +0200 Subject: 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. --- lua/lexers/php.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lexers/php.lua') 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) -- cgit v1.2.3