diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-04 19:43:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-04 19:43:03 +0300 |
commit | fc517cb0790df03eb7bfbe98ad581b9017d4989e (patch) | |
tree | 15e0699737ae2474a0febd33eac74a1ebc63e9cd /source/blender/editors/space_text/text_format_lua.c | |
parent | dfcda05242d3f51bde274aab71a58b159edac343 (diff) |
Cleanup: formatting for text highlighter
Diffstat (limited to 'source/blender/editors/space_text/text_format_lua.c')
-rw-r--r-- | source/blender/editors/space_text/text_format_lua.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c index 347d46a4234..935e288c7be 100644 --- a/source/blender/editors/space_text/text_format_lua.c +++ b/source/blender/editors/space_text/text_format_lua.c @@ -48,7 +48,7 @@ static int txtfmt_lua_find_keyword(const char *string) /* Keep aligned args for readability. */ /* clang-format off */ - if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len; + if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "do", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len; @@ -66,8 +66,7 @@ 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 */ @@ -96,7 +95,7 @@ static int txtfmt_lua_find_specialvar(const char *string) /* Keep aligned args for readability. */ /* clang-format off */ - if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len; + if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "collectgarbage", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "dofile", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "error", len)) { i = len; @@ -124,8 +123,7 @@ 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 */ @@ -140,18 +138,13 @@ static int txtfmt_lua_find_bool(const char *string) { int i, len; - 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; - } + /* Keep aligned args for readability. */ + /* clang-format off */ + + 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; } /* clang-format on */ @@ -169,10 +162,9 @@ static char txtfmt_lua_format_identifier(const char *str) /* Keep aligned args for readability. */ /* clang-format off */ - if ((txtfmt_lua_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL; + 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 */ |