version 1.9, 2005/07/18 10:55:16 |
version 1.10, 2020/10/06 11:33:47 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/scanner2.c,v 1.8 2005/07/03 11:08:54 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/scanner2.c,v 1.9 2005/07/18 10:55:16 takayama Exp $ */ |
/* scanner2.c (SM StackMachine) */ |
/* scanner2.c (SM StackMachine) */ |
/* export: struct tokens decompostToTokens(char *str,int *sizep); |
/* export: struct tokens decompostToTokens(char *str,int *sizep); |
scanner2.c is for getting tokens from a string. |
scanner2.c is for getting tokens from a string. |
Line 49 static int TypeSM = ID; |
|
Line 49 static int TypeSM = ID; |
|
/**************** end of declaration part of lexical analizer ******/ |
/**************** end of declaration part of lexical analizer ******/ |
|
|
static int getSM(); |
static int getSM(); |
static putSM(); |
static void putSM(); |
static struct tokens flushSM(); |
static struct tokens flushSM(); |
static isSpaceSM(); |
static int isSpaceSM(); |
static isDollarSM(); |
static int isDollarSM(); |
static isBraceSM(); |
static int isBraceSM(); |
static isKakkoSM(); |
static int isKakkoSM(); |
static isSymbolSM(); |
static int isSymbolSM(); |
static struct tokens getokenSM2(); |
static struct tokens getokenSM2(); |
|
|
|
void errorScanner2(char *str); |
|
|
extern int ScannerWhich; |
extern int ScannerWhich; |
extern unsigned char ScannerBuf[]; |
extern unsigned char ScannerBuf[]; |
extern int ScannerPt; |
extern int ScannerPt; |
Line 122 static int getSM() |
|
Line 124 static int getSM() |
|
} else return(c); |
} else return(c); |
} |
} |
|
|
static putSM(c) |
static void putSM(c) |
int c; |
int c; |
/* put a letter on BufSM */ |
/* put a letter on BufSM */ |
{ |
{ |
Line 168 static struct tokens flushSM() |
|
Line 170 static struct tokens flushSM() |
|
return(r); |
return(r); |
} |
} |
|
|
static isSpaceSM(c) |
static int isSpaceSM(c) |
int c; |
int c; |
{ |
{ |
if (((c <= ' ') || c == ',') && (c!= EOF)) return(1); |
if (((c <= ' ') || c == ',') && (c!= EOF)) return(1); |
else return(0); |
else return(0); |
} |
} |
|
|
static isDollarSM(c) |
static int isDollarSM(c) |
int c; |
int c; |
{ |
{ |
if (c == '$') return(1); |
if (c == '$') return(1); |
else return(0); |
else return(0); |
} |
} |
|
|
static isBraceSM(c) |
static int isBraceSM(c) |
int c; |
int c; |
{ |
{ |
if (c == '{') return(1); |
if (c == '{') return(1); |
else return(0); |
else return(0); |
} |
} |
|
|
static isKakkoSM(c) |
static int isKakkoSM(c) |
int c; |
int c; |
{ |
{ |
if (c == '(') return(1); |
if (c == '(') return(1); |
else return(0); |
else return(0); |
} |
} |
|
|
static isSymbolSM(c) |
static int isSymbolSM(c) |
int c; |
int c; |
{ |
{ |
if ((c == '{') || |
if ((c == '{') || |
Line 327 static struct tokens getokenSM2(kind,str) |
|
Line 329 static struct tokens getokenSM2(kind,str) |
|
/*********** end of code part of lexical analizer ********************/ |
/*********** end of code part of lexical analizer ********************/ |
|
|
|
|
errorScanner2(str) |
void errorScanner2(str) |
char *str; |
char *str; |
{ |
{ |
fprintf(stderr,"Error (scanner2.c): %s\n",str); |
fprintf(stderr,"Error (scanner2.c): %s\n",str); |