-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Hi,
we are currently working at my current project on an extended version of symfony coding standards. I took this week the effort to implement add a c-style to cover the differences. However, while i was groking the cc-lang.el internals to understand the syntax analysis, i noticed differences in the analysis of function symbols to my beloved php-mode. Let me explain:
Our style demands to add a newline before and after the opening brace on a function declaration. The position before the brace but after the argument list should be syntactically func-decl-cont. The position after the brace should be defun-open. However, the helper c-echo-syntactic-information-p tells me that the first is ((inclass) (top-most-intro xxxx)) if the brace is typed on the function declaration line. If the brace is typed on a newline after the function declaration the syntax analysis says ((inlambda) (inline-open xxxx)). Hence, i cannot use the correct symbols in c-hanging-braces-alist. For example:
public function funcName($args) { // This brace belongs on a new line
}Although, php-mode inherits any c-styles from java-mode some function symbols are missing namely defun-open, defun-close, func-decl-cont or are found as inlamba. Why is this so? Are we missing anything in the c-lang-defconst stuff in php-mode?
Furthermore, i noticed differences in the syntax analysis of arrays with braces-notation:
$arrayWithBracesNotation = [
"key1" => "value1", // Syntax analysis says at point: ((arglist-cont xxx))
"key2" => "value2",
];Why does the syntax analysis say that we are in an arglist-cont symbol?
I know that defining own styles is against the usage of standards. However, since we append only some styles to symfony coding standards, we are sticking with them anyway. So, i would like to understand the above differences beyond fixing my style. Can/Should we enhance the syntax analysis? Is this appropriate for such a case?