GNU bug report logs - #79339
31.0.50; [PATCH] php-ts-mode: support PHP 8.5

Previous Next

Package: emacs;

Reported by: Vincenzo Pupillo <v.pupillo <at> gmail.com>

Date: Fri, 29 Aug 2025 19:37:01 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

To reply to this bug, email your comments to 79339 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79339; Package emacs. (Fri, 29 Aug 2025 19:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincenzo Pupillo <v.pupillo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 29 Aug 2025 19:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; [PATCH] php-ts-mode: support PHP 8.5
Date: Fri, 29 Aug 2025 21:36:07 +0200
[Message part 1 (text/plain, inline)]
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.
Vincenzo
[0001-Add-support-for-PHP-8.5.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79339; Package emacs. (Sat, 06 Sep 2025 08:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 79339 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vincenzo Pupillo <v.pupillo <at> gmail.com>
Cc: 79339 <at> debbugs.gnu.org
Subject: Re: bug#79339: 31.0.50; [PATCH] php-ts-mode: support PHP 8.5
Date: Sat, 06 Sep 2025 11:56:47 +0300
> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79339; Package emacs. (Sun, 07 Sep 2025 17:22:01 GMT) Full text and rfc822 format available.

Message #11 received at 79339 <at> debbugs.gnu.org (full text, mbox):

From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79339 <at> debbugs.gnu.org
Subject: Re: bug#79339: 31.0.50; [PATCH] php-ts-mode: support PHP 8.5
Date: Sun, 07 Sep 2025 19:20:49 +0200
[Message part 1 (text/plain, inline)]
In data sabato 6 settembre 2025 10:56:47 Ora legale dell’Europa centrale, Eli 
Zaretskii ha scritto:
> > 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?
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
[0001-Add-support-for-PHP-8.5.patch (text/x-patch, attachment)]

This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.