[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64567: 29.0.92; c-ts-mode fails to parse syslogger.c of postgres sou
From: |
Eli Zaretskii |
Subject: |
bug#64567: 29.0.92; c-ts-mode fails to parse syslogger.c of postgres source |
Date: |
Tue, 11 Jul 2023 14:58:01 +0300 |
> Date: Tue, 11 Jul 2023 08:30:51 +0800
> From: Yang Yingchao via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> 1. get source file from
> <https://github.com/postgres/postgres/blob/master/src/backend/postmaster/syslogger.c>
> 1. open it, and move to line 567, then we can see function
> `SysLogger_Start(void)` is not highlighted properly.
>
> `treesit-explore-mode` shows some error too:
>
> ```
> (ERROR type: (primitive_type)
> (function_declarator declarator: (identifier)
> parameters:
> (parameter_list (
> (parameter_declaration type: (primitive_type))
> )))
>
> ```
>
> And when cusor is inside this function, and `treesit-beginning-of-defun`
> will move cusor to `SysLoggerMain()` which is actully the function
> before `SysLogger_Start()`.
It's because of this:
#ifdef EXEC_BACKEND
switch ((sysloggerPid = syslogger_forkexec()))
#else
switch ((sysloggerPid = fork_process()))
#endif
The 2 'switch' statements inside preprocessor conditions cause the
parser to fail. I'm not sure we can do anything with this, except
report this to the developers of the tree-sitter C grammar, but I CC
Yuan and Theo just in case they have some ideas.