summaryrefslogtreecommitdiff
path: root/bcc/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'bcc/state.c')
-rw-r--r--bcc/state.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/bcc/state.c b/bcc/state.c
index 620b553..c14ff7b 100644
--- a/bcc/state.c
+++ b/bcc/state.c
@@ -188,6 +188,7 @@ PUBLIC void compound() /* have just seen "{" */
#endif
spmark = sp;
newlevel();
+ expect_statement++;
decllist();
softsp &= alignmask;
if (sym != RBRACE) /* no need for locals if empty compound */
@@ -195,6 +196,7 @@ PUBLIC void compound() /* have just seen "{" */
returnflag = FALSE;
while (sym != RBRACE && sym != EOFSYM)
statement();
+ expect_statement--;
oldlevel();
if (!returnflag)
{
@@ -233,17 +235,27 @@ PUBLIC void compound() /* have just seen "{" */
PRIVATE void doasm()
{
- lparen();
+ if (sym == LPAREN) nextsym();
if (sym!=STRINGCONST)
error("string const expected");
else {
- nextsym();
- constant.value.s[charptr-constant.value.s]='\0';
outnstr("!BCC_ASM");
- outbyte('\t');
- outnstr(constant.value.s);
+ for(;;)
+ {
+ constant.value.s[charptr-constant.value.s]='\0';
+ outbyte('\t');
+ outnstr(constant.value.s);
+ /* XXX: Need to investigate: wasting memory?
+ *
+ * charptr = constant.value.s;
+ */
+
+ nextsym();
+ if (sym == COMMA) nextsym();
+ if (sym!=STRINGCONST) break;
+ }
outnstr("!BCC_ENDASM");
- rparen();
+ if (sym == RPAREN) nextsym();
semicolon();
}
}
@@ -718,6 +730,10 @@ more:
nextsym();
doif();
break;
+ case ELSESYM:
+ error("unexpected else");
+ nextsym();
+ break;
case WHILESYM:
nextsym();
dowhile();