Text Editor: Add GLSL support language #116793

Closed
Gangneron wants to merge 68 commits from Gangneron/blender:Add_GLSL into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 12 additions and 12 deletions
Showing only changes of commit e3efaa60b4 - Show all commits

View File

@ -388,11 +388,11 @@ static char txtfmt_glsl_format_identifier(const char *str)
/* clang-format off */
if (txtfmt_glsl_find_specialvar(str) != -1) {fmt = FMT_TYPE_SPECIAL;}
else if (txtfmt_glsl_find_builtinfunc(str) != -1) {fmt = FMT_TYPE_KEYWORD;}
else if (txtfmt_glsl_find_reserved(str) != -1) {fmt = FMT_TYPE_RESERVED;}
else if (txtfmt_glsl_find_preprocessor(str) != -1) {fmt = FMT_TYPE_DIRECTIVE;}
else {fmt = FMT_TYPE_DEFAULT;}
if (txtfmt_glsl_find_specialvar(str) != -1) {fmt = FMT_TYPE_SPECIAL;
} else if (txtfmt_glsl_find_builtinfunc(str) != -1) {fmt = FMT_TYPE_KEYWORD;
} else if (txtfmt_glsl_find_reserved(str) != -1) {fmt = FMT_TYPE_RESERVED;
Gangneron marked this conversation as resolved Outdated

You should run make format to avoid any custom formatting issues.

This block is copy pasted from an area which uses /* clang-format off */. So either drop the special formatting or make sure it is correctly formatted and add back the /* clang-format off */. Same goes for the other occurrence of this part.

You should run `make format` to avoid any custom formatting issues. This block is copy pasted from an area which uses `/* clang-format off */`. So either drop the special formatting or make sure it is correctly formatted and add back the `/* clang-format off */`. Same goes for the other occurrence of this part.
} else if (txtfmt_glsl_find_preprocessor(str) != -1) {fmt = FMT_TYPE_DIRECTIVE;
} else {fmt = FMT_TYPE_DEFAULT;
Gangneron marked this conversation as resolved Outdated

Missing closing brace.

Missing closing brace.
/* clang-format on */
@ -403,13 +403,13 @@ static char txtfmt_glsl_format_identifier(const char *str)
*/
static void txtfmt_glsl_format_line(SpaceText *st, TextLine * line, const bool do_next)
{
FlattenString fs;
const char *str;
char *fmt;
char cont_orig, cont, find, prev = '';
int len, i;
FlattenString fs;
const char *str;
char *fmt;
char cont_orig, cont, find, prev = ' ';
fclem marked this conversation as resolved Outdated

empty character constant

empty character constant

I don't see what I need to change

I don't see what I need to change

c'est un code identique à text_format_osl

c'est un code identique à text_format_osl

What is the value of prev expected to be? Two single quotes without spaces doesn't define a character. OSL for example sets prev = ' '.

What is the value of prev expected to be? Two single quotes without spaces doesn't define a character. OSL for example sets `prev = ' '`.
int len, i;
if (line->prev && line->prev->format != nullptr) {
if (line->prev && line->prev->format != nullptr) {
fmt = line->prev->format;
cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator. */
BLI_assert((FMT_CONT_ALL & cont) == cont);
@ -577,7 +577,7 @@ void ED_text_format_register_glsl()
tft.format_identifier = txtfmt_glsl_format_identifier;
tft.format_line = txtfmt_glsl_format_line;
tft.ext = ext;
tft.comment_line = "//";
tft.comment_line = "/**/";
ED_text_format_register(&tft);