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 */
|
||||
|
||||
@ -310,7 +314,7 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
|
||||
/* keep in sync with 'txtfmt_osl_format_identifier()' */
|
||||
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 */
|
||||
|
||||
|
@ -65,7 +65,7 @@ static int txtfmt_osl_find_builtinfunc(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "void", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -123,7 +123,7 @@ static int txtfmt_osl_find_reserved(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "virtual", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -154,7 +154,7 @@ static int txtfmt_osl_find_specialvar(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "volume", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -194,7 +194,7 @@ static char txtfmt_osl_format_identifier(const char *str)
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
|
||||
|
@ -81,7 +81,7 @@ static int txtfmt_pov_find_keyword(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -240,7 +240,7 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "chr", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "str", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -476,7 +476,7 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "y", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "z", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
@ -696,7 +696,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "peters", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "gall", len)) { i = len;
|
||||
} 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;
|
||||
@ -747,7 +747,7 @@ static int txtfmt_pov_find_bool(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "tga", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -767,7 +767,7 @@ static char txtfmt_pov_format_identifier(const char *str)
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -909,7 +909,7 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
|
||||
} 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 */
|
||||
|
||||
|
@ -92,7 +92,7 @@ static int txtfmt_ini_find_keyword(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "T", len)) { i = len;
|
||||
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -305,7 +305,7 @@ static int txtfmt_ini_find_reserved(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) { i = len;
|
||||
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -336,7 +336,7 @@ static int txtfmt_ini_find_bool(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "%h", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "%w", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
@ -89,7 +89,7 @@ static int txtfmt_py_find_builtinfunc(const char *string)
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "yield", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -117,7 +117,7 @@ static int txtfmt_py_find_specialvar(const char *string)
|
||||
if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "class", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@ -159,7 +159,7 @@ static int txtfmt_py_find_bool(const char *string)
|
||||
} 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 */
|
||||
|
||||
@ -319,7 +319,7 @@ static char txtfmt_py_format_identifier(const char *str)
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
return fmt;
|
||||
@ -460,7 +460,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
|
||||
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