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