GNU bug report logs - #59637
29.0.50; Should treesit-range-settings support the possibility of separate parser for each region?

Previous Next

Package: emacs;

Reported by: miha <at> kamnitnik.top

Date: Sun, 27 Nov 2022 17:12:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: miha <at> kamnitnik.top
To: 59637 <at> debbugs.gnu.org
Subject: bug#59637: 29.0.50; Should treesit-range-settings support the possibility of separate parser for each region?
Date: Sun, 27 Nov 2022 18:12:42 +0100
[Message part 1 (text/plain, inline)]
As far as I understand, the current behaviour of
treesit-parser-set-included-ranges is that the concatenation of text
from different regions in the same range set is considered as one
program. This means that for this html program

    <html>
      <script>
        /* comment start
      </script>
      <script>
        alert('hello');
      </script>
    </html>

treesitter would consider "alert('hello');" to be inside a comment and
the second script tag would contain an error about missing comment
end.

However, testing this in Firefox, it seems that the first script tag is
the erroneous one here and the alert function call isn't inside a
comment. So I guess the correct way to parse this html document would be
to have two instances of javascript parser, one for each region. On the
other hand, we should consider if this is worth the added complexity and
performance degradation.

Thanks and best regards.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 200 days ago.

Previous Next


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