abusalimov/SublimeCImproved

Support for function definition arguments on second line

jmclaughlan opened this issue · 4 comments

We use a coding standard that puts the arguments on the lines below the function definition:

static void my_func
(
  void
)
{
}

Which isn't recognized by ST3/CImproved as a function, isn't color highlighted and does not show up in ctrl-r or ctrl-shift-r list.

I see that all that is needed to make it a "function" is to place at least the opening parenthesis on the same line as the function name. In C it should not matter how many spaces or lines are in between and should be considered as white space.

This may be an issue with the C/C++ syntax as built into ST3 but I was hoping that it could be handled in CImproved.

Unlike full-fledged context-free parsers used by most compilers, syntax highlighting in ST is implemented using line-by-line regexp pattern matching. There is no way to look-ahead a pattern beyond the current line. For example, when parsing my_func we can't see the opening paren which is on the next line.
I'm afraid this is impossible (or near to impossible) to overcome these limitations. Sorry for that.

Too bad. Thanks for the feedback.

abusalimov, I understand your reason for "wontfix" on this issue. I wish the ST authors could fix this issue, not for syntax highlight/coloring but because I can't do Ctrl+R (Goto symbol) on C function names.

BTW, there're some related requests on userecho: for example, API for language syntax and Plugin API request, both created over 3 years ago though...