PHP 8 'unexpected token ";"' not matched: error is drawn at the first character of the line
PHP 8 quotes the offending token with double quotes and the word "token" (unexpected token ";"), but the regex only captures unexpected '...' (PHP 7 style), so near is never set and the error is drawn at the first character of the line instead of at the token.
Repro (Sublime Text 4215, SublimeLinter-php 1.5.0, PHP 8.4.25). parse.php:
<?php
$a = [1, 2;
echo "x";
php -l output:
Parse error: syntax error, unexpected token ";", expecting "]" in Standard input code on line 2
SublimeLinter marks line 2 at column 0: the highlighted text is just $. It should be the ;. Other PHP 8 forms are not captured either: unexpected identifier "foo", unexpected variable "$x", unexpected integer "1", unexpected end of file.
Cause: in regex:
r'(?P<message>((?:parse|syntax) error,?)?\s*(?:unexpected '(?P<near>[^']+)')?.*) '
(?:unexpected '(?P<near>[^']+)')? needs single quotes. PHP 8.0 changed this to unexpected token ";".
Suggested fix: accept both forms, for example unexpected (?:token |identifier |variable |integer |...)?['"](?P<near>[^'"]+)['"].
Seems plausible, would like a PR from you as I don't have PHP on my current machine. Let alone old versions of it.