From 8c22e30a06541abdefede92f6047f0a08026663e Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sun, 23 Feb 2020 14:26:15 -0500 Subject: [PATCH] Added parameter to prspst() and fixed bug in skpcmt() --- src/parse.c | 11 ++++++----- src/stmnt.c | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/parse.c b/src/parse.c index 83562b4..83ee0b5 100644 --- a/src/parse.c +++ b/src/parse.c @@ -112,10 +112,10 @@ void skpeol(void) {while (!isnl()) getnxt();} /* Advance Source File to end of comment * * Recognizes both C and C++ style comments */ -void skpcmt(int exslsh) +void skpcmt(int skslsh) { DEBUG("Skipping Comment\n", 0) - if (exslsh) expect('/'); //skip initial / + if (skslsh) skpchr(); //skip initial / if (match('/')) skpeol(); //if C style comment skip rest of line else if (match('*')) //if C++ style comment while (TRUE) // skip to */ @@ -439,14 +439,15 @@ void prcpst(int isint, char* name, char *index, char indtyp, char ispntr) { } /* Parse Post Operator */ -int prspst(char trmntr, int isint, char* name, char* index, char indtyp, char ispntr) { - oper = getnxt(); +int prspst(char poper, char trmntr, int isint, char* name, char* index, char indtyp, char ispntr) { + if (poper) oper = poper; + else oper = getnxt(); CCMNT(oper); DEBUG("Checking for post operation '%c'\n", oper) if (nxtchr == oper) { skpchr(); CCMNT(oper); - expect(trmntr); + if (trmntr) expect(trmntr); prcpst(isint, name, index, indtyp, ispntr); //Process Post-Op return 0; } diff --git a/src/stmnt.c b/src/stmnt.c index 228308b..7500c4b 100644 --- a/src/stmnt.c +++ b/src/stmnt.c @@ -175,7 +175,7 @@ int prcava(char *name, char trmntr, char ispntr) { if (ispntr && strcmp(asnidx, "X") == 0) ERROR("Illegal use of register X\n", 0, EXIT_FAILURE) DEBUG("stmnt.prcava: Set STA index to '%s'", asnidx) DETAIL(" and type to %d\n", asnivt) if (ispopr()) { - if (prspst(trmntr, FALSE, asnvar, asnidx, asnivt, ispntr)) expctd("post operator"); + if (prspst(0, trmntr, FALSE, asnvar, asnidx, asnivt, ispntr)) expctd("post operator"); return TRUE; } return FALSE; @@ -188,7 +188,7 @@ void prcavr(char trmntr) { strcpy(vrname, word); //save variable to assign to if (valtyp == STRUCTURE) prsmbr(vrname); //Updates word and vartyp if (vartyp == VTINT) { - if (ispopr()) {if (prspst(trmntr, TRUE, vrname, "", 0, FALSE)) expctd("post operator");} + if (ispopr()) {if (prspst(0, trmntr, TRUE, vrname, "", 0, FALSE)) expctd("post operator");} else prcasi(trmntr); //Process Integer Assignment return; }