PHP: 8.x keywords#2054
Conversation
|
A full error message would be helpful. Which module raises |
|
Sorry, that was awful of me for not including the error message. I'm trying to execute the file directly. I don't know if this is the right thing to do or not. |
|
Oh right, this is due to the |
|
OK, since there were a few more snags, I've updated the file in #2056 - can you check if it matches what you'd expect? |
| r'implements|public|private|protected|abstract|clone|try|' | ||
| r'catch|throw|this|use|namespace|trait|yield|' | ||
| r'finally)\b', Keyword), | ||
| r'finally|match)\b', Keyword), |
There was a problem hiding this comment.
I'm pretty sure readonly is in the right place, however there's two places where switch is defined (Keyword and Keyword.Declaration). Is there a way I can test this to make sure it works? Match works just like switch:
switch ($var) {
case 'a':
$result = "some value";
break;
case 'b':
$result = "some other value";
break;
}
// can be replaced with
$result = match ($var) {
'a' => "some value",
'b' => "some other value",
};There was a problem hiding this comment.
I don't see the other place? In any case, this LGTM.
This is part of the work required to get PHP 8.x support in Pygments. There is something else that needs to be added onto this patch that I couldn't figure out.
The file
pygments/lexers/_php_builtins.pyneeds to be regenerated as there are several new functions in the standard library, such asstr_starts_with(8.0) andarray_is_list(8.1). I tried to run it locally after installingrequirements.txtwith Pip, but I keep gettingModuleNotFoundError. I'm not a Python developer, what do I need to do to get this to rebuild?