Changed Safe_calloc to use 2 arguements to mimic teh standard calloc function
[fw/sdcc] / src / SDCC.lex
index cd19d787befd8efc7dc4bc4b1fefeb466818bdce..b335a917aaf958af396969789c558046a5d9867b 100644 (file)
@@ -34,6 +34,7 @@ IS       (u|U|l|L)*
 #include <string.h>
 #include <ctype.h>
 #include "common.h"
+#include "newalloc.h"
     
 char *stringLiteral();
 char *currFname;
@@ -117,6 +118,8 @@ struct options  save_options  ;
 "if"           { count(); return(IF); }
 "int"          { count(); return(INT); }
 "interrupt"    { count(); return(INTERRUPT);}
+"nonbanked"    { count(); TKEYWORD(NONBANKED);}
+"banked"       { count(); TKEYWORD(BANKED);}
 "long"        { count(); return(LONG); }
 "near"        { count(); TKEYWORD(DATA);}
 "pdata"        { count(); TKEYWORD(PDATA); }
@@ -260,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;
     }
@@ -519,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;
+}