Fixed a problem with --feature labels_without_colons: The scanner inserts
a space at the beginning of a new file, with the assumption that this is a "neutral" character. If above feature is enabled, it is no longer neutral, so read the first character from the new input instead. git-svn-id: svn://svn.cc65.org/cc65/trunk@3650 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -314,7 +314,7 @@ void NewInputFile (const char* Name)
|
|||||||
F = fopen (Name, "r");
|
F = fopen (Name, "r");
|
||||||
if (F == 0) {
|
if (F == 0) {
|
||||||
|
|
||||||
char* PathName;
|
char* PathName;
|
||||||
|
|
||||||
/* Error (fatal error if this is the main file) */
|
/* Error (fatal error if this is the main file) */
|
||||||
if (ICount == 0) {
|
if (ICount == 0) {
|
||||||
@@ -338,7 +338,7 @@ void NewInputFile (const char* Name)
|
|||||||
/* check again if we do now have an open file */
|
/* check again if we do now have an open file */
|
||||||
if (F != 0) {
|
if (F != 0) {
|
||||||
|
|
||||||
unsigned FileIdx;
|
unsigned FileIdx;
|
||||||
|
|
||||||
/* Stat the file and remember the values */
|
/* Stat the file and remember the values */
|
||||||
struct stat Buf;
|
struct stat Buf;
|
||||||
@@ -346,8 +346,8 @@ void NewInputFile (const char* Name)
|
|||||||
Fatal ("Cannot stat input file `%s': %s", 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 */
|
/* Add the file to the input file table and remember the index */
|
||||||
FileIdx = AddFile (Name, Buf.st_size, Buf.st_mtime);
|
FileIdx = AddFile (Name, Buf.st_size, Buf.st_mtime);
|
||||||
|
|
||||||
/* Create a new state variable and initialize it */
|
/* Create a new state variable and initialize it */
|
||||||
I = xmalloc (sizeof (*I));
|
I = xmalloc (sizeof (*I));
|
||||||
@@ -364,10 +364,12 @@ void NewInputFile (const char* Name)
|
|||||||
IFile = I;
|
IFile = I;
|
||||||
++ICount;
|
++ICount;
|
||||||
|
|
||||||
/* Setup the next token and character so it will be skipped on the
|
/* Read the first character from the new file */
|
||||||
* next call to NextRawTok().
|
NextChar ();
|
||||||
|
|
||||||
|
/* Setup the next token so it will be skipped on the next call to
|
||||||
|
* NextRawTok().
|
||||||
*/
|
*/
|
||||||
C = ' ';
|
|
||||||
Tok = TOK_SEP;
|
Tok = TOK_SEP;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -413,10 +415,12 @@ void NewInputData (char* Data, int Malloced)
|
|||||||
I->Next = IData;
|
I->Next = IData;
|
||||||
IData = I;
|
IData = I;
|
||||||
|
|
||||||
/* Setup the next token and character so it will be skipped on the
|
/* Read the first character from the new file */
|
||||||
* next call to NextRawTok().
|
NextChar ();
|
||||||
|
|
||||||
|
/* Setup the next token so it will be skipped on the next call to
|
||||||
|
* NextRawTok().
|
||||||
*/
|
*/
|
||||||
C = ' ';
|
|
||||||
Tok = TOK_SEP;
|
Tok = TOK_SEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +631,7 @@ static unsigned ReadStringConst (int StringTerm)
|
|||||||
}
|
}
|
||||||
++I;
|
++I;
|
||||||
|
|
||||||
/* Skip the character */
|
/* Skip the character */
|
||||||
NextChar ();
|
NextChar ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,7 +931,7 @@ Again:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
Tok = TOK_X;
|
Tok = TOK_X;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
@@ -977,7 +981,7 @@ CharAgain:
|
|||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
Tok = TOK_MINUS;
|
Tok = TOK_MINUS;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
@@ -1027,7 +1031,7 @@ CharAgain:
|
|||||||
case '-':
|
case '-':
|
||||||
IVal = 0;
|
IVal = 0;
|
||||||
do {
|
do {
|
||||||
--IVal;
|
--IVal;
|
||||||
NextChar ();
|
NextChar ();
|
||||||
} while (C == '-');
|
} while (C == '-');
|
||||||
Tok = TOK_ULABEL;
|
Tok = TOK_ULABEL;
|
||||||
@@ -1039,7 +1043,7 @@ CharAgain:
|
|||||||
++IVal;
|
++IVal;
|
||||||
NextChar ();
|
NextChar ();
|
||||||
} while (C == '+');
|
} while (C == '+');
|
||||||
Tok = TOK_ULABEL;
|
Tok = TOK_ULABEL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '=':
|
case '=':
|
||||||
@@ -1127,7 +1131,7 @@ CharAgain:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
if (C == '=') {
|
if (C == '=') {
|
||||||
NextChar ();
|
NextChar ();
|
||||||
Tok = TOK_GE;
|
Tok = TOK_GE;
|
||||||
@@ -1177,7 +1181,7 @@ CharAgain:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
ReadStringConst ('\"');
|
ReadStringConst ('\"');
|
||||||
Tok = TOK_STRCON;
|
Tok = TOK_STRCON;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1267,15 +1271,15 @@ int GetSubKey (const char** Keys, unsigned Count)
|
|||||||
|
|
||||||
/* If we aren't in ignore case mode, we have to uppercase the identifier */
|
/* If we aren't in ignore case mode, we have to uppercase the identifier */
|
||||||
if (!IgnoreCase) {
|
if (!IgnoreCase) {
|
||||||
UpcaseSVal ();
|
UpcaseSVal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do a linear search (a binary search is not worth the effort) */
|
/* Do a linear search (a binary search is not worth the effort) */
|
||||||
for (I = 0; I < Count; ++I) {
|
for (I = 0; I < Count; ++I) {
|
||||||
if (strcmp (SVal, Keys [I]) == 0) {
|
if (strcmp (SVal, Keys [I]) == 0) {
|
||||||
/* Found it */
|
/* Found it */
|
||||||
return I;
|
return I;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found */
|
/* Not found */
|
||||||
|
|||||||
Reference in New Issue
Block a user