fix several 'three operand in far space' problems
[fw/sdcc] / src / SDCC.lex
index ab71ecefeab3a1e492e811ae31ead9e007eafcfa..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;
@@ -118,6 +119,7 @@ struct options  save_options  ;
 "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); }
@@ -261,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;
     }
@@ -520,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;
+}