From 986d21f10ce745499202fdaaec578a5cdac01052 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 26 Jun 2013 03:35:29 +0000 Subject: [PATCH] Fix a couple of bugs. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4406 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_comp.c | 2 +- engine/qclib/qcc_pr_lex.c | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index e9785a1e3..2ff2914b3 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -4818,8 +4818,8 @@ QCC_def_t *QCC_PR_ParseArrayPointer (QCC_def_t *d, pbool allowarrayassign) else idx = tmp; } - t = t->params[i].type; arraysize = t->params[i].arraysize; + t = t->params[i].type; } else break; diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 5b70c8bd8..8dda0dc74 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -3862,18 +3862,22 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) if (QCC_PR_CheckToken (".")) { newt = QCC_PR_NewType("FIELD_TYPE", ev_field, false); - newt->aux_type = QCC_PR_ParseType (false, false); - newt->size = newt->aux_type->size; + //.float *foo; is annoying. + //technically it is a pointer to a .float + //most people will want a .(float*) foo; + //so .*float will give you that. + //however, we can't cope parsing that with regular types, so we support that ONLY when . was already specified. + //this is pretty much an evil syntax hack. + if (QCC_PR_CheckToken ("*")) + { + newt->aux_type = QCC_PR_NewType("POINTER TYPE", ev_pointer, false); + newt->aux_type->aux_type = QCC_PR_ParseType (false, false); - if (newtype) - return newt; - return QCC_PR_FindType (newt); - } - if (QCC_PR_CheckToken ("*")) - { - newt = QCC_PR_NewType("POINTER TYPE", ev_pointer, false); - newt->aux_type = QCC_PR_ParseType (false, false); + newt->aux_type->size = newt->aux_type->aux_type->size; + } + else + newt->aux_type = QCC_PR_ParseType (false, false); newt->size = newt->aux_type->size;