mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-22 01:31:33 +00:00
Bug Fx: Modified bgnblk() and added to call when parsing CASE
This commit is contained in:
parent
9c49c61d44
commit
68aa3c1a8f
@ -9,7 +9,7 @@ char c;
|
||||
|
||||
main:
|
||||
|
||||
for (c=0; c<=9; c++) {
|
||||
for (c=0; c<10; c++) {
|
||||
prbyte(c);
|
||||
putc(' ');
|
||||
select (c) {
|
||||
@ -24,7 +24,7 @@ for (c=0; c<=9; c++) {
|
||||
}
|
||||
|
||||
newlin();
|
||||
for (c=0; c<=9; c++) {
|
||||
for (c=0; c<10; c++) {
|
||||
prbyte(c);
|
||||
putc(' ');
|
||||
select (c) {
|
||||
@ -38,4 +38,20 @@ for (c=0; c<=9; c++) {
|
||||
}
|
||||
}
|
||||
|
||||
newlin();
|
||||
for (c=$18; c<$23; c++) {
|
||||
prbyte(c);
|
||||
putc(' ');
|
||||
select (c) {
|
||||
case $18: putln("I'M EIGHTEEN!");
|
||||
case $19:
|
||||
putln("BREAK ONE-NINE");
|
||||
if (c==$19) break;
|
||||
putln("OOPS!");
|
||||
case $22: putln("BLACKJACK!");
|
||||
default: //putln("*");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
goto exit;
|
||||
|
12
stmnt.c
12
stmnt.c
@ -92,11 +92,11 @@ void prcvar(char trmntr)
|
||||
}
|
||||
|
||||
/* Begin Program Block */
|
||||
void bgnblk(int blkflg)
|
||||
void bgnblk(char blkchr)
|
||||
{
|
||||
DEBUG("Begining program block\n", 0);
|
||||
if (blkflg) {
|
||||
expect('{');
|
||||
if (blkchr) {
|
||||
expect(blkchr);
|
||||
inblck = TRUE;
|
||||
}
|
||||
else
|
||||
@ -313,12 +313,13 @@ void pslct() {
|
||||
prsxpr(')'); //Parse Expression
|
||||
newlbl(endlbl); //Create New Label
|
||||
pshlbl(LTSLCT,endlbl); //Push Onto Stack
|
||||
bgnblk(TRUE); //Check For and Begin Block
|
||||
bgnblk('{'); //Require Beginning of Block
|
||||
strcpy(xstmnt, "CASE"); //Require Next Statement to be CASE
|
||||
}
|
||||
|
||||
/* process end of case block */
|
||||
void ecase() {
|
||||
DEBUG("Processing end of CASE block\n", 0);
|
||||
if (poplbl(cndlbl) != LTCASE)
|
||||
ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE);
|
||||
if (toplbl(endlbl) != LTSLCT)
|
||||
@ -347,7 +348,7 @@ void pcase() {
|
||||
fcase = 0;
|
||||
continue; //Parse next argument
|
||||
}
|
||||
expect(':'); //Emit branch to end of CASE block
|
||||
bgnblk(':'); //Emit branch to end of CASE block
|
||||
asmlin("BNE", cndlbl);
|
||||
break;
|
||||
}
|
||||
@ -481,6 +482,7 @@ void pstmnt()
|
||||
else
|
||||
prssym();
|
||||
if (lblcnt && !inblck) {
|
||||
DEBUG("Ending implied block\n", 0);
|
||||
if (poplbl() == LTDO)
|
||||
pdowhl(); //Parse While at End of Do Loop
|
||||
}
|
||||
|
2
vars.c
2
vars.c
@ -233,7 +233,7 @@ void addfnc()
|
||||
asmlin("STX", prmtrx); //Store Third Parameter
|
||||
endlbl[0] = 0; //Create Dummy End Label
|
||||
pshlbl(LTFUNC, endlbl); //and Push onto Stack
|
||||
bgnblk(TRUE); //Start Program Block
|
||||
bgnblk('{'); //Start Program Block
|
||||
}
|
||||
|
||||
/* (Check For and) Parse Variable Declaration*/
|
||||
|
Loading…
Reference in New Issue
Block a user