From 8cb183fb9a0cc1e0fe008b4bc66703552a910d79 Mon Sep 17 00:00:00 2001 From: Jarcode Date: Tue, 2 Apr 2019 16:20:21 -0700 Subject: [PATCH] Fixed emission bug with @n:(...) syntax --- glsl_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glsl_ext.c b/glsl_ext.c index ff56174..861ddd2 100644 --- a/glsl_ext.c +++ b/glsl_ext.c @@ -471,7 +471,7 @@ void ext_process(struct glsl_ext* ext, const char* f) { if (b_br > 0) goto handle_bind; /* store characters in braces */ else goto emit_bind; /* emit on unexpected char outside braces */ case '(': - if (b_sep) { + if (b_sep && !b_spc) { ++b_br; goto handle_bind; /* inc. brace level */ } else goto emit_bind; /* emit if wrong context: `@sym(`, `@(` (no ':') */ case ')': @@ -479,8 +479,8 @@ void ext_process(struct glsl_ext* ext, const char* f) { if (b_br <= 0 || !b_sep) goto emit_bind; else { --b_br; - if (b_br == 0) goto emit_bind; /* emit after reading brace contents */ - else goto handle_bind; /* continue reading if nested */ + if (b_br <= 0) b_spc = true; + goto handle_bind; /* dec. brace level */ } case ' ': if (b_br <= 0) b_spc = true; /* flag a non-braced space */ case '#': case '+': case '-': @@ -496,7 +496,7 @@ void ext_process(struct glsl_ext* ext, const char* f) { case 'A' ... 'Z': case '0' ... '9': case '_': { - if (b_spc && b_br <= 0) + if (b_spc && at != ')') goto emit_bind; /* skip non-braced characters after space: `@sym:vec4 c` */ if (b_sep && at != ':') b_pre = false;