[BACK]Return to scanner2.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/scanner2.c between version 1.4 and 1.9

version 1.4, 2004/09/10 13:20:23 version 1.9, 2005/07/18 10:55:16
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/scanner2.c,v 1.3 2001/05/04 01:06:25 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/scanner2.c,v 1.8 2005/07/03 11:08:54 ohara 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.
 */  */
 #include <stdio.h>  #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
 #include "datatype.h"  #include "datatype.h"
 #include "stackm.h"  #include "stackm.h"
 struct tokens lookupTokens(struct tokens t);  struct tokens lookupTokens(struct tokens t);
Line 56  static isKakkoSM();
Line 58  static isKakkoSM();
 static isSymbolSM();  static isSymbolSM();
 static struct tokens getokenSM2();  static struct tokens getokenSM2();
   
   extern int ScannerWhich;
   extern unsigned char ScannerBuf[];
   extern int ScannerPt;
   
 /****************  code part of lexical analizer ********************/  /****************  code part of lexical analizer ********************/
   
 struct tokens *decomposeToTokens(str,sizep)  struct tokens *decomposeToTokens(str,sizep)
Line 97  static int getSM()
Line 103  static int getSM()
      /* get a letter from StringSM */       /* get a letter from StringSM */
 {  {
   int c;    int c;
   c = StringSM[StrpSM++];  
     if ((StrpSM > 0) && (StringSM[StrpSM] == ',') && (StringSM[StrpSM-1] == ',')) {  int i;
           fprintf(stderr,"Warning: ,, is found: ");
           for (i=(StrpSM-30>0?StrpSM-30:0); i<=StrpSM; i++) {
             fprintf(stderr,"%c",StringSM[i]);
           }
           fprintf(stderr,"\n");
     }
   
     c = (unsigned char) StringSM[StrpSM++];
     if (c != 0) {
       ScannerPt++; if (ScannerPt >= SCANNERBUF_SIZE) ScannerPt = 0;
       ScannerBuf[ScannerPt] = c;
     }
   if (c == '\0') {    if (c == '\0') {
     StrpSM--;return(EOF);      StrpSM--;return(EOF);
   } else return(c);    } else return(c);
Line 138  static struct tokens flushSM()
Line 157  static struct tokens flushSM()
   strcpy(token,BufSM);    strcpy(token,BufSM);
   r.token = token;    r.token = token;
   r.kind = TypeSM;    r.kind = TypeSM;
     r.tflag = 0;
   if (r.kind == ID) {    if (r.kind == ID) {
     if (isLiteral(r.token)) {      if (isLiteral(r.token)) {
       r.object = lookupLiteralString(r.token);        r.object = lookupLiteralString(r.token);
Line 151  static struct tokens flushSM()
Line 171  static struct tokens flushSM()
 static isSpaceSM(c)  static isSpaceSM(c)
      int c;       int c;
 {  {
   static int prev=0;  
   if ((c == ',') && (prev == ',')) fprintf(stderr,"Warning! ,, is found.\n");  
   prev = c;  
   
   if (((c <= ' ') || c == ',') && (c!= EOF)) return(1);    if (((c <= ' ') || c == ',') && (c!= EOF)) return(1);
   else return(0);    else return(0);
 }  }
Line 202  static struct tokens getokenSM2(kind,str)
Line 218  static struct tokens getokenSM2(kind,str)
   int level;    int level;
   
   if (kind == INIT) {    if (kind == INIT) {
       ScannerWhich = 2;
       ScannerPt = 0;
       ScannerBuf[0] = 0;
   
     StrpSM = 0;      StrpSM = 0;
     ExistSM = 0;      ExistSM = 0;
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>