In data sabato 6 settembre 2025 10:56:47 Ora legale dell’Europa centrale, Eli Zaretskii ha scritto: > > From: Vincenzo Pupillo > > Date: Fri, 29 Aug 2025 21:36:07 +0200 > > > > Ciao, > > this patch add support for the version 24.2 of the grammar for PHP 8.5 > > (now in beta 2). > > In addition to this, there are some fixes for both indentation and syntax > > highlighting. > > Thanks. > > Is this supposed to keep working with older versions of the grammar? Yes. I used this patch for a week with the old grammar and didn't encounter any problems. > > > (defconst php-ts-mode--keywords > > > > - '("abstract" "and" "array" "as" "break" "callable" "case" "catch" > > - "class" "clone" "const" "continue" "declare" "default" "do" "echo" > > - "else" "elseif" "enddeclare" "endfor" "endforeach" "endif" > > - "endswitch" "endwhile" "enum" "exit" "extends" "final" "finally" "fn" > > - "for" "foreach" "from" "function" "global" "goto" "if" "implements" > > - "include" "include_once" "instanceof" "insteadof" "interface" > > - "list" "match" "namespace" "new" "null" "or" "print" "private" > > - "protected" "public" "readonly" "require" "require_once" "return" > > - "static" "switch" "throw" "trait" "try" "unset" "use" "while" "xor" > > - "yield") > > + (when (treesit-available-p) > > + (append > > + '("abstract" "and" "array" "as" "break" "case" "catch" > > + "class" "clone" "const" "continue" "declare" "default" "do" "echo" > > + "else" "elseif" "enddeclare" "endfor" "endforeach" "endif" > > + "endswitch" "endwhile" "enum" "exit" "extends" "final" "finally" > > "fn" + "for" "foreach" "function" "global" "goto" "if" "implements" > > + "include" "include_once" "instanceof" "insteadof" "interface" + > > "list" "match" "namespace" "new" "null" "or" "print" "private" + > > "protected" "public" "readonly" "require" "require_once" "return" + > > "static" "switch" "throw" "trait" "try" "unset" "use" "while" "xor" + > > "yield") > > + (if (php-ts-mode--test-yield-from-p) '("yield from") '("from")))) > > > > "PHP keywords for tree-sitter font-locking.") > > > > (defconst php-ts-mode--operators > > > > - '("--" "**=" "*=" "/=" "%=" "+=" "-=" ".=" "<<=" ">>=" "&=" "^=" > > - "|=" "??" "??=" "||" "&&" "|" "^" "&" "==" "!=" "<>" "===" "!==" > > - "<" ">" "<=" ">=" "<=>" "<<" ">>" "+" "-" "." "*" "**" "/" "%" > > - "->" "?->" "...") > > + (when (treesit-available-p) > > + (append > > + '("--" "**=" "*=" "/=" "%=" "+=" "-=" ".=" "<<=" ">>=" "&=" "^=" > > + "|=" "??" "??=" "||" "&&" "|" "^" "&" "==" "!=" "<>" "===" "!==" > > + "<" ">" "<=" ">=" "<=>" "<<" ">>" "+" "-" "." "*" "**" "/" "%" > > + "->" "?->" "...") > > + (when (php-ts-mode--test-pipe-p) '("|>")))) > > > > "PHP operators for tree-sitter font-locking.") > > Since these two are defconsts, is it wise to have their value depend > on something that could change with the grammar version? Doing so > might mean that the byte-compiled value includes traces of the grammar > library installed on the system where the file was byte-compiled, > which might cause trouble if the system on which the code is run has a > different grammar version. Or am I missing something? No, you're right. Here is the new version attached. Now the constants are variables. Thank you. Vincenzo