如何使bison不显示语法错误

如何使bison不显示语法错误,bison,Bison,我的代码中有一部分允许你发送一个错误,因为当这个错误出现时,我会做其他的事情 如何使bison在运行时不打印“语法错误” s19 : s19tex otros CORTAR otros ROJO otros FINLINEA f3 | s19tex otros CORTAR otros AZUL otros FINLINEA fdeath | s19tex otros CORTAR otros VERDE otros FINLINEA fdeath | s19te

我的代码中有一部分允许你发送一个错误,因为当这个错误出现时,我会做其他的事情

如何使bison在运行时不打印“语法错误”

    s19 : s19tex otros CORTAR otros ROJO otros FINLINEA f3
    | s19tex otros CORTAR otros AZUL otros FINLINEA fdeath
    | s19tex otros CORTAR otros VERDE otros FINLINEA fdeath
    | s19tex otros CORTAR otros AMARILLO otros FINLINEA fdeath
    | s19tex otros EXPLORAR otros CELDA otros FINLINEA s15
    | s19tex otros FINLINEA snada s19
    | s19tex error FINLINEA serror s19
    ;

    serror : {printf("Casi... pero NO.\n");yyclearin;}

    ;

我只想打印serror,而不是语法错误

bison生成的解析器不打印错误消息。它调用
yyerror
,这是您必须定义的函数。如果您不想打印邮件,请不要在
yyerror