bug report and example fix for issue1

This commit is contained in:
Lixuanwang
2025-03-06 04:06:19 +08:00
parent 2d18b9842f
commit 48876482f6
2 changed files with 11 additions and 1 deletions

View File

@ -227,7 +227,10 @@ std::any ASTPrinter::visitUnaryExp(SysYParser::UnaryExpContext *ctx){
cout << ctx->Ident()->getText() << ctx->LPAREN()->getText();
if(ctx->funcRParams())
ctx->funcRParams()->accept(this);
cout << ctx->RPAREN()->getText();
if (ctx->RPAREN())
cout << ctx->RPAREN()->getText();
else
cout << "<missing \')\'?>";
}
else if(ctx->unaryExp()){
cout << ctx->unaryOp()->getText();

7
test/bug1.sy Normal file
View File

@ -0,0 +1,7 @@
// bug1: getint(;
int main() {
int a;
a = getint(;
return 0;
}