emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cc-mode identifies brace-enclosed initializer list as statement block


From: Jefferson Carpenter
Subject: cc-mode identifies brace-enclosed initializer list as statement block
Date: Wed, 18 Apr 2018 07:24:44 +0000
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

I'm concerned about the indentation of the following code:

    void build_pages() {
        idx = &mk_hcj<text>(*new hcj, {
            {},
            {{
                    "hi"
                }},
        });
    }

I would like the "hi" text to be indented one level - not two. IOW, I want it to be indented like this:

    void build_pages() {
        idx = &mk_hcj<text>(*new hcj, {
            {},
            {{
                "hi"
            }},
        });
    }

Placing point on the line containing "hi" and running (c-guess-basic-syntax), the output is:

    ((statement-block-intro 63) (brace-list-intro 63))

So cc-mode appears to be confusing my nested brace-init-lists with statement blocks. I understand that if two separate brace-list-intro's were recognized, it might still indent two levels unless they were combined somehow, but I think a good starting point would be for the parser to be able to understand nested list-initialization.

Jefferson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]