Immediately terminate parsing in case of error.
This commit is contained in:
parent
95087c6e7e
commit
5e719dbadf
2
main.c
2
main.c
|
@ -2,12 +2,14 @@
|
||||||
#include "Monicelli.tab.h"
|
#include "Monicelli.tab.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int lineNumber = 1;
|
int lineNumber = 1;
|
||||||
|
|
||||||
void yyerror(const char *message) {
|
void yyerror(const char *message) {
|
||||||
fprintf(stderr, "At line %d: %s\n", lineNumber, message);
|
fprintf(stderr, "At line %d: %s\n", lineNumber, message);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emit(const char *text, ...) {
|
void emit(const char *text, ...) {
|
||||||
|
|
Reference in New Issue
Block a user