1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 01:31:33 +00:00

Added parameter to prspst() and fixed bug in skpcmt()

This commit is contained in:
Curtis F Kaylor 2020-02-23 14:26:15 -05:00
parent 910a807fbc
commit 8c22e30a06
2 changed files with 8 additions and 7 deletions

View File

@ -112,10 +112,10 @@ void skpeol(void) {while (!isnl()) getnxt();}
/* Advance Source File to end of comment * /* Advance Source File to end of comment *
* Recognizes both C and C++ style comments */ * Recognizes both C and C++ style comments */
void skpcmt(int exslsh) void skpcmt(int skslsh)
{ {
DEBUG("Skipping Comment\n", 0) 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 if (match('/')) skpeol(); //if C style comment skip rest of line
else if (match('*')) //if C++ style comment else if (match('*')) //if C++ style comment
while (TRUE) // skip to */ while (TRUE) // skip to */
@ -439,14 +439,15 @@ void prcpst(int isint, char* name, char *index, char indtyp, char ispntr) {
} }
/* Parse Post Operator */ /* Parse Post Operator */
int prspst(char trmntr, int isint, char* name, char* index, char indtyp, char ispntr) { int prspst(char poper, char trmntr, int isint, char* name, char* index, char indtyp, char ispntr) {
oper = getnxt(); if (poper) oper = poper;
else oper = getnxt();
CCMNT(oper); CCMNT(oper);
DEBUG("Checking for post operation '%c'\n", oper) DEBUG("Checking for post operation '%c'\n", oper)
if (nxtchr == oper) { if (nxtchr == oper) {
skpchr(); skpchr();
CCMNT(oper); CCMNT(oper);
expect(trmntr); if (trmntr) expect(trmntr);
prcpst(isint, name, index, indtyp, ispntr); //Process Post-Op prcpst(isint, name, index, indtyp, ispntr); //Process Post-Op
return 0; return 0;
} }

View File

@ -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) 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) DEBUG("stmnt.prcava: Set STA index to '%s'", asnidx) DETAIL(" and type to %d\n", asnivt)
if (ispopr()) { 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 TRUE;
} }
return FALSE; return FALSE;
@ -188,7 +188,7 @@ void prcavr(char trmntr) {
strcpy(vrname, word); //save variable to assign to strcpy(vrname, word); //save variable to assign to
if (valtyp == STRUCTURE) prsmbr(vrname); //Updates word and vartyp if (valtyp == STRUCTURE) prsmbr(vrname); //Updates word and vartyp
if (vartyp == VTINT) { 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 else prcasi(trmntr); //Process Integer Assignment
return; return;
} }