mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +00:00
Fixed problems that occured on input files with missing LF at end of file.
git-svn-id: svn://svn.cc65.org/cc65/trunk@1903 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
22b4faabb2
commit
b6c4ff2e01
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2002 Ullrich von Bassewitz */
|
||||
/* (C) 2000-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -279,7 +279,7 @@ void DoConditionals (void)
|
||||
D = AllocIf (".IFBLANK", 1);
|
||||
NextTok ();
|
||||
if (IfCond) {
|
||||
if (Tok == TOK_SEP) {
|
||||
if (TokIsSep (Tok)) {
|
||||
SetIfCond (D, 1);
|
||||
} else {
|
||||
SetIfCond (D, 0);
|
||||
@ -318,7 +318,7 @@ void DoConditionals (void)
|
||||
D = AllocIf (".IFNBLANK", 1);
|
||||
NextTok ();
|
||||
if (IfCond) {
|
||||
if (Tok == TOK_SEP) {
|
||||
if (TokIsSep (Tok)) {
|
||||
SetIfCond (D, 0);
|
||||
} else {
|
||||
SetIfCond (D, 1);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -56,7 +56,7 @@ void GetEA (unsigned long* AddrMode, ExprNode** Expr, ExprNode** Bank)
|
||||
*Bank = *Expr = 0;
|
||||
|
||||
|
||||
if (Tok == TOK_SEP) {
|
||||
if (TokIsSep (Tok)) {
|
||||
|
||||
*AddrMode = AM_IMPLICIT;
|
||||
|
||||
@ -185,7 +185,7 @@ void GetEA (unsigned long* AddrMode, ExprNode** Expr, ExprNode** Bank)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
*AddrMode = AM_ABS | AM_DIR;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -160,7 +160,7 @@ static int FuncBlank (void)
|
||||
} else {
|
||||
/* Skip any tokens */
|
||||
int Braces = 0;
|
||||
while (Tok != TOK_SEP && Tok != TOK_EOF) {
|
||||
while (!TokIsSep (Tok)) {
|
||||
if (Tok == TOK_LPAREN) {
|
||||
++Braces;
|
||||
} else if (Tok == TOK_RPAREN) {
|
||||
@ -284,7 +284,7 @@ static int DoMatch (enum TC EqualityLevel)
|
||||
while (Tok != TOK_COMMA) {
|
||||
|
||||
/* We may not end-of-line of end-of-file here */
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
if (TokIsSep (Tok)) {
|
||||
Error (ERR_UNEXPECTED_EOL);
|
||||
return 0;
|
||||
}
|
||||
@ -315,7 +315,7 @@ static int DoMatch (enum TC EqualityLevel)
|
||||
while (Tok != TOK_RPAREN) {
|
||||
|
||||
/* We may not end-of-line of end-of-file here */
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
if (TokIsSep (Tok)) {
|
||||
Error (ERR_UNEXPECTED_EOL);
|
||||
return 0;
|
||||
}
|
||||
@ -468,7 +468,7 @@ static int FuncTCount (void)
|
||||
* will check for the closing paren, we don't need to print an error
|
||||
* here, just bail out.
|
||||
*/
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
if (TokIsSep (Tok)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -382,7 +382,7 @@ void MacDef (unsigned Style)
|
||||
}
|
||||
} else {
|
||||
/* Accept a newline or end of file for new style macros */
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
if (TokIsSep (Tok)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -548,7 +548,7 @@ static int MacExpand (void* Data)
|
||||
* generated by a user.
|
||||
*/
|
||||
unsigned PrefixLen = (I->Id[0] == LocalStart);
|
||||
sprintf (SVal, "%.*sLOCAL-MACRO-SYMBOL-%04X", PrefixLen,
|
||||
sprintf (SVal, "%.*sLOCAL-MACRO-SYMBOL-%04X", PrefixLen,
|
||||
I->Id, Mac->LocalStart + Index);
|
||||
break;
|
||||
}
|
||||
@ -604,7 +604,7 @@ static void StartExpClassic (Macro* M)
|
||||
E = NewMacExp (M);
|
||||
|
||||
/* Read the actual parameters */
|
||||
while (Tok != TOK_SEP && Tok != TOK_EOF) {
|
||||
while (!TokIsSep (Tok)) {
|
||||
|
||||
TokNode* Last;
|
||||
|
||||
@ -617,7 +617,7 @@ static void StartExpClassic (Macro* M)
|
||||
|
||||
/* Read tokens for one parameter, accept empty params */
|
||||
Last = 0;
|
||||
while (Tok != TOK_COMMA && Tok != TOK_SEP) {
|
||||
while (!TokIsSep (Tok)) {
|
||||
|
||||
TokNode* T;
|
||||
|
||||
@ -679,7 +679,7 @@ static void StartExpDefine (Macro* M)
|
||||
TokNode* Last;
|
||||
|
||||
/* Check if there is really a parameter */
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF || Tok == TOK_COMMA) {
|
||||
if (TokIsSep (Tok) || Tok == TOK_COMMA) {
|
||||
Error (ERR_MACRO_PARAM_EXPECTED);
|
||||
SkipUntilSep ();
|
||||
return;
|
||||
@ -696,16 +696,16 @@ static void StartExpDefine (Macro* M)
|
||||
|
||||
/* Insert it into the list */
|
||||
if (Last == 0) {
|
||||
E->Params [E->ParamCount] = T;
|
||||
E->Params [E->ParamCount] = T;
|
||||
} else {
|
||||
Last->Next = T;
|
||||
Last->Next = T;
|
||||
}
|
||||
Last = T;
|
||||
|
||||
/* And skip it... */
|
||||
NextTok ();
|
||||
|
||||
} while (Tok != TOK_COMMA && Tok != TOK_SEP && Tok != TOK_EOF);
|
||||
} while (Tok != TOK_COMMA && !TokIsSep (Tok));
|
||||
|
||||
/* One parameter more */
|
||||
++E->ParamCount;
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 2000-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -79,7 +79,7 @@ static TokList* CollectTokens (unsigned Start, unsigned Count)
|
||||
while (Parens != 0 || Tok != TOK_RPAREN) {
|
||||
|
||||
/* Check for end of line or end of input */
|
||||
if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
if (TokIsSep (Tok)) {
|
||||
Error (ERR_UNEXPECTED_EOL);
|
||||
return List;
|
||||
}
|
||||
@ -459,7 +459,7 @@ void ConsumeComma (void)
|
||||
void SkipUntilSep (void)
|
||||
/* Skip tokens until we reach a line separator or end of file */
|
||||
{
|
||||
while (Tok != TOK_SEP && Tok != TOK_EOF) {
|
||||
while (!TokIsSep (Tok)) {
|
||||
NextTok ();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2002 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
@ -128,7 +128,7 @@ static void SetBoolOption (unsigned char* Flag)
|
||||
case 1: *Flag = 1; NextTok (); break;
|
||||
default: ErrorSkip (ERR_ONOFF_EXPECTED); break;
|
||||
}
|
||||
} else if (Tok == TOK_SEP || Tok == TOK_EOF) {
|
||||
} else if (TokIsSep (Tok)) {
|
||||
/* Without anything assume switch on */
|
||||
*Flag = 1;
|
||||
} else {
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
/* common */
|
||||
#include "filepos.h"
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
@ -82,7 +83,7 @@ enum Token {
|
||||
|
||||
TOK_PLUS, /* + */
|
||||
TOK_MINUS, /* - */
|
||||
TOK_MUL, /* * */
|
||||
TOK_MUL, /* * */
|
||||
TOK_STAR = TOK_MUL, /* Alias */
|
||||
TOK_DIV, /* / */
|
||||
TOK_MOD, /* ! */
|
||||
@ -258,6 +259,16 @@ int TokHasSVal (enum Token Tok);
|
||||
int TokHasIVal (enum Token Tok);
|
||||
/* Return true if the given token has an attached IVal */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsSep (enum Token T)
|
||||
/* Return true if this is a separator token */
|
||||
{
|
||||
return (T == TOK_SEP || T == TOK_EOF);
|
||||
}
|
||||
#else
|
||||
# define TokIsSep(T) (T == TOK_SEP || T == TOK_EOF)
|
||||
#endif
|
||||
|
||||
int GetSubKey (const char** Keys, unsigned Count);
|
||||
/* Search for a subkey in a table of keywords. The current token must be an
|
||||
* identifier and all keys must be in upper case. The identifier will be
|
||||
|
Loading…
Reference in New Issue
Block a user