fix scan.c for ID accept non-alphabet characters and resolve some warning
This commit is contained in:
@@ -45,7 +45,7 @@ int TraceCode = FALSE;
|
||||
|
||||
int Error = FALSE;
|
||||
|
||||
main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[]) {
|
||||
TreeNode *syntaxTree;
|
||||
char pgm[120]; /* source code file name */
|
||||
if (argc != 2) {
|
||||
|
||||
@@ -219,7 +219,6 @@ TokenType getToken(void) { /* index for storing into tokenString */
|
||||
currentToken = ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
case INLT:
|
||||
state = DONE;
|
||||
if (c == '=') {
|
||||
@@ -249,7 +248,7 @@ TokenType getToken(void) { /* index for storing into tokenString */
|
||||
}
|
||||
break;
|
||||
case INID:
|
||||
if (!isalpha(c)) { /* backup in the input */
|
||||
if (!isalnum(c)) { /* backup in the input */
|
||||
ungetNextChar();
|
||||
save = FALSE;
|
||||
state = DONE;
|
||||
|
||||
@@ -156,7 +156,7 @@ char *copyString(char *s) {
|
||||
/* Variable indentno is used by printTree to
|
||||
* store current number of spaces to indent
|
||||
*/
|
||||
static indentno = 0;
|
||||
static int indentno = 0;
|
||||
|
||||
/* macros to increase/decrease indentation */
|
||||
#define INDENT indentno += 2
|
||||
|
||||
Reference in New Issue
Block a user