[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New tree-sitter mode: bison-ts-mode
From: |
Yuan Fu |
Subject: |
Re: New tree-sitter mode: bison-ts-mode |
Date: |
Thu, 28 Sep 2023 00:03:10 -0700 |
> On Sep 26, 2023, at 4:52 AM, Augustin Chéneau (BTuin) <btuin@mailo.com> wrote:
>
> Le 24/09/2023 à 23:10, Yuan Fu a écrit :
>> Actually, a second thought. IIUC the reason for this change is that without
>> these rules, no indentation is done for variable names in code like
>> static myttype *
>> variable_name;
>> static myttype
>> variable_name;
>> This is fine in normal C code, since no indentation is the same as
>> zero indentation, which is what we want. But for C embedded in Bison,
>> no indentation is not the same as zero indentation. We want it indent
>> to the top-level indentation of the embedded C. E.g.,
>> {
>> static myttype
>> variable_name;
>> }
>> rather than
>> {
>> static myttype
>> variable_name;
>> }
>> Right? In that case, we should really add a fallback indent rule for the
>> embedded c in bison, such that it indents to the top-level of the embedded
>> c. This is more robust than trying to cover all cases in the c rules. Does
>> that make sense?
>> Basically, add something like
>> (catch-all bison-ts-mode--bison-parent ,bison-ts-mode-indent-offset)
>> To the end of C’s indent rules.
>> Yuan
>
> It does make sense, thanks. I updated bison-ts-mode to do that.
Thanks. LGTM except some minor byte-compile warnings. I attached a diff, please
see if you like those changes.
Once the paperwork is done I think we are good to go.
Yuan
bison-comment.diff
Description: Binary data
- Re: New tree-sitter mode: bison-ts-mode, (continued)
Re: New tree-sitter mode: bison-ts-mode, Philip Kaludercic, 2023/09/22
Re: New tree-sitter mode: bison-ts-mode, Stefan Kangas, 2023/09/22
Re: New tree-sitter mode: bison-ts-mode, Yuan Fu, 2023/09/22
Re: New tree-sitter mode: bison-ts-mode, Yuan Fu, 2023/09/24