From c3886a301b182e7df1e21cb0b7cad9db2d1e80f3 Mon Sep 17 00:00:00 2001 From: Andreas Kirsch Date: Mon, 27 Dec 2004 18:47:32 +0000 Subject: [PATCH] -Added parenthises counter to the QCC_PR_CheakCompConst, so you can now compile e.g. myMacro( strcat( "A", "B" ) ) correctly. (I hope I didnt break anything though) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@691 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_lex.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 2873855c1..8fdfd6f10 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1839,13 +1839,16 @@ int QCC_PR_CheakCompConst(void) char buffer[1024]; char *paramoffset[MAXCONSTANTPARAMS+1]; int param=0; + int plevel=0; pr_file_p++; QCC_PR_LexWhitespace(); start = pr_file_p; while(1) { - if (*pr_file_p == ',' || *pr_file_p == ')') + if (*pr_file_p == '(') + plevel++; + else if (!plevel && (*pr_file_p == ',' || *pr_file_p == ')')) { paramoffset[param++] = start; start = pr_file_p+1; @@ -1860,7 +1863,9 @@ int QCC_PR_CheakCompConst(void) QCC_PR_LexWhitespace(); if (param == MAXCONSTANTPARAMS) QCC_PR_ParseError(ERR_TOOMANYPARAMS, "Too many parameters in macro call"); - } + } else if (*pr_file_p == ')' ) + plevel--; + if (!*pr_file_p) QCC_PR_ParseError(ERR_EOF, "EOF on macro call"); pr_file_p++;