X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCC.lex;h=b335a917aaf958af396969789c558046a5d9867b;hb=9d474b2ec5d8ee165fd3ec121c617d699ede6083;hp=94ca769f380c7838d9a3e052d855d82c82605394;hpb=0abb805fd2d72a89b41a10144ded610ebfc072bc;p=fw%2Fsdcc diff --git a/src/SDCC.lex b/src/SDCC.lex index 94ca769f..b335a917 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -34,6 +34,7 @@ IS (u|U|l|L)* #include #include #include "common.h" +#include "newalloc.h" char *stringLiteral(); char *currFname; @@ -262,7 +263,7 @@ int checkCurrFile ( char *s) /* mark the end of the filename */ while (*s != '"') s++; *s = '\0'; - ALLOC_ATOMIC(currFname,strlen(sb)+1); + currFname = Safe_calloc(1,strlen(sb)+1); strcpy(currFname,sb); yylineno = lNum - 2; } @@ -521,3 +522,17 @@ int isTargetKeyword(char *s) return 0; } + +extern int fatalError; + +int yyerror(char *s) +{ + fflush(stdout); + + if (yylineno && filename) + fprintf(stdout,"\n%s(%d) %s: token -> '%s' ; column %d\n", + filename,yylineno, + s,yytext,column); + fatalError++; + return 0; +}