GNU bug report logs -
#79339
31.0.50; [PATCH] php-ts-mode: support PHP 8.5
Previous Next
Full log
Message #8 received at 79339 <at> debbugs.gnu.org (full text, mbox):
> From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
> 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?
> (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?
This bug report was last modified 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.