some changes
parent
30c0a403e3
commit
bd1cc1e786
|
@ -1,13 +1,15 @@
|
||||||
%{
|
%{
|
||||||
#include "c_analyzer.tab.h"
|
#include "c_analyzer.tab.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
int line_number = 1;
|
int line_number = 1;
|
||||||
|
|
||||||
void yyerror(const char *s) {
|
void yyerror(const char *s) {
|
||||||
fprintf(stderr, "\033[91mError at line %i: %s near '%s'\033[0m\n", line_number, s, yytext);
|
fprintf(stderr,
|
||||||
|
"\033[91mError at line %i: %s near '%s'\033[0m\n",
|
||||||
|
line_number,
|
||||||
|
s,
|
||||||
|
yytext);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
extern char *yytext;
|
extern char *yytext;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue