[Bf-blender-cvs] [fc517cb0790] master: Cleanup: formatting for text highlighter

Campbell Barton noreply at git.blender.org
Fri Oct 4 18:51:35 CEST 2019


Commit: fc517cb0790df03eb7bfbe98ad581b9017d4989e
Author: Campbell Barton
Date:   Sat Oct 5 02:43:03 2019 +1000
Branches: master
https://developer.blender.org/rBfc517cb0790df03eb7bfbe98ad581b9017d4989e

Cleanup: formatting for text highlighter

===================================================================

M	source/blender/editors/space_text/text_format_lua.c
M	source/blender/editors/space_text/text_format_osl.c
M	source/blender/editors/space_text/text_format_pov.c
M	source/blender/editors/space_text/text_format_pov_ini.c
M	source/blender/editors/space_text/text_format_py.c

===================================================================

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 */
 
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index fb9ddcb09cb..2da4488e901 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -40,7 +40,7 @@ static int txtfmt_osl_find_builtinfunc(const char *string)
   /* list is from
    * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
    */
-  if      (STR_LITERAL_STARTSWITH(string, "break",        len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "break",        len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "closure",      len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "color",        len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "continue",     len)) { i = len;
@@ -86,7 +86,7 @@ static int txtfmt_osl_find_reserved(const char *string)
   /* list is from...
    * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
    */
-  if      (STR_LITERAL_STARTSWITH(string, "bool",         len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "bool",         len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "case",         len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "catch",        len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "char",         len)) { i = len;
@@ -149,7 +149,7 @@ static int txtfmt_osl_find_specialvar(const char *string)
   /* clang-format off */
 
   /* OSL shader types */
-  if      (STR_LITERAL_STARTSWITH(string, "shader",       len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "shader",       len)) { i = len;
   } 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;
@@ -189,7 +189,7 @@ static char txtfmt_osl_format_identifier(const char *str)
   /* Keep aligned args for readability. */
   /* clang-format off */
 
-  if      ((txtfmt_osl_find_specialvar(str))   != -1) { fmt = FMT_TYPE_SPECIAL;
+  if        ((txtfmt_osl_find_specialvar(str))   != -1) { fmt = FMT_TYPE_SPECIAL;
   } 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;
@@ -323,7 +323,7 @@ static void txtfmt_osl_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_osl_find_specialvar(str))   != -1) { prev = FMT_TYPE_SPECIAL;
+        if        ((i = txtfmt_osl_find_specialvar(str))   != -1) { prev = FMT_TYPE_SPECIAL;
         } 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;
diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c
index a5e1a3845cf..21df7b5b76a 100644
--- a/source/blender/editors/space_text/text_format_pov.c
+++ b/source/blender/editors/space_text/text_format_pov.c
@@ -48,7 +48,7 @@ static int txtfmt_pov_find_keyword(const char *string)
 
   int i, len;
   /* Language Directives */
-  if      (STR_LITERAL_STARTSWITH(string, "deprecated",  len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "deprecated",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "persistent",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "statistics",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "version",     len)) { i = len;
@@ -101,7 +101,7 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
   /* clang-format off */
 
   /* Float Functions */
-  if      (STR_LITERAL_STARTSWITH(string, "conserve_energy",    len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "conserve_energy",    len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "max_intersections",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "dimension_size",     len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "bitwise_and",        len)) { i = len;
@@ -261,7 +261,7 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
   /* clang-format off */
 
   /* Language Keywords */
-  if      (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "area_illumination",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "all_intersections",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "cutaway_textures",    len)) { i = len;
@@ -500,7 +500,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
 {
   int i, len;
   /* Modifiers */
-  if      (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "projected_through",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "double_illuminate",  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "expand_thresholds",  len)) { i = len;
@@ -710,7 +710,7 @@ static int txtfmt_pov_find_bool(const char *string)
   /* clang-format off */
 
   /* Built-in Constants */
-  if      (STR_LITERAL_STARTSWITH(string, "unofficial",          len)) { i = len;
+  if        (STR_LITERAL_STARTSWITH(string, "unofficial",          len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "false",               len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "no",                  len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "off",                 len)) { i = len;
diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c
index 04f4b992cc6..b349b38e551 100644
--- a/source/blender/editors/space_text/text_format_pov_ini.c
+++ b/source/blender/editors/space_text/text_format_pov_ini.c
@@ -49,7 +49,7 @@ static int txtfmt_ini_find_keyword(const char *string)
   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list