forked from bartvdbraak/blender
Cleanup: bad brace placement for manually formatted blocks
This commit is contained in:
parent
61072f0819
commit
192940e8c2
@ -66,7 +66,8 @@ static int txtfmt_lua_find_keyword(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "then", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "until", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
|
||||
} else { i = 0; }
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -123,7 +124,8 @@ static int txtfmt_lua_find_specialvar(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "unpack", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "_VERSION", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) { i = len;
|
||||
} else { i = 0; }
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -144,7 +146,8 @@ static int txtfmt_lua_find_bool(const char *string)
|
||||
if (STR_LITERAL_STARTSWITH(string, "nil", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "true", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "false", len)) { i = len;
|
||||
} else { i = 0; }
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -164,7 +167,8 @@ static char txtfmt_lua_format_identifier(const char *str)
|
||||
|
||||
if ((txtfmt_lua_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
} else if ((txtfmt_lua_find_keyword(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
|
||||
} else { fmt = FMT_TYPE_DEFAULT; }
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -308,9 +312,9 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
|
||||
|
||||
/* Special vars(v) or built-in keywords(b) */
|
||||
/* keep in sync with 'txtfmt_osl_format_identifier()' */
|
||||
if ((i = txtfmt_lua_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
if ((i = txtfmt_lua_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
} else if ((i = txtfmt_lua_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
@ -64,8 +64,8 @@ static int txtfmt_osl_find_builtinfunc(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "vector", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "void", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -122,8 +122,8 @@ static int txtfmt_osl_find_reserved(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "varying", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "virtual", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -153,8 +153,8 @@ static int txtfmt_osl_find_specialvar(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "surface", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "volume", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -193,8 +193,8 @@ static char txtfmt_osl_format_identifier(const char *str)
|
||||
} else if ((txtfmt_osl_find_builtinfunc(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
|
||||
} else if ((txtfmt_osl_find_reserved(str)) != -1) { fmt = FMT_TYPE_RESERVED;
|
||||
} else if ((txtfmt_osl_find_preprocessor(str)) != -1) { fmt = FMT_TYPE_DIRECTIVE;
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -327,7 +327,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_
|
||||
} else if ((i = txtfmt_osl_find_builtinfunc(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
} else if ((i = txtfmt_osl_find_reserved(str)) != -1) { prev = FMT_TYPE_RESERVED;
|
||||
} else if ((i = txtfmt_osl_find_preprocessor(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
@ -80,8 +80,8 @@ static int txtfmt_pov_find_keyword(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "end", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -239,8 +239,8 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "chr", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "str", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -475,8 +475,8 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "x", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "y", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "z", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
@ -695,8 +695,8 @@ static int txtfmt_pov_find_specialvar(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "edwards", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "peters", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "gall", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* If next source char is an identifier (eg. 'i' in "definite") no match */
|
||||
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
|
||||
@ -746,8 +746,8 @@ static int txtfmt_pov_find_bool(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "sys", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "tga", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -762,12 +762,12 @@ static char txtfmt_pov_format_identifier(const char *str)
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if ((txtfmt_pov_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
if ((txtfmt_pov_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
} else if ((txtfmt_pov_find_keyword(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
|
||||
} else if ((txtfmt_pov_find_reserved_keywords(str)) != -1) { fmt = FMT_TYPE_RESERVED;
|
||||
} else if ((txtfmt_pov_find_reserved_builtins(str)) != -1) { fmt = FMT_TYPE_DIRECTIVE;
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -905,11 +905,11 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
|
||||
|
||||
/* Special vars(v) or built-in keywords(b) */
|
||||
/* keep in sync with 'txtfmt_pov_format_identifier()' */
|
||||
if ((i = txtfmt_pov_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
if ((i = txtfmt_pov_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
} else if ((i = txtfmt_pov_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
} else if ((i = txtfmt_pov_find_reserved_keywords(str)) != -1) { prev = FMT_TYPE_RESERVED;
|
||||
} else if ((i = txtfmt_pov_find_reserved_builtins(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
@ -91,8 +91,8 @@ static int txtfmt_ini_find_keyword(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "P", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "T", len)) { i = len;
|
||||
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -304,8 +304,8 @@ static int txtfmt_ini_find_reserved(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) { i = len;
|
||||
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -335,8 +335,8 @@ static int txtfmt_ini_find_bool(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "%k", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "%h", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "%w", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -483,7 +483,7 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool
|
||||
|
||||
/* Special vars(v) or built-in keywords(b) */
|
||||
/* keep in sync with 'txtfmt_ini_format_identifier()' */
|
||||
if ((i = txtfmt_ini_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
if ((i = txtfmt_ini_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
} else if ((i = txtfmt_ini_find_reserved(str)) != -1) { prev = FMT_TYPE_RESERVED;
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ static int txtfmt_py_find_builtinfunc(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "yield", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -114,10 +114,10 @@ static int txtfmt_py_find_specialvar(const char *string)
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
|
||||
if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "class", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -155,11 +155,11 @@ static int txtfmt_py_find_bool(const char *string)
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (STR_LITERAL_STARTSWITH(string, "None", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "True", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "False", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
if (STR_LITERAL_STARTSWITH(string, "None", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "True", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "False", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -315,11 +315,11 @@ static char txtfmt_py_format_identifier(const char *str)
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if ((txtfmt_py_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
if ((txtfmt_py_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
} else if ((txtfmt_py_find_builtinfunc(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
|
||||
} else if ((txtfmt_py_find_decorator(str)) != -1) { fmt = FMT_TYPE_RESERVED;
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
return fmt;
|
||||
@ -457,10 +457,10 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
|
||||
|
||||
/* Special vars(v) or built-in keywords(b) */
|
||||
/* keep in sync with 'txtfmt_py_format_identifier()' */
|
||||
if ((i = txtfmt_py_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
if ((i = txtfmt_py_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
} else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
} else if ((i = txtfmt_py_find_decorator(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user