/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* Römerstraße 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
{ ".A8", TOK_A8 },
{ ".ADDR", TOK_ADDR },
{ ".ALIGN", TOK_ALIGN },
- { ".AND", TOK_BAND },
+ { ".AND", TOK_BOOLAND },
{ ".ASCIIZ", TOK_ASCIIZ },
{ ".ASSERT", TOK_ASSERT },
{ ".AUTOIMPORT", TOK_AUTOIMPORT },
{ ".ELSE", TOK_ELSE },
{ ".ELSEIF", TOK_ELSEIF },
{ ".END", TOK_END },
+ { ".ENDENUM", TOK_ENDENUM },
{ ".ENDIF", TOK_ENDIF },
{ ".ENDMAC", TOK_ENDMACRO },
{ ".ENDMACRO", TOK_ENDMACRO },
{ ".ENDPROC", TOK_ENDPROC },
{ ".ENDREP", TOK_ENDREP },
{ ".ENDREPEAT", TOK_ENDREP },
+ { ".ENDSCOPE", TOK_ENDSCOPE },
{ ".ENDSTRUCT", TOK_ENDSTRUCT },
+ { ".ENDUNION", TOK_ENDUNION },
+ { ".ENUM", TOK_ENUM },
{ ".ERROR", TOK_ERROR },
{ ".EXITMAC", TOK_EXITMACRO },
{ ".EXITMACRO", TOK_EXITMACRO },
{ ".MATCH", TOK_MATCH },
{ ".MID", TOK_MID },
{ ".MOD", TOK_MOD },
- { ".NOT", TOK_BNOT },
+ { ".NOT", TOK_BOOLNOT },
{ ".NULL", TOK_NULL },
- { ".OR", TOK_BOR },
+ { ".OR", TOK_BOOLOR },
{ ".ORG", TOK_ORG },
{ ".OUT", TOK_OUT },
{ ".P02", TOK_P02 },
{ ".RES", TOK_RES },
{ ".RIGHT", TOK_RIGHT },
{ ".RODATA", TOK_RODATA },
+ { ".SCOPE", TOK_SCOPE },
{ ".SEGMENT", TOK_SEGMENT },
{ ".SETCPU", TOK_SETCPU },
{ ".SHL", TOK_SHL },
{ ".SHR", TOK_SHR },
+ { ".SIZEOF", TOK_SIZEOF },
{ ".SMART", TOK_SMART },
{ ".STRAT", TOK_STRAT },
{ ".STRING", TOK_STRING },
{ ".WARNING", TOK_WARNING },
{ ".WORD", TOK_WORD },
{ ".XMATCH", TOK_XMATCH },
- { ".XOR", TOK_BXOR },
+ { ".XOR", TOK_BOOLXOR },
{ ".ZEROPAGE", TOK_ZEROPAGE },
};
/* Error (fatal error if this is the main file) */
if (ICount == 0) {
- Fatal (FAT_CANNOT_OPEN_INPUT, Name, strerror (errno));
+ Fatal ("Cannot open input file `%s': %s", Name, strerror (errno));
}
/* We are on include level. Search for the file in the include
PathName = FindInclude (Name);
if (PathName == 0 || (F = fopen (PathName, "r")) == 0) {
/* Not found or cannot open, print an error and bail out */
- Error (ERR_CANNOT_OPEN_INCLUDE, Name, strerror (errno));
+ Error ("Cannot open include file `%s': %s", Name, strerror (errno));
}
/* Free the allocated memory */
/* Stat the file and remember the values */
struct stat Buf;
if (fstat (fileno (F), &Buf) != 0) {
- Fatal (FAT_CANNOT_STAT_INPUT, Name, strerror (errno));
+ Fatal ("Cannot stat input file `%s': %s", Name, strerror (errno));
}
/* Add the file to the input file table and remember the index */
break;
}
if (C == '\n' || C == EOF) {
- Error (ERR_NEWLINE_IN_STRING);
+ Error ("Newline in string constant");
break;
}
/* Check for string length, print an error message once */
if (I == MAX_STR_LEN) {
- Error (ERR_STRING_TOO_LONG);
+ Error ("Maximum string size exceeded");
} else if (I < MAX_STR_LEN) {
SVal [I] = C;
}
Tok = TOK_PC;
return;
} else {
- Error (ERR_HEX_DIGIT_EXPECTED);
+ Error ("Hexadecimal digit expected");
}
}
IVal = 0;
while (IsXDigit (C)) {
if (IVal & 0xF0000000) {
- Error (ERR_NUM_OVERFLOW);
+ Error ("Overflow in hexadecimal number");
IVal = 0;
}
IVal = (IVal << 4) + DigitVal (C);
/* 0 or 1 must follow */
if (!IsBDigit (C)) {
- Error (ERR_01_EXPECTED);
+ Error ("Binary digit expected");
}
/* Read the number */
IVal = 0;
while (IsBDigit (C)) {
if (IVal & 0x80000000) {
- Error (ERR_NUM_OVERFLOW);
+ Error ("Overflow in binary number");
IVal = 0;
}
IVal = (IVal << 1) + DigitVal (C);
IVal = 0;
while (IsDigit (C)) {
if (IVal > (long) (0xFFFFFFFFUL / 10)) {
- Error (ERR_NUM_OVERFLOW);
+ Error ("Overflow in decimal number");
IVal = 0;
}
IVal = (IVal * 10) + DigitVal (C);
if (C == '.') {
/* Remember and skip the dot */
- SVal[0] = C;
NextChar ();
/* Check if it's just a dot */
} else {
/* Read the remainder of the identifier */
+ SVal[0] = '.';
ReadIdent (1);
/* Dot keyword, search for it */
Tok = TOK_IDENT;
} else {
/* Invalid pseudo instruction */
- Error (ERR_PSEUDO_EXPECTED);
+ Error ("`%s' is not a recognized control command", SVal);
goto Again;
}
}
/* Start character alone is not enough */
if (SVal [1] == '\0') {
- Error (ERR_IDENT_EXPECTED);
+ Error ("Invalid cheap local symbol");
goto Again;
}
NextChar ();
if (C == '&') {
NextChar ();
- Tok = TOK_BAND;
+ Tok = TOK_BOOLAND;
} else {
Tok = TOK_AND;
}
NextChar ();
if (C == '|') {
NextChar ();
- Tok = TOK_BOR;
+ Tok = TOK_BOOLOR;
} else {
Tok = TOK_OR;
}
case '!':
NextChar ();
- Tok = TOK_BNOT;
+ Tok = TOK_BOOLNOT;
return;
case '>':
/* Always a character constant */
NextChar ();
if (C == '\n' || C == EOF) {
- Error (ERR_ILLEGAL_CHARCON);
+ Error ("Illegal character constant");
goto CharAgain;
}
IVal = C;
Tok = TOK_CHARCON;
NextChar ();
if (C != '\'') {
- Error (ERR_ILLEGAL_CHARCON);
+ Error ("Illegal character constant");
} else {
NextChar ();
}
/* If we go here, we could not identify the current character. Skip it
* and try again.
*/
- Error (ERR_INVALID_CHAR, C & 0xFF);
+ Error ("Invalid input character: 0x%02X", C & 0xFF);
NextChar ();
goto Again;
}
-unsigned ParseAddrSize (void)
+unsigned char ParseAddrSize (void)
/* Check if the next token is a keyword that denotes an address size specifier.
* If so, return the corresponding address size constant, otherwise output an
* error message and return ADDR_SIZE_DEFAULT.
/* Check for an identifier */
if (Tok != TOK_IDENT) {
- Error (ERR_ADDR_SIZE_EXPECTED);
+ Error ("Address size specifier expected");
return ADDR_SIZE_DEFAULT;
}
switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) {
case 0:
case 1:
- case 2: return ADDR_SIZE_FAR;
+ case 2: return ADDR_SIZE_ZP;
case 3:
case 4:
case 5: return ADDR_SIZE_ABS;
case 6: return ADDR_SIZE_FAR;
default:
- Error (ERR_ADDR_SIZE_EXPECTED);
+ Error ("Address size specifier expected");
return ADDR_SIZE_DEFAULT;
}
}