yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
 {BEGIN VER;}
break;
case 2:
{}
break;
case 3:
   {}
break;
case 4:
{process_branch(yytext);}
break;
case 5:
{}
break;
case 6:
  {BEGIN 0;}
break;
case 7:
{printf("<%c>", yytext[0]);}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 2
0
// while((nstr = yylook()) >= 0)
void subtest5(void)
{
	int nstr;

	bogus();
	while((nstr = yylook()) >= 0)
	{
		printf("nstr: %04x\n",nstr);
		bogus();
	}
}
Ejemplo n.º 3
0
yylex()
{
int nstr;
extern int yyprevious;

#ifdef YYDEBUG
	fprintf(yyout,"yylex()\n");
#endif

	while((nstr = yylook()) >= 0)
	{
#ifdef YYDEBUG
	fprintf(yyout,"yylex: nstr=%d\n",nstr);
#endif
yyfussy:
	switch(nstr)
	{
		case 0:
			if(yywrap()) return(0);
			break;
		case 1:
		 	return ID;
		break;
		case 2:
			return CON;
		break;
		case 3:
			;
		break;
		case 4:
			return yytext[0];
		break;
		case -1:
		break;
		default:
			fprintf(yyout,"yylex: bad switch yylook %d\n",nstr);
	}

	}
	
#ifdef YYDEBUG
	fprintf(yyout,"yylex: return 0\n");
#endif
	return(0);
}
Ejemplo n.º 4
0
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 10 "scan.l"
	{ printf("I found a stego!\n"); return("stego"); }
break;
case 2:

# line 11 "scan.l"
{ printf("this is gay!\n"); return(0); }
break;
case 3:

# line 12 "scan.l"
{ printf("this is asinine\n"); return("asinine"); }
break;
case 4:

# line 13 "scan.l"
      { return(yytext);}
break;
case 5:

# line 14 "scan.l"
	{ /* ignore bad characters */ }
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 5
0
Archivo: yacc.c Proyecto: alwendt/chop
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
 return ID;
break;
case 2:
                 return CON;
break;
case 3:
                  ;
break;
case 4:
                   return yytext[0];
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 6
0
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 30 "ncgen.l"
	/* comment */ ;
break;
case 2:

# line 32 "ncgen.l"
	{
			 if(yyleng > MAXTRST) {
				yyerror("string too long, truncated\n");
			        yytext[MAXTRST-1] = '\0';
			 }
			 expand_escapes(termstring,yytext,yyleng);
		 	 return (TERMSTRING);
		        }
break;
case 3:

# line 41 "ncgen.l"
{return (FLOAT_K);}
break;
case 4:

# line 42 "ncgen.l"
	{return (CHAR_K);}
break;
case 5:

# line 43 "ncgen.l"
	{return (BYTE_K);}
break;
case 6:

# line 44 "ncgen.l"
	{return (SHORT_K);}
break;
case 7:

# line 45 "ncgen.l"
{return (LONG_K);}
break;
case 8:

# line 46 "ncgen.l"
	{return (DOUBLE_K);}
break;
case 9:

# line 47 "ncgen.l"
{long_val = -1;
			 return (NC_UNLIMITED_K);}
break;
case 10:

# line 50 "ncgen.l"
{return (DIMENSIONS);}
break;
case 11:

# line 51 "ncgen.l"
{return (VARIABLES);}
break;
case 12:

# line 52 "ncgen.l"
	{return (DATA);}
break;
case 13:

# line 53 "ncgen.l"
{
		char *s = (char*)yytext+strlen("netcdf");
		char *t = (char*)yytext+yyleng-1;
		while (isspace(*s))
			s++;
		while (isspace(*t))
			t--;
		t++;
		netcdfname = (char *) emalloc(t-s+1);
		(void) strncpy(netcdfname, s, t-s);
		netcdfname[t-s] = '\0';
		return (NETCDF);
		}
break;
case 14:

# line 66 "ncgen.l"
{    /* missing value (pre-2.4 backward compatibility) */
		double_val = FILL_DOUBLE;  /* IEEE double infinity */
		return (DOUBLE_CONST);
		}
break;
case 15:

# line 70 "ncgen.l"
{ /* missing value (pre-2.4 backward compatibility) */
		float_val = FILL_FLOAT;  /* IEEE float infinity */
		return (FLOAT_CONST);
		}
break;
case 16:

# line 74 "ncgen.l"
{
                if (STREQ((char *)yytext, FILL_STRING))
		        return (FILLVALUE);
		if ((yylval = lookup(yytext)) == NULL) {
			yylval = install(yytext);
			}
		return (IDENT);
		}
break;
case 17:

# line 83 "ncgen.l"
	{
		lineno++ ;
		}
break;
case 18:

# line 86 "ncgen.l"
{
		if (sscanf((char*)yytext, "%le", &double_val) != 1) {
		    sprintf(errstr,"bad long or double constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
                return (DOUBLE_CONST);
                }
break;
case 19:

# line 93 "ncgen.l"
{
		if (sscanf((char*)yytext, "%e", &float_val) != 1) {
		    sprintf(errstr,"bad float constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
                return (FLOAT_CONST);
                }
break;
case 20:

# line 100 "ncgen.l"
{
		if (sscanf((char*)yytext, "%hd", &short_val) != 1) {
		    sprintf(errstr,"bad short constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		return (SHORT_CONST);
	        }
break;
case 21:

# line 107 "ncgen.l"
{
#ifdef cray	/* machines where longs have more precision than doubles. */
    		char *ptr;
		long_val = strtol((char*)yytext, &ptr, 0);
		if (ptr == (char*)yytext) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		return (LONG_CONST);
#else		/* machines where doubles have more precision than longs. */
		/*
		 * Because strtol and sscanf with "%ld" may silently give
		 * bad results from undetected overflow for strings like
		 * "30000000000", we scan as double first.
		 */
		double dd;
#ifdef VMS  /* work around bug in VMS strtol() */
		if (STREQ((char*)yytext, "-2147483648")) {
		    long_val = -2147483648;
		    return (LONG_CONST);
		}
#endif /* VMS */
		if (sscanf((char*)yytext, "%le", &dd) != 1) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		if (dd < LONG_MIN  ||  dd > LONG_MAX) {
		    double_val = dd;
		    return DOUBLE_CONST;
		} else {
		    long_val = dd;
		    return LONG_CONST;
		}
#endif /* cray */
	        }
break;
case 22:

# line 142 "ncgen.l"
{
		long dd;
#ifdef VMS  /* work around bug in VMS strtol() */
		if (STREQ((char*)yytext, "-2147483648")) {
		    long_val = -2147483648;
		    return (LONG_CONST);
		}
#endif /* VMS */
		if (sscanf((char*)yytext, "%li", &dd) != 1) {
		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
		    yyerror(errstr);
		}
		long_val = dd;
		return LONG_CONST;
	        }
break;
case 23:

# line 157 "ncgen.l"
         {
	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
		return (BYTE_CONST);
                }
break;
case 24:

# line 161 "ncgen.l"
 {
		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
		return (BYTE_CONST);
                }
break;
case 25:

# line 165 "ncgen.l"
 {
		byte_val = strtol((char*)&yytext[3], (char **) 0, 16);
		return (BYTE_CONST);
                }
break;
case 26:

# line 169 "ncgen.l"
       {
	       switch ((char)yytext[2]) {
	          case 'a': byte_val = '\007'; break; /* not everyone under-
						       * stands '\a' yet */
     	          case 'b': byte_val = '\b'; break;
		  case 'f': byte_val = '\f'; break;
		  case 'n': byte_val = '\n'; break;
		  case 'r': byte_val = '\r'; break;
		  case 't': byte_val = '\t'; break;
		  case 'v': byte_val = '\v'; break;
		  case '\\': byte_val = '\\'; break;
		  case '?': byte_val = '\177'; break;
		  case '\'': byte_val = '\''; break;
		  default: byte_val = (char)yytext[2];
	           }
		return (BYTE_CONST);
                }
break;
case 27:

# line 187 "ncgen.l"
{/* whitespace */ ;
		}
break;
case 28:

# line 189 "ncgen.l"
	return (yytext[0]) ;
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
int yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 102 "lexer.l"
               { /* ignore comment */; }
break;
case 2:

# line 104 "lexer.l"
                 { /* ignore whitespace*/; }
break;
case 3:

# line 106 "lexer.l"
                   { lineno++; return T_newline; }
break;
case 4:

# line 108 "lexer.l"
                    { announce("<T_from>\n"); return T_from; }
break;
case 5:

# line 110 "lexer.l"
                    { announce("<T_into>\n"); return T_into; }
break;
case 6:

# line 112 "lexer.l"
                    { announce("<T_pipe>\n"); return T_pipe; }
break;
case 7:

# line 114 "lexer.l"
               {
			  int token,ok;
			  ok=matchquotes(yytext);
                          yylval.v.string=cleancpystring(yytext);
                          if ( ok  ) {
                            announce1("<T_string(%s)>\n",yylval.v.string);
			    token=T_string;
                          } else {
                            announce1("<T_badstring(%s)>\n",yylval.v.string);
			    fprintf(stderr,"Unterminated string, line %d.\n",
				    lineno);
			    token=T_badstring;
                          } 
                          lineno += countlines(yylval.v.string);
                          return token;
                        }
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 8
0
yylex(){
int nstr; extern int yyprevious;
seek();
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
                {
                        /* Integer */
			yylval.numtok.value = atol (yytext);
//                      sscanf (yytext, "%d", &yylval.numtok.value);
                        yylval.numtok.numline = yylineno;
                        return (NUMBER);
                        }
break;
case 2:
   case 3:
   case 4:
             {
                        /* Real Number */
			yylval.realtok.value = atof (yytext);
//                      sscanf (yytext, "%f", &yylval.realtok.value);
                        yylval.realtok.numline = yylineno;
                        return (REAL_NUMBER);
                        }
break;
case 5:
                   case 6:
                   {
                        /* String */
                        register unsigned char scope_char = *yytext;
                        register char *cptr;

                        strncpy (yylval.strtok.str, yytext+1, MAXSTRING);
                        if ((cptr = strchr (yylval.strtok.str, scope_char)) != NULL)
                                *cptr = '\0';
                        yylval.strtok.strline = yylineno;
                        return (STRING);
                        }
break;
case 7:
                   {
                        /* Identifier, Keyword etc. */
                        register int i;

                        strncpy (yylval.strtok.str, yytext, NAMELEN);
                        /* ist ID ein reserviertes Wort ? */
                        for (i = 0; keywords[i].lx ; i++) {
                                if (!strcmp (keywords[i].id, yylval.strtok.str))
                                        break;
                        }
                        if (keywords[i].lx) {   /* ID ist Schluesselwort */
                                yylval.strtok.strline = yylineno;
                                return (keywords[i].lx);
                        }
                        /* ist ID eine Systemvariable ? */
                        for (i = 0; system_var[i].var_name; ++i) {
                                if (!strcmp (system_var[i].var_name,
                                                        yylval.strtok.str))
                                        break;
                        }
                        if (system_var[i].var_name) {   /* ID ist Systemvar */
                                yylval.numtok.value = system_var[i].var_wert;
                                yylval.numtok.index = i;
                                yylval.numtok.numline = yylineno;
                                return (SYSTEM_VAR);
                        }
                        /* ist ID Systemkonstante ? */
                        for (i = 0; system_const[i].const_name; ++i) {
                                if (!strcmp (system_const[i].const_name,
                                                        yylval.strtok.str))
                                        break;
                        }
                        if (system_const[i].const_name) {       /* ID ist Sys.const */
                                yylval.numtok.value =
                                                (*system_const[i].const_wert)();
                                yylval.numtok.index = i;
                                yylval.numtok.numline = yylineno;
                                return (SYSTEM_CONST);
                        }
                        else {
                        /* Ansonsten ist ID nutzerdefinierter Name */
                                yylval.strtok.strline = yylineno;
                                return (IDENT);
                        }
                        }
break;
case 8:
                     {
                        /* Neue Zeilennummer (Zeile ignorieren) */
                        register int n = 0;
                        register int ch;

	                        while ((ch = input ()) == ' ')
        	                        ;
                	        if (isdigit(ch)) {
                        	        n = 0;
                                	while (isdigit(ch)) {
                                        	n= 10*n + ch - '0';
	                                        ch = input ();
        	                        }
                	                yylineno = n - 1;
                        	}
	                        while ((ch = input ()) != '\n')
        	                        ;
                        }
break;
case 9:
                 return (OROR);
break;
case 10:
                 return (ANDAND);
break;
case 11:
                 return (NE);
break;
case 12:
                 return (LE);
break;
case 13:
                 return (GE);
break;
case 14:
                 return (EQ);
break;
case 15:
                    return (LT);
break;
case 16:
                    return (GT);
break;
case 17:
                    return (UNOT);
break;
case 18:
                    return (EQU);
break;
case 19:
                   comment ("*/");
break;
case 20:
		comment ("\n");
break;
case 21:
               ;
break;
case 22:
                      return (*yytext);
break;
case -1:
break;
default:
r_abort("bad switch yylook");
} return(0); }
Ejemplo n.º 9
0
Archivo: lex.yy.c Proyecto: nd4pa/tp
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
	{;}
break;
case 2:
	{;}
break;
case 3:
	{return TYPE;}
break;
case 4:
{return ENDT;}
break;
case 5:
	{return BODY;}
break;
case 6:
{return ENDB;}
break;
case 7:
	{return INT ;}
break;
case 8:
	{return BOOL;}
break;
case 9:
	{return TRUE;}
break;
case 10:
	{return FALSE;}
break;
case 11:
	{return XOR;}
break;
case 12:
	{return OR;}
break;
case 13:
	{return AND;}
break;
case 14:
	{return NOT;}
break;
case 15:
	{return FM; }
break;
case 16:
	{return FD; }
break;
case 17:
	{return IS;}
break;
case 18:
	{return NS;}
break;
case 19:
	{return MS;}
break;
case 20:
	{return BMS;}
break;
case 21:
	{return EMS;}
break;
case 22:
	{return ES;}
break;
case 23:
	{return TR;}
break;
case 24:
	{return FR;}
break;
case 25:
	{return TO;}
break;
case 26:
	{return ET;}
break;
case 27:
	{return RE;}
break;
case 28:
	{return ER;}
break;
case 29:
	{return AC;}
break;
case 30:
	{return EA;}
break;
case 31:
	{return INF_E;}
break;
case 32:
	{return SUP_E;}
break;
case 33:
	{return NO_EQ;}
break;
case 34:
	{return INF_S;}
break;
case 35:
	{return SUP_S;}
break;
case 36:
	{return EQUAL;}
break;
case 37:
	{return AFFECT;}
break;
case 38:
	{return ADD;}
break;
case 39:
	{return SUB;}
break;
case 40:
	{return DIV;}
break;
case 41:
	{return EXP;}
break;
case 42:
	{return MUL;}
break;
case 43:
	{return MOD;}
break;
case 44:
	{strcpy (yylval.str,yytext);return RELET; }
break;
case 45:
	{strcpy (yylval.str,yytext);return IDENTIFIER;}
break;
case 46:
{sscanf (yytext,"%d",&yylval.val);return INTEGER;}
break;
case 47:
	{strcpy (yylval.str,yytext);return REAL;}
break;
case 48:
	{return yytext [0];}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 10
0
int yylex(void) {

    int   l;

    if (!scan_init) {
      scanner_init();
    }

    if (next_token) {
      l = next_token;
      next_token = 0;
      return l;
    }
    /*    Printf(stdout,"%d\n", last_id);*/
    l = yylook();

    if (l == NONID) {
      last_id = 1;
    } else {
      last_id = 0;
    }
    /*
    yytext[yylen]= 0;
    Printf(stdout,"%d  '%s' %d\n", l, yytext, last_id);
    */

    /* We got some sort of non-white space object.  We set the start_line
       variable unless it has already been set */

    if (!cparse_start_line) {
      cparse_start_line = cparse_line;
    }

    /* Copy the lexene */

    yytext[yylen] = 0;
    switch(l) {

    case NUM_INT:
    case NUM_FLOAT:
    case NUM_ULONG:
    case NUM_LONG:
    case NUM_UNSIGNED:
    case NUM_LONGLONG:
    case NUM_ULONGLONG:
      if (l == NUM_INT) yylval.dtype.type = T_INT;
      if (l == NUM_FLOAT) yylval.dtype.type = T_DOUBLE;
      if (l == NUM_ULONG) yylval.dtype.type = T_ULONG;
      if (l == NUM_LONG) yylval.dtype.type = T_LONG;
      if (l == NUM_UNSIGNED) yylval.dtype.type = T_UINT;
      if (l == NUM_LONGLONG) yylval.dtype.type = T_LONGLONG;
      if (l == NUM_ULONGLONG) yylval.dtype.type = T_ULONGLONG;
      yylval.dtype.val = NewString(yytext);
      yylval.dtype.bitfield = 0;
      yylval.dtype.throws = 0;
      return(l);
      break;
      
    case ID:

	if (yytext[0] != '%') {
	  /* Look for keywords now */
	  
	  if (strcmp(yytext,"int") == 0) {
	    yylval.type = NewSwigType(T_INT);
	    return(TYPE_INT);
	  }
	  if (strcmp(yytext,"double") == 0) {
	    yylval.type = NewSwigType(T_DOUBLE);
	    return(TYPE_DOUBLE);
	  }
	  if (strcmp(yytext,"void") == 0) {
	    yylval.type = NewSwigType(T_VOID);
	    return(TYPE_VOID);
	  }
	  if (strcmp(yytext,"char") == 0) {
	    yylval.type = NewSwigType(T_CHAR);
	    return(TYPE_CHAR);
	  }
	  if (strcmp(yytext,"short") == 0) {
	    yylval.type = NewSwigType(T_SHORT);
	    return(TYPE_SHORT);
	  }
	  if (strcmp(yytext,"long") == 0) {
	    yylval.type = NewSwigType(T_LONG);
	    return(TYPE_LONG);
	  }
	  if (strcmp(yytext,"float") == 0) {
	    yylval.type = NewSwigType(T_FLOAT);
	    return(TYPE_FLOAT);
	  }
	  if (strcmp(yytext,"signed") == 0) {
	    yylval.type = NewSwigType(T_INT);
	    return(TYPE_SIGNED);
	  }
	  if (strcmp(yytext,"unsigned") == 0) {
	    yylval.type = NewSwigType(T_UINT);
	    return(TYPE_UNSIGNED);
	  }
	  if (strcmp(yytext,"bool") == 0) {
	    yylval.type = NewSwigType(T_BOOL);
	    return(TYPE_BOOL);
	  }
	  /* C++ keywords */
	  
	  if (cparse_cplusplus) {
	    if (strcmp(yytext,"class") == 0) return(CLASS);
	    if (strcmp(yytext,"private") == 0) return(PRIVATE);
	    if (strcmp(yytext,"public") == 0) return(PUBLIC);
	    if (strcmp(yytext,"protected") == 0) return(PROTECTED);
	    if (strcmp(yytext,"friend") == 0) return(FRIEND);
	    if (strcmp(yytext,"virtual") == 0) return(VIRTUAL);
	    if (strcmp(yytext,"operator") == 0) {
	      String *s = NewString("operator");
	      int c;
	      int state = 0;
	      int sticky = 0;
	      int isconversion = 0;
	      int count = 0;
	      while ((c = nextchar())) {
		if (((c == '(') || (c == ';')) && state) {
		  retract(1);
		  break;
		}
		count++;
		if (!isspace(c)) {
		  if ((!state) && (isalpha(c))) isconversion = 1;
		  if (!state && !sticky) Putc(' ',s);
		  Putc(c,s);
		  sticky = 0;
		  state = 1;
		} else {
		  if (!sticky) Putc(' ',s);
		  sticky = 1;
		}
	      }
	      Chop(s);
	      yylval.str = s;
	      while(Replaceall(s,"[ ", "["));
	      if (isconversion) {
		String *ns = Swig_symbol_string_qualify(s,0);
		yylval.str = ns;
	      }
	      if (isconversion && !rename_active) {
		char *t = Char(s) + 9;
		if (!((strcmp(t,"new") == 0) || (strcmp(t,"delete") == 0) 
		      || (strcmp(t,"new[]") == 0) || (strcmp(t,"delete[]") == 0))) {
		  /*		  retract(strlen(t));*/
		  retract(count);
		  return COPERATOR;
		}
	      }
	      return(OPERATOR);
	    }
	    if (strcmp(yytext,"throw") == 0) return(THROW);
	    if (strcmp(yytext,"try") == 0) return (yylex());
	    if (strcmp(yytext,"catch") == 0) return (CATCH);
	    if (strcmp(yytext,"inline") == 0) return(yylex());
	    if (strcmp(yytext,"mutable") == 0) return(yylex());
	    if (strcmp(yytext,"explicit") == 0) return(yylex());
	    if (strcmp(yytext,"export") == 0) return(yylex());
	    if (strcmp(yytext,"typename") == 0) return (TYPENAME);
	    if (strcmp(yytext,"template") == 0) {
	      yylval.ivalue = cparse_line;
	      return(TEMPLATE);
	    }
	    if (strcmp(yytext,"delete") == 0) {
	      return(DELETE);
	    }
	    if (strcmp(yytext,"using") == 0) {
	      return(USING);
	    }
	    if (strcmp(yytext,"namespace") == 0) {
	      return(NAMESPACE);
	    }
	  } else {
	    if (strcmp(yytext,"class") == 0) {
	      Swig_warning(WARN_PARSE_CLASS_KEYWORD,cparse_file,cparse_line, "class keyword used, but not in C++ mode.\n");
	    }
	  }
	  
	  /* Objective-C keywords */
#ifdef OBJECTIVEC
	  if ((ObjC) && (yytext[0] == '@')) {
	    if (strcmp(yytext,"@interface") == 0) return (OC_INTERFACE);
	    if (strcmp(yytext,"@end") == 0) return (OC_END);
	    if (strcmp(yytext,"@public") == 0) return (OC_PUBLIC);
	    if (strcmp(yytext,"@private") == 0) return (OC_PRIVATE);
	    if (strcmp(yytext,"@protected") == 0) return (OC_PROTECTED);
	    if (strcmp(yytext,"@class") == 0) return(OC_CLASS);
	    if (strcmp(yytext,"@implementation") == 0) return(OC_IMPLEMENT);
	    if (strcmp(yytext,"@protocol") == 0) return(OC_PROTOCOL);
	  }
#endif
	  
	  /* Misc keywords */
	  
	  if (strcmp(yytext,"extern") == 0) return(EXTERN);
	  if (strcmp(yytext,"const") == 0) return(CONST);
	  if (strcmp(yytext,"static") == 0) return(STATIC);
	  if (strcmp(yytext,"struct") == 0) return(STRUCT);
	  if (strcmp(yytext,"union") == 0) return(UNION);
	  if (strcmp(yytext,"enum") == 0) return(ENUM);
	  if (strcmp(yytext,"sizeof") == 0) return(SIZEOF);
	  
	  if (strcmp(yytext,"typedef") == 0) {
	    yylval.ivalue = 0;
	    return(TYPEDEF);
	  }
	  
	  /* Ignored keywords */
	  
	  if (strcmp(yytext,"volatile") == 0) return(VOLATILE);
	  
	  /* SWIG directives */
	} else {
	  if (strcmp(yytext,"%module") == 0) return(MODULE);
	  if (strcmp(yytext,"%insert") == 0) return(INSERT);
	  if (strcmp(yytext,"%name") == 0) return(NAME);
	  if (strcmp(yytext,"%rename") == 0) {
	    rename_active = 1;
	    return(RENAME);
	  }
	  if (strcmp(yytext,"%namewarn") == 0) {
	    rename_active = 1;
	    return (NAMEWARN);
	  }
	  if (strcmp(yytext,"%includefile") == 0) return(INCLUDE);
	  if (strcmp(yytext,"%val") == 0) {
	    Swig_warning(WARN_DEPRECATED_VAL, cparse_file, cparse_line, "%%val directive deprecated (ignored).\n");
	    return (yylex());
	  }
	  if (strcmp(yytext,"%out") == 0) {
	    Swig_warning(WARN_DEPRECATED_OUT, cparse_file, cparse_line, "%%out directive deprecated (ignored).\n");
	    return(yylex());
	  }
	  if (strcmp(yytext,"%constant") == 0) return(CONSTANT);
	  if (strcmp(yytext,"%typedef") == 0) {
	    yylval.ivalue = 1;
	    return(TYPEDEF);
	  }
	  if (strcmp(yytext,"%native") == 0) return(NATIVE);
	  if (strcmp(yytext,"%pragma") == 0) return(PRAGMA);
	  if (strcmp(yytext,"%extend") == 0) return(EXTEND);
	  if (strcmp(yytext,"%fragment") == 0) return(FRAGMENT);
	  if (strcmp(yytext,"%inline") == 0) return(INLINE);
	  if (strcmp(yytext,"%typemap") == 0) return(TYPEMAP);
	  if (strcmp(yytext,"%feature") == 0) return(FEATURE);
	  if (strcmp(yytext,"%except") == 0) return(EXCEPT);
	  if (strcmp(yytext,"%importfile") == 0) return(IMPORT);
	  if (strcmp(yytext,"%echo") == 0) return(ECHO);
	  if (strcmp(yytext,"%apply") == 0) return(APPLY);
	  if (strcmp(yytext,"%clear") == 0) return(CLEAR);
	  if (strcmp(yytext,"%types") == 0) return(TYPES);
	  if (strcmp(yytext,"%parms") == 0) return(PARMS);
	  if (strcmp(yytext,"%varargs") == 0) return(VARARGS);
	  if (strcmp(yytext,"%template") == 0) return (SWIGTEMPLATE);
	  if (strcmp(yytext,"%warn") == 0) return(WARN);
	}
	/* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */

        /* Need to fix this */
	if (check_typedef) {
	  if (SwigType_istypedef(yytext)) {
	    yylval.type = NewString(yytext);
	    return(TYPE_TYPEDEF);
	  }
	}
	yylval.id = Swig_copy_string(yytext);
	last_id = 1;
	return(ID);
    case POUND:
      return yylex();
    default:
      return(l);
    }
}
Ejemplo n.º 11
0
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 46 "otyscan.l"
;
break;
case 2:

# line 47 "otyscan.l"
GETTOKEN(NEWLINE);
break;
case 3:

# line 48 "otyscan.l"
	GETTOKEN(MSGID);
break;
case 4:

# line 49 "otyscan.l"
	GETTOKEN(TIME);
break;
case 5:

# line 50 "otyscan.l"
	GETTOKEN(CLASS);
break;
case 6:

# line 51 "otyscan.l"
GETTOKEN(ACTION);
break;
case 7:

# line 52 "otyscan.l"
GETTOKEN(OUTPRIOR);
break;
case 8:

# line 53 "otyscan.l"
	GETTOKEN(FREQ);
break;
case 9:

# line 54 "otyscan.l"
GETTOKEN(PROTOTYPE);
break;
case 10:

# line 55 "otyscan.l"
	GETTOKEN(FIELD);
break;
case 11:

# line 56 "otyscan.l"
GETTOKEN(FIELDUP);
break;
case 12:

# line 57 "otyscan.l"
	GETTOKEN(NPVAL);
break;
case 13:

# line 58 "otyscan.l"
	GETTOKEN(WIDTH);
break;
case 14:

# line 59 "otyscan.l"
	GETTOKEN(ENUM);
break;
case 15:

# line 60 "otyscan.l"
GETTOKEN(OUTPUT);
break;
case 16:

# line 61 "otyscan.l"
{
		YYDUMP();
		VERBOSE(stdout, "otyscan: %s", yytext+strlen("otypp: "));
		}
break;
case 17:

# line 65 "otyscan.l"
GETTOKEN(LEFTBRACE);
break;
case 18:

# line 66 "otyscan.l"
GETTOKEN(RIGHTBRACE);
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 12
0
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
		{ comment(); }
break;
case 2:
		{ count(); return(AUTO); }
break;
case 3:
		{ count(); return(BREAK); }
break;
case 4:
		{ count(); return(ELSE); }
break;
case 5:
	{ count(); return(EXTERN); }
break;
case 6:
		{ count(); return(FOR); }
break;
case 7:
		{ count(); return(IF); }
break;
case 8:
		{ count(); return(INT); }
break;
case 9:
		{ count(); return(LONG); }
break;
case 10:
	{ count(); return(REGISTER); }
break;
case 11:
	{ count(); return(RETURN); }
break;
case 12:
		{ count(); return(WHILE); }
break;
case 13:
	{ count(); 
				strncpy(last_ident,yytext,ILEN-1);
				last_ident[ILEN-1] = '\0';
				return(IDENTIFIER); }
break;
case 14:
    		{ count(); 
				kk = atol(yytext);
				return(CONSTANT); }
break;
case 15:
		{ count(); return(RIGHT_ASSIGN); }
break;
case 16:
		{ count(); return(LEFT_ASSIGN); }
break;
case 17:
		{ count(); return(ADD_ASSIGN); }
break;
case 18:
		{ count(); return(SUB_ASSIGN); }
break;
case 19:
		{ count(); return(MUL_ASSIGN); }
break;
case 20:
		{ count(); return(DIV_ASSIGN); }
break;
case 21:
		{ count(); return(MOD_ASSIGN); }
break;
case 22:
		{ count(); return(AND_ASSIGN); }
break;
case 23:
		{ count(); return(XOR_ASSIGN); }
break;
case 24:
		{ count(); return(OR_ASSIGN); }
break;
case 25:
		{ count(); return(RIGHT_OP); }
break;
case 26:
		{ count(); return(LEFT_OP); }
break;
case 27:
		{ count(); return(INC_OP); }
break;
case 28:
		{ count(); return(DEC_OP); }
break;
case 29:
		{ count(); return(AND_OP); }
break;
case 30:
		{ count(); return(OR_OP); }
break;
case 31:
		{ count(); return(LE_OP); }
break;
case 32:
		{ count(); return(GE_OP); }
break;
case 33:
		{ count(); return(EQ_OP); }
break;
case 34:
		{ count(); return(NE_OP); }
break;
case 35:
		{ count(); return(';'); }
break;
case 36:
		{ count(); return('{'); }
break;
case 37:
		{ count(); return('}'); }
break;
case 38:
		{ count(); return(','); }
break;
case 39:
		{ count(); return('='); }
break;
case 40:
		{ count(); return('('); }
break;
case 41:
		{ count(); return(')'); }
break;
case 42:
		{ count(); return('.'); }
break;
case 43:
		{ count(); return('&'); }
break;
case 44:
		{ count(); return('!'); }
break;
case 45:
		{ count(); return('~'); }
break;
case 46:
		{ count(); return('-'); }
break;
case 47:
		{ count(); return('+'); }
break;
case 48:
		{ count(); return('*'); }
break;
case 49:
		{ count(); return('/'); }
break;
case 50:
		{ count(); return('%'); }
break;
case 51:
		{ count(); return('<'); }
break;
case 52:
		{ count(); return('>'); }
break;
case 53:
		{ count(); return('^'); }
break;
case 54:
		{ count(); return('|'); }
break;
case 55:
	{ count(); }
break;
case 56:
		{ /* ignore bad characters */ }
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 13
0
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 33 "mybc.l"
;
break;
case 2:

# line 34 "mybc.l"
{
		YYDUMP();
		yylval.number.value.lvalue = strtol(yytext, (char **)0, 10);
		yylval.number.type = LONG;
		return(LCONST);
		}
break;
case 3:

# line 40 "mybc.l"
{
		YYDUMP();
		yylval.number.value.ulvalue = strtol(yytext+1, (char **)0, 16);
		yylval.number.type = ULONG;
		return(ULCONST);
		}
break;
case 4:

# line 46 "mybc.l"
	{
		YYDUMP();
		yylval.number.value.ulvalue = strtol(yytext+1, (char **)0, 8);
		yylval.number.type = ULONG;
		return(ULCONST);
		}
break;
case 5:

# line 52 "mybc.l"
{
		YYDUMP();
		yylval.number.value.ulvalue = strtol(yytext+1, (char **)0, 2);
		yylval.number.type = ULONG;
		return(ULCONST);
		}
break;
case 6:

# line 58 "mybc.l"
	{
		YYDUMP();
#ifdef SUN
		sscanf(yytext, "%le", &yylval.number.value.dvalue);
#else
		sscanf(yytext, "%e", &yylval.number.value.dvalue);
#endif
		yylval.number.type = DOUBLE;
		return(DCONST);
		}
break;
case 7:

# line 68 "mybc.l"
	GETTOKEN(OR);
break;
case 8:

# line 69 "mybc.l"
	GETTOKEN(AND);
break;
case 9:

# line 70 "mybc.l"
	GETTOKEN(BITOR);
break;
case 10:

# line 71 "mybc.l"
	GETTOKEN(BITXOR);
break;
case 11:

# line 72 "mybc.l"
	GETTOKEN(BITAND);
break;
case 12:

# line 73 "mybc.l"
	GETTOKEN(EQUAL);
break;
case 13:

# line 74 "mybc.l"
	GETTOKEN(NOTEQUAL);
break;
case 14:

# line 75 "mybc.l"
	GETTOKEN(LT);
break;
case 15:

# line 76 "mybc.l"
	GETTOKEN(GT);
break;
case 16:

# line 77 "mybc.l"
	GETTOKEN(LE);
break;
case 17:

# line 78 "mybc.l"
	GETTOKEN(GE);
break;
case 18:

# line 79 "mybc.l"
	GETTOKEN(LSHIFT);
break;
case 19:

# line 80 "mybc.l"
	GETTOKEN(RSHIFT);
break;
case 20:

# line 81 "mybc.l"
	GETTOKEN(PLUS);
break;
case 21:

# line 82 "mybc.l"
	GETTOKEN(MINUS);
break;
case 22:

# line 83 "mybc.l"
	GETTOKEN(STAR);
break;
case 23:

# line 84 "mybc.l"
	GETTOKEN(SLASH);
break;
case 24:

# line 85 "mybc.l"
	GETTOKEN(PERCENT);
break;
case 25:

# line 86 "mybc.l"
	GETTOKEN(LPAREN);
break;
case 26:

# line 87 "mybc.l"
	GETTOKEN(RPAREN);
break;
case 27:

# line 88 "mybc.l"
	GETTOKEN(TILDE);
break;
case 28:

# line 89 "mybc.l"
	GETTOKEN(NOT);
break;
case 29:

# line 90 "mybc.l"
	GETTOKEN(COMMA);
break;
case 30:

# line 91 "mybc.l"
	GETTOKEN(HELP);
break;
case 31:

# line 92 "mybc.l"
{
		YYDUMP();
		if (strcmp(yytext, "l") == 0)
		{
			yylval.type = LONG;
			return(LCAST);
		}
		else if (strcmp(yytext, "ul") == 0)
		{
			yylval.type = ULONG;
			return(ULCAST);
		}
		else if (strcmp(yytext, "d") == 0)
		{
			yylval.type = DOUBLE;
			return(DCAST);
		}
		else if ((strcmp(yytext, "q") == 0) ||
			 (strcmp(yytext, "quit") == 0))
		{
			GETTOKEN(QUIT);
		}
		else if (strcmp(yytext, "ob") == 0)
		{
			GETTOKEN(OUTBASE);
		}
		else if (strcmp(yytext, "exp") == 0)
		{
			GETTOKEN(EXP);
		}
		else if (strcmp(yytext, "log10") == 0)
		{
			GETTOKEN(LOG10);
		}
		else if (strcmp(yytext, "log") == 0)
		{
			GETTOKEN(LOG);
		}
		else if (strcmp(yytext, "pow") == 0)
		{
			GETTOKEN(POW);
		}
		else if (strcmp(yytext, "sqrt") == 0)
		{
			GETTOKEN(SQRT);
		}
		else if (strcmp(yytext, "sin") == 0)
		{
			GETTOKEN(SIN);
		}
		else if (strcmp(yytext, "cos") == 0)
		{
			GETTOKEN(COS);
		}
		else if (strcmp(yytext, "tan") == 0)
		{
			GETTOKEN(TAN);
		}
		else if (strcmp(yytext, "asin") == 0)
		{
			GETTOKEN(ASIN);
		}
		else if (strcmp(yytext, "acos") == 0)
		{
			GETTOKEN(ACOS);
		}
		else if (strcmp(yytext, "atan") == 0)
		{
			GETTOKEN(ATAN);
		}
		else if (strcmp(yytext, "help") == 0)
		{
			GETTOKEN(HELP);
		}
		GETTOKEN(STRING);
		}
break;
case 32:

# line 168 "mybc.l"
GETTOKEN(NEWLINE);
break;
case 33:

# line 169 "mybc.l"
	{
		YYDUMP();
		strcpy(yylval.string, yytext);
		return(*yytext);
		}
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 14
0
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 10 "parse.lex"
	return (INCLUDE);
break;
case 2:

# line 11 "parse.lex"
	return (INPUT);
break;
case 3:

# line 12 "parse.lex"
	return (CLEAR);
break;
case 4:

# line 13 "parse.lex"
	return (LAYOUT);
break;
case 5:

# line 14 "parse.lex"
	return (MENU);
break;
case 6:

# line 15 "parse.lex"
return (KEYBOARD);
break;
case 7:

# line 16 "parse.lex"
return (TRANSLATION);
break;
case 8:

# line 17 "parse.lex"
return (FUNCTION);
break;
case 9:

# line 18 "parse.lex"
	return (VARIABLE);
break;
case 10:

# line 19 "parse.lex"
	return (IF);
break;
case 11:

# line 20 "parse.lex"
	return (ELSEIF);
break;
case 12:

# line 21 "parse.lex"
	return (ELSE);
break;
case 13:

# line 22 "parse.lex"
	return (FI);
break;
case 14:

# line 23 "parse.lex"
	return (DO);
break;
case 15:

# line 24 "parse.lex"
	return (ELSEDO);
break;
case 16:

# line 25 "parse.lex"
	return (OD);
break;
case 17:

# line 26 "parse.lex"
	return (OPTIONS);
break;
case 18:

# line 27 "parse.lex"
	return (PIN);
break;
case 19:

# line 28 "parse.lex"
return (LEFTRIGHT);
break;
case 20:

# line 29 "parse.lex"
return (RIGHTLEFT);
break;
case 21:

# line 30 "parse.lex"
return (SEPARATOR);
break;
case 22:

# line 31 "parse.lex"
	return (TITLE);
break;
case 23:

# line 32 "parse.lex"
	return (DEFAULT);
break;
case 24:

# line 33 "parse.lex"
	return (BUTTON);
break;
case 25:

# line 34 "parse.lex"
	return (IMAGE);
break;
case 26:

# line 35 "parse.lex"
return (SCROLLBAR);
break;
case 27:

# line 36 "parse.lex"
	return (LEFT);
break;
case 28:

# line 37 "parse.lex"
	return (RIGHT);
break;
case 29:

# line 38 "parse.lex"
	return (BOTTOM);
break;
case 30:

# line 39 "parse.lex"
	return (TOP);
break;
case 31:

# line 40 "parse.lex"
return (GEOMETRY);
break;
case 32:

# line 41 "parse.lex"
	return (TYPE);
break;
case 33:

# line 42 "parse.lex"
	return (EDIT);
break;
case 34:

# line 43 "parse.lex"
	return (COMMENT);
break;
case 35:

# line 44 "parse.lex"
	return (PROGRAM);
break;
case 36:

# line 45 "parse.lex"
	return (CONSOLE);
break;
case 37:

# line 46 "parse.lex"
	return (BUFFER);
break;
case 38:

# line 47 "parse.lex"
	return (SYMBOL);
break;
case 39:

# line 48 "parse.lex"
	return (STENCIL);
break;
case 40:

# line 49 "parse.lex"
	return (DEFINE);
break;
case 41:

# line 50 "parse.lex"
return (FINDREPLACE);
break;
case 42:

# line 51 "parse.lex"
	return (ALL);
break;
case 43:

# line 52 "parse.lex"
	return (SHELL);
break;
case 44:

# line 53 "parse.lex"
return (FILESELECT);
break;
case 45:

# line 54 "parse.lex"
	return (REMARK);
break;
case 46:

# line 55 "parse.lex"
	return (NOTEQUAL);
break;
case 47:

# line 56 "parse.lex"
	return (LESSEQUAL);
break;
case 48:

# line 57 "parse.lex"
	return (GREATEREQUAL);
break;
case 49:

# line 58 "parse.lex"
	return (LOGICAND);
break;
case 50:

# line 59 "parse.lex"
	return (LOGICOR);
break;
case 51:

# line 60 "parse.lex"
	return (LOGICXOR);
break;
case 52:

# line 61 "parse.lex"
	return (ASSIGN);
break;
case 53:

# line 62 "parse.lex"
         return (RANGE);
break;
case 54:

# line 63 "parse.lex"
	return (MINUS);
break;
case 55:

# line 64 "parse.lex"
	return (ADD);
break;
case 56:

# line 65 "parse.lex"
	return (MULTIPLY);
break;
case 57:

# line 66 "parse.lex"
	return (DIVIDE);
break;
case 58:

# line 67 "parse.lex"
	return (REMAINDER);
break;
case 59:

# line 68 "parse.lex"
	return (LOGICNOT);
break;
case 60:

# line 69 "parse.lex"
	return (BITNOT);
break;
case 61:

# line 70 "parse.lex"
	return (LAZYREF);
break;
case 62:

# line 71 "parse.lex"
	return (EQUAL);
break;
case 63:

# line 72 "parse.lex"
	return (LESS);
break;
case 64:

# line 73 "parse.lex"
	return (GREATER);
break;
case 65:

# line 74 "parse.lex"
	return (BITOR);
break;
case 66:

# line 75 "parse.lex"
	return (BITAND);
break;
case 67:

# line 76 "parse.lex"
	return (BITXOR);
break;
case 68:

# line 77 "parse.lex"
       { yylval.ival=strtol(yytext,NULL,8); return (INTEGER); }
break;
case 69:

# line 78 "parse.lex"
{ yylval.ival=strtol(yytext,NULL,16); return (INTEGER); }
break;
case 70:

# line 79 "parse.lex"
        { yylval.ival=strtol(yytext,NULL,10); return (INTEGER); }
break;
case 71:

# line 80 "parse.lex"
case 72:

# line 81 "parse.lex"
case 73:

# line 82 "parse.lex"
   case 74:

# line 83 "parse.lex"
case 75:

# line 84 "parse.lex"
{ sscanf(yytext, "%lf", &yylval.rval); return (REAL); }
break;
case 76:

# line 85 "parse.lex"
	{ int i;
		for (i=yyleng-1; i>=0 && yytext[i]=='\\'; i--);
		if ((yyleng-i)%2) {
			char *conv;
			int i;
			Uchar *ucon,*slashconv;
			input();
                        conv=(char*) malloc((yyleng+1)*sizeof(char));
			for (i=0; i<yyleng-1;i++) {
			  conv[i]=yytext[i+1];
			}
			conv[i]=0;
			ucon=LocaletoUstr(conv);
			free(conv);
			slashconv = (Uchar*)malloc((yyleng+1)*sizeof(Uchar));
			convertslash(slashconv, ucon);
			yylval.utval=slashconv;
			return (STRING);
		} else {
			yymore();
		}
		}
break;
case 77:

# line 101 "parse.lex"
	{ int i;
		for (i=yyleng-1; i>=0 && yytext[i]=='\\'; i--);
		if ((yyleng-i)%2) {
			input();
			convertslashascii(yytext, yytext+1, yyleng-1);
			parse_key(yytext, &yylval.keyval.key,
					  &yylval.keyval.mode);
			return (KEY);
		} else {
			yymore();
		}
		}
break;
case 78:

# line 113 "parse.lex"
   case 79:

# line 114 "parse.lex"
case 80:

# line 115 "parse.lex"
{ Uchar b[40];
                  char bc[40];
                  int i;
                  for (i=0; i<yyleng-2 && i<39;i++) {
                     bc[i]=yytext[i+1];
                  }
                  bc[i]=0;
		  convertslash(b,LocaletoUstr(bc));
		  yylval.ival= b[0];
		  return (INTEGER);
           }
break;
case 81:

# line 120 "parse.lex"
{ Type t;
			  t = lookup_type(yytext);
			  if (t) {
			     yylval.ival=t;
			     return (TYPEVAL);
			  }
			  yylval.tval=ident_buffer[current_id++];
			  if (current_id==MAXIDENTIFIER) current_id=0;
                          strncpy(yylval.tval,yytext, IDENTLENGTH-1);
                          return (IDENTIFIER); }
break;
case 82:

# line 130 "parse.lex"
{ int i;
		  if (yytext[yyleng-1]=='*') {
		    input();
		  } else {
		    yymore();
		  }
		}
break;
case 83:

# line 137 "parse.lex"
	;
break;
case 84:

# line 138 "parse.lex"
	return yytext[0];
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 15
0
int
yylex ()
{
  int nstr;
  while ((nstr = yylook ()) >= 0)
    switch (nstr)
      {
      case 0:
	if (yywrap ())
	  return (0);
	break;
      case 1:
	yymark ();
	break;
      case 2:
	yymark ();
	break;
      case 3:
	return (OR);
	break;
      case 4:
	return (AND);
	break;
      case 5:
	return (LE);
	break;
      case 6:
	return (GE);
	break;
      case 7:
	return (EQ);
	break;
      case 8:
	return (DOTS);
	break;
      case 9:
	return screen ();
	break;
      case 10:
	{
	  s_lookup ((ICON));
	  return (ICON);
	}
	break;
      case 11:
	{
	  s_lookup ((RCON));
	  return (RCON);
	}
	break;
      case 12:
	{
	  s_lookup ((ESTRING));
	  return (ESTRING);
	}
	break;
      case 13:
	{
	  s_lookup ((ESTRING));
	  return (ESTRING);
	}
	break;
      case 14:
	;
	break;
      case 15:
	return ((yytext[0]));
	break;
      case -1:
	break;
      default:
	fprintf (yyout, "bad switch yylook %d", nstr);
      }
  return (0);
}
Ejemplo n.º 16
0
int yylex(void) {

  int l;
  char *yytext;

  if (!scan_init) {
    scanner_init();
  }

  if (next_token) {
    l = next_token;
    next_token = 0;
    return l;
  }

  l = yylook();

  /*   Printf(stdout, "%s:%d:::%d: '%s'\n", cparse_file, cparse_line, l, Scanner_text(scan)); */

  if (l == NONID) {
    last_id = 1;
  } else {
    last_id = 0;
  }

  /* We got some sort of non-white space object.  We set the start_line
     variable unless it has already been set */

  if (!cparse_start_line) {
    cparse_start_line = cparse_line;
  }

  /* Copy the lexene */

  switch (l) {

  case NUM_INT:
  case NUM_FLOAT:
  case NUM_ULONG:
  case NUM_LONG:
  case NUM_UNSIGNED:
  case NUM_LONGLONG:
  case NUM_ULONGLONG:
  case NUM_BOOL:
    if (l == NUM_INT)
      yylval.dtype.type = T_INT;
    if (l == NUM_FLOAT)
      yylval.dtype.type = T_DOUBLE;
    if (l == NUM_ULONG)
      yylval.dtype.type = T_ULONG;
    if (l == NUM_LONG)
      yylval.dtype.type = T_LONG;
    if (l == NUM_UNSIGNED)
      yylval.dtype.type = T_UINT;
    if (l == NUM_LONGLONG)
      yylval.dtype.type = T_LONGLONG;
    if (l == NUM_ULONGLONG)
      yylval.dtype.type = T_ULONGLONG;
    if (l == NUM_BOOL)
      yylval.dtype.type = T_BOOL;
    yylval.dtype.val = NewString(Scanner_text(scan));
    yylval.dtype.bitfield = 0;
    yylval.dtype.throws = 0;
    return (l);

  case ID:
    yytext = Char(Scanner_text(scan));
    if (yytext[0] != '%') {
      /* Look for keywords now */

      if (strcmp(yytext, "int") == 0) {
	yylval.type = NewSwigType(T_INT);
	return (TYPE_INT);
      }
      if (strcmp(yytext, "double") == 0) {
	yylval.type = NewSwigType(T_DOUBLE);
	return (TYPE_DOUBLE);
      }
      if (strcmp(yytext, "void") == 0) {
	yylval.type = NewSwigType(T_VOID);
	return (TYPE_VOID);
      }
      if (strcmp(yytext, "char") == 0) {
	yylval.type = NewSwigType(T_CHAR);
	return (TYPE_CHAR);
      }
      if (strcmp(yytext, "wchar_t") == 0) {
	yylval.type = NewSwigType(T_WCHAR);
	return (TYPE_WCHAR);
      }
      if (strcmp(yytext, "short") == 0) {
	yylval.type = NewSwigType(T_SHORT);
	return (TYPE_SHORT);
      }
      if (strcmp(yytext, "long") == 0) {
	yylval.type = NewSwigType(T_LONG);
	return (TYPE_LONG);
      }
      if (strcmp(yytext, "float") == 0) {
	yylval.type = NewSwigType(T_FLOAT);
	return (TYPE_FLOAT);
      }
      if (strcmp(yytext, "signed") == 0) {
	yylval.type = NewSwigType(T_INT);
	return (TYPE_SIGNED);
      }
      if (strcmp(yytext, "unsigned") == 0) {
	yylval.type = NewSwigType(T_UINT);
	return (TYPE_UNSIGNED);
      }
      if (strcmp(yytext, "bool") == 0) {
	yylval.type = NewSwigType(T_BOOL);
	return (TYPE_BOOL);
      }

      /* Non ISO (Windows) C extensions */
      if (strcmp(yytext, "__int8") == 0) {
	yylval.type = NewString(yytext);
	return (TYPE_NON_ISO_INT8);
      }
      if (strcmp(yytext, "__int16") == 0) {
	yylval.type = NewString(yytext);
	return (TYPE_NON_ISO_INT16);
      }
      if (strcmp(yytext, "__int32") == 0) {
	yylval.type = NewString(yytext);
	return (TYPE_NON_ISO_INT32);
      }
      if (strcmp(yytext, "__int64") == 0) {
	yylval.type = NewString(yytext);
	return (TYPE_NON_ISO_INT64);
      }

      /* C++ keywords */
      if (cparse_cplusplus) {
	if (strcmp(yytext, "and") == 0)
	  return (LAND);
	if (strcmp(yytext, "or") == 0)
	  return (LOR);
	if (strcmp(yytext, "not") == 0)
	  return (LNOT);
	if (strcmp(yytext, "class") == 0)
	  return (CLASS);
	if (strcmp(yytext, "private") == 0)
	  return (PRIVATE);
	if (strcmp(yytext, "public") == 0)
	  return (PUBLIC);
	if (strcmp(yytext, "protected") == 0)
	  return (PROTECTED);
	if (strcmp(yytext, "friend") == 0)
	  return (FRIEND);
	if (strcmp(yytext, "virtual") == 0)
	  return (VIRTUAL);
	if (strcmp(yytext, "operator") == 0) {
	  int nexttok;
	  String *s = NewString("operator ");

	  /* If we have an operator, we have to collect the operator symbol and attach it to
             the operator identifier.   To do this, we need to scan ahead by several tokens.
             Cases include:

             (1) If the next token is an operator as determined by Scanner_isoperator(),
                 it means that the operator applies to one of the standard C++ mathematical,
                 assignment, or logical operator symbols (e.g., '+','<=','==','&', etc.)
                 In this case, we merely append the symbol text to the operator string above.

             (2) If the next token is (, we look for ).  This is operator ().
             (3) If the next token is [, we look for ].  This is operator [].
	     (4) If the next token is an identifier.  The operator is possibly a conversion operator.
                      (a) Must check for special case new[] and delete[]

             Error handling is somewhat tricky here.  We'll try to back out gracefully if we can.
 
	  */

	  nexttok = Scanner_token(scan);
	  if (Scanner_isoperator(nexttok)) {
	    /* One of the standard C/C++ symbolic operators */
	    Append(s,Scanner_text(scan));
	    yylval.str = s;
	    return OPERATOR;
	  } else if (nexttok == SWIG_TOKEN_LPAREN) {
	    /* Function call operator.  The next token MUST be a RPAREN */
	    nexttok = Scanner_token(scan);
	    if (nexttok != SWIG_TOKEN_RPAREN) {
	      Swig_error(Scanner_file(scan),Scanner_line(scan),"Syntax error. Bad operator name.\n");
	    } else {
	      Append(s,"()");
	      yylval.str = s;
	      return OPERATOR;
	    }
	  } else if (nexttok == SWIG_TOKEN_LBRACKET) {
	    /* Array access operator.  The next token MUST be a RBRACKET */
	    nexttok = Scanner_token(scan);
	    if (nexttok != SWIG_TOKEN_RBRACKET) {
	      Swig_error(Scanner_file(scan),Scanner_line(scan),"Syntax error. Bad operator name.\n");	      
	    } else {
	      Append(s,"[]");
	      yylval.str = s;
	      return OPERATOR;
	    }
	  } else if (nexttok == SWIG_TOKEN_ID) {
	    /* We have an identifier.  This could be any number of things. It could be a named version of
               an operator (e.g., 'and_eq') or it could be a conversion operator.   To deal with this, we're
               going to read tokens until we encounter a ( or ;.  Some care is needed for formatting. */
	    int needspace = 1;
	    int termtoken = 0;
	    const char *termvalue = 0;

	    Append(s,Scanner_text(scan));
	    while (1) {

	      nexttok = Scanner_token(scan);
	      if (nexttok <= 0) {
		Swig_error(Scanner_file(scan),Scanner_line(scan),"Syntax error. Bad operator name.\n");	      
	      }
	      if (nexttok == SWIG_TOKEN_LPAREN) {
		termtoken = SWIG_TOKEN_LPAREN;
		termvalue = "(";
		break;
              } else if (nexttok == SWIG_TOKEN_CODEBLOCK) {
                termtoken = SWIG_TOKEN_CODEBLOCK;
                termvalue = Char(Scanner_text(scan));
                break;
              } else if (nexttok == SWIG_TOKEN_LBRACE) {
                termtoken = SWIG_TOKEN_LBRACE;
                termvalue = "{";
                break;
              } else if (nexttok == SWIG_TOKEN_SEMI) {
		termtoken = SWIG_TOKEN_SEMI;
		termvalue = ";";
		break;
              } else if (nexttok == SWIG_TOKEN_STRING) {
		termtoken = SWIG_TOKEN_STRING;
                termvalue = Swig_copy_string(Char(Scanner_text(scan)));
		break;
	      } else if (nexttok == SWIG_TOKEN_ID) {
		if (needspace) {
		  Append(s," ");
		}
		Append(s,Scanner_text(scan));
	      } else {
		Append(s,Scanner_text(scan));
		needspace = 0;
	      }
	    }
	    yylval.str = s;
	    if (!rename_active) {
	      String *cs;
	      char *t = Char(s) + 9;
	      if (!((strcmp(t, "new") == 0)
		    || (strcmp(t, "delete") == 0)
		    || (strcmp(t, "new[]") == 0)
		    || (strcmp(t, "delete[]") == 0)
		    || (strcmp(t, "and") == 0)
		    || (strcmp(t, "and_eq") == 0)
		    || (strcmp(t, "bitand") == 0)
		    || (strcmp(t, "bitor") == 0)
		    || (strcmp(t, "compl") == 0)
		    || (strcmp(t, "not") == 0)
		    || (strcmp(t, "not_eq") == 0)
		    || (strcmp(t, "or") == 0)
		    || (strcmp(t, "or_eq") == 0)
		    || (strcmp(t, "xor") == 0)
		    || (strcmp(t, "xor_eq") == 0)
		    )) {
		/*              retract(strlen(t)); */

		/* The operator is a conversion operator.   In order to deal with this, we need to feed the
                   type information back into the parser.  For now this is a hack.  Needs to be cleaned up later. */
		cs = NewString(t);
		if (termtoken) Append(cs,termvalue);
		Seek(cs,0,SEEK_SET);
		Setline(cs,cparse_line);
		Setfile(cs,cparse_file);
		Scanner_push(scan,cs);
		Delete(cs);
		return COPERATOR;
	      }
	    }
	    if (termtoken)
              Scanner_pushtoken(scan, termtoken, termvalue);
	    return (OPERATOR);
	  }
	}
	if (strcmp(yytext, "throw") == 0)
	  return (THROW);
	if (strcmp(yytext, "try") == 0)
	  return (yylex());
	if (strcmp(yytext, "catch") == 0)
	  return (CATCH);
	if (strcmp(yytext, "inline") == 0)
	  return (yylex());
	if (strcmp(yytext, "mutable") == 0)
	  return (yylex());
	if (strcmp(yytext, "explicit") == 0)
	  return (EXPLICIT);
	if (strcmp(yytext, "export") == 0)
	  return (yylex());
	if (strcmp(yytext, "typename") == 0)
	  return (TYPENAME);
	if (strcmp(yytext, "template") == 0) {
	  yylval.ivalue = cparse_line;
	  return (TEMPLATE);
	}
	if (strcmp(yytext, "delete") == 0) {
	  return (DELETE_KW);
	}
	if (strcmp(yytext, "using") == 0) {
	  return (USING);
	}
	if (strcmp(yytext, "namespace") == 0) {
	  return (NAMESPACE);
	}
      } else {
	if (strcmp(yytext, "class") == 0) {
	  Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
	}
	if (strcmp(yytext, "complex") == 0) {
	  yylval.type = NewSwigType(T_COMPLEX);
	  return (TYPE_COMPLEX);
	}
	if (strcmp(yytext, "restrict") == 0)
	  return (yylex());
      }

      /* Misc keywords */

      if (strcmp(yytext, "extern") == 0)
	return (EXTERN);
      if (strcmp(yytext, "const") == 0)
	return (CONST_QUAL);
      if (strcmp(yytext, "static") == 0)
	return (STATIC);
      if (strcmp(yytext, "struct") == 0)
	return (STRUCT);
      if (strcmp(yytext, "union") == 0)
	return (UNION);
      if (strcmp(yytext, "enum") == 0)
	return (ENUM);
      if (strcmp(yytext, "sizeof") == 0)
	return (SIZEOF);

      if (strcmp(yytext, "typedef") == 0) {
	yylval.ivalue = 0;
	return (TYPEDEF);
      }

      /* Ignored keywords */

      if (strcmp(yytext, "volatile") == 0)
	return (VOLATILE);
      if (strcmp(yytext, "register") == 0)
	return (REGISTER);
      if (strcmp(yytext, "inline") == 0)
	return (yylex());

      /* SWIG directives */
    } else {
      if (strcmp(yytext, "%module") == 0)
	return (MODULE);
      if (strcmp(yytext, "%insert") == 0)
	return (INSERT);
      if (strcmp(yytext, "%name") == 0)
	return (NAME);
      if (strcmp(yytext, "%rename") == 0) {
	rename_active = 1;
	return (RENAME);
      }
      if (strcmp(yytext, "%namewarn") == 0) {
	rename_active = 1;
	return (NAMEWARN);
      }
      if (strcmp(yytext, "%includefile") == 0)
	return (INCLUDE);
      if (strcmp(yytext, "%val") == 0) {
	Swig_warning(WARN_DEPRECATED_VAL, cparse_file, cparse_line, "%%val directive deprecated (ignored).\n");
	return (yylex());
      }
      if (strcmp(yytext, "%out") == 0) {
	Swig_warning(WARN_DEPRECATED_OUT, cparse_file, cparse_line, "%%out directive deprecated (ignored).\n");
	return (yylex());
      }
      if (strcmp(yytext, "%constant") == 0)
	return (CONSTANT);
      if (strcmp(yytext, "%typedef") == 0) {
	yylval.ivalue = 1;
	return (TYPEDEF);
      }
      if (strcmp(yytext, "%native") == 0)
	return (NATIVE);
      if (strcmp(yytext, "%pragma") == 0)
	return (PRAGMA);
      if (strcmp(yytext, "%extend") == 0)
	return (EXTEND);
      if (strcmp(yytext, "%fragment") == 0)
	return (FRAGMENT);
      if (strcmp(yytext, "%inline") == 0)
	return (INLINE);
      if (strcmp(yytext, "%typemap") == 0)
	return (TYPEMAP);
      if (strcmp(yytext, "%feature") == 0) {
        /* The rename_active indicates we don't need the information of the 
         * following function's return type. This applied for %rename, so do
         * %feature. 
         */
        rename_active = 1;
	return (FEATURE);
      }
      if (strcmp(yytext, "%except") == 0)
	return (EXCEPT);
      if (strcmp(yytext, "%importfile") == 0)
	return (IMPORT);
      if (strcmp(yytext, "%echo") == 0)
	return (ECHO);
      if (strcmp(yytext, "%apply") == 0)
	return (APPLY);
      if (strcmp(yytext, "%clear") == 0)
	return (CLEAR);
      if (strcmp(yytext, "%types") == 0)
	return (TYPES);
      if (strcmp(yytext, "%parms") == 0)
	return (PARMS);
      if (strcmp(yytext, "%varargs") == 0)
	return (VARARGS);
      if (strcmp(yytext, "%template") == 0) {
	return (SWIGTEMPLATE);
      }
      if (strcmp(yytext, "%warn") == 0)
	return (WARN);
    }
    /* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */

    /* Need to fix this */
    if (check_typedef) {
      if (SwigType_istypedef(yytext)) {
	yylval.type = NewString(yytext);
	return (TYPE_TYPEDEF);
      }
    }
    yylval.id = Swig_copy_string(yytext);
    last_id = 1;
    return (ID);
  case POUND:
    return yylex();
  default:
    return (l);
  }
}
Ejemplo n.º 17
0
yylex(){
   int nstr; extern int yyprevious;
   while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
   if(yywrap()) return(0); break;
case 1:
	{eot(); return(PLUS);}
break;
case 2:
	{eot(); return(MINUS);}
break;
case 3:
	{eot(); return(ASTERISK);}
break;
case 4:
	{eot(); return(SLASH);}
break;
case 5:
	{eot(); return(ASSIGN);}
break;
case 6:
	{eot(); return(AMPERSAND);}
break;
case 7:
	{eot(); return(DOT);}
break;
case 8:
	{eot(); return(COMMA);}
break;
case 9:
	{eot(); return(SEMICOLON);}
break;
case 10:
	{eot(); return(LPAREN);}
break;
case 11:
	{eot(); return(LBRACKET);}
break;
case 12:
	{eot(); return(LBRACE);}
break;
case 13:
	{eot(); return(UPARROW);}
break;
case 14:
	{eot(); return(EQUAL);}
break;
case 15:
             {eot(); return(RARROW);}
break;
case 16:
	{eot(); return(SHARP);}
break;
case 17:
	{eot(); return(LESS);}
break;
case 18:
	{eot(); return(GREATER);}
break;
case 19:
	{eot(); return(LSEQUAL);}
break;
case 20:
             {eot(); return(SUBTYPE);}
break;
case 21:
	{eot(); return(GREQUAL);}
break;
case 22:
	{eot(); return(DOTDOT);}
break;
case 23:
	{eot(); return(COLON);}
break;
case 24:
	{eot(); return(RPAREN);}
break;
case 25:
	{eot(); return(RBRACKET);}
break;
case 26:
	{eot(); return(RBRACE);}
break;
case 27:
	{eot(); return(BAR);}
break;
case 28:
{PTRKEYWORDENTRY tempp;
				 eot();
				 if ((tempp=lookup(yytext))!=NULL){
					return(tempp->lexval);}
				 else {
					strcpy(lastident, yytext);
					return(IDENT);
				     }
				}
break;
case 29:
       {eot(); return(CARD_CONST);}
break;
case 30:
{eot(); return(REAL_CONST);}
break;
case 31:
{
				 eot();
				 return(STR_CONST);}
break;
case 32:
{
				 eot();
				 return(STR_CONST);}
break;
case 33:
 		{eot(); eol();}
break;
case 34:
	{eot(); }
break;
case 35:
	/* other spaces */ /* putchar(' ')*/ eot();
break;
case 36:
{eot(); BEGIN Com;  comdepth=1; }
break;
case 37:
{eot(); comdepth++; }
break;
case 38:
{eot(); comdepth--; if (comdepth==0) BEGIN Prog; }
break;
case 39:
{eot(); BEGIN Prag;  pragdepth=1; }
break;
case 40:
{eot(); pragdepth++; }
break;
case 41:
{eot(); pragdepth--; if (pragdepth==0) BEGIN Prog; }
break;
case 42:
 		{eot(); eol();}
break;
case 43:
 		{eot(); eol();}
break;
case 44:
	{eot();}
break;
case 45:
	{eot();}
break;
case 46:
	{yyless(0); BEGIN Prog;}
break;
case -1:
break;
default:
   fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 18
0
int yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 45 "shell.l"
 { return NEWLINE; }
break;
case 2:

# line 47 "shell.l"
 { /* Discard spaces and tabs */ }
break;
case 3:

# line 49 "shell.l"
 { return AMPERSAND; }
break;
case 4:

# line 51 "shell.l"
 { return GREAT; }
break;
case 5:

# line 53 "shell.l"
 { return GREATAMPERSAND; }
break;
case 6:

# line 55 "shell.l"
 { return GREATGREAT; }
break;
case 7:

# line 57 "shell.l"
 { return GREATGREATAMPERSAND; }
break;
case 8:

# line 59 "shell.l"
 { return LESS; }
break;
case 9:

# line 61 "shell.l"
 { return PIPE; }
break;
case 10:

# line 63 "shell.l"
 {
    yylval.string_val = strdup(yytext+1);
    yylval.string_val[strlen(yylval.string_val) - 1] = '\0';
    return WORD;
}
break;
case 11:

# line 69 "shell.l"
 {
    yylval.string_val = strdup(yytext+1);
    yylval.string_val[strlen(yylval.string_val) - 1] = '\0';
    return WORD;
}
break;
case 12:

# line 75 "shell.l"
 {
    char *buff = strdup(yytext);
    char *word = (char*)malloc(strlen(yytext) + 1);
    
    int j;
    j = 0;

    int i;
    i = 0;
    while (i < strlen(buff) + 1)
    {
        if (buff[i] == '\\')
        {
            word[j] = buff[i+1];
            i = i + 2;
        }
        else
        {
            word[j] = buff[i];
            i++;
        }

        j++;
    }

    yylval.string_val = strdup(word);
    return WORD;
}
break;
case 13:

# line 104 "shell.l"
 {
    return NOTOKEN;
}
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 19
0
Archivo: stablex.c Proyecto: ombt/ombt
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 35 "stab.l"
MYECHO;
break;
case 2:

# line 36 "stab.l"
MYECHO;
break;
case 3:

# line 37 "stab.l"
	{
		MYECHO;
		YYDUMP();
		strcpy(yylval.string, yytext);
		if (strlen(yytext) == 1)
			return(*yytext);
		else
			return(NAME);
		}
break;
case 4:

# line 46 "stab.l"
GETTOKEN(STRING);
break;
case 5:

# line 47 "stab.l"
	GETTOKEN(REAL);
break;
case 6:

# line 48 "stab.l"
GETTOKEN(INTEGER);
break;
case 7:

# line 49 "stab.l"
GETTOKEN(HEXADECIMAL);
break;
case 8:

# line 50 "stab.l"
	{
		MYECHO;
		YYDUMP();
		strcpy(yylval.string, yytext);
		return(*yytext);
		}
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 20
0
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
{}
break;
case 2:
{Cid = enter(0,yytext,yyleng); 
		 if (LexDebug)
		   {
		     printf("%s : %s (%d)\n",
			    yytext,
			    ((Cid->tokentype) ? "RESERVED" : "IDENTIFIER"),
			    Cid->count);
		   }
		 if (Cid->tokentype)
		   {
		     return(Cid->tokentype);
		   }
		 else
		   {
		     yyint = Cid->value;
		     return(R_ID);
		   }
	       }
break;
case 3:
        {if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "REAL");
			   }
			 return(R_REAL);
		       }
break;
case 4:
{if (LexDebug)
			   {             
			     printf("%s : %s\n", yytext, "INTEGER");
			   }
			 yyint = atoi(yytext);
			 return(R_INTEGER);}
break;
case 5:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "(HEX)INTEGER");
			   }
			 yyint = strtol(yytext+2,NULL,16);
			 return(R_INTEGER);}
break;
case 6:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "(HEX)INTEGER");
			   }
			 yyint = strtol(yytext,NULL,16);
			 return(R_INTEGER);}
break;
case 7:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "(OCT)INTEGER");
			   }
			 yyint = strtol(yytext+2,NULL,8);
			 return(R_INTEGER);}
break;
case 8:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "(OCT)INTEGER");
			   }
			 yyint = strtol(yytext,NULL,8);
			 return(R_INTEGER);}
break;
case 9:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "(CHAR)INTEGER");
			   }
			 if (yyleng>4)
			   {
			     yyint = strtol(yytext+2,NULL,8);
			   }
			 else
			   {
			     if (*(yytext+1)=='\\')
			       {
				 switch(*(yytext+2))
				   {
				   case '0':
				     yyint=0;
				     break;
				   case 'b':
				     yyint = 0x8;
				     break;
				   case 'i':
				     yyint = 0x9;
				     break;
				   case 'n':
				     yyint = 0xa;
				     break;
				   case 'v':
				     yyint = 0xb;
				     break;
				   case 'f':
				     yyint = 0xc;
				     break;
				   case 'r':
				     yyint = 0xd;
				     break;
				   default:
				     yyint=(*yytext+2);
				     break;
				   }
			       }
			     else
			       {
				 yyint = *(yytext+1);
			       }
			   }
			 return(R_INTEGER);}
break;
case 10:
        {if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "LBRACKET");
			   }
			 return(R_LBRACKET);}
break;
case 11:
        {if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "RBRACKET");
			   }
			 return(R_RBRACKET);}
break;
case 12:
{if (LexDebug)
			   {
			     printf("%s : %s\n", yytext, "STRING");
			   }
			 return(R_STRING);}
break;
case 13:
{CommentDepth++; BEGIN COMMENT;}
break;
case 14:
	{CommentDepth--;if(!CommentDepth) BEGIN NORMAL;}
break;
case 15:
  	  	{
		  	    /* None of the above rules applicable, so
			       it's a bad symbol. */
                              printf("Bad input char '%c' on line %d\n",
  	  	  	  	    yytext[0],
  	  	  	  	    yylineno);
  	  	  	}
break;
case 16:
	{}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 21
0
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
{ }
break;
case 2:
 {
    yylval.typed.ru.charptr = reader_get_symbol_with_quotes(yytext);
    return SYMBOL;
}
break;
case 3:
   {
    yylval.typed.ru.integer = 0;
    return OPEN_PAREN;
}
break;
case 4:
 {
    yylval.typed.ru.integer = 0;
    return CLOSE_PAREN;
}
break;
case 5:
 {
    yylval.typed.ru.integer = 0;
    return OPEN_SQUARE;
}
break;
case 6:
{
    yylval.typed.ru.integer = 0;
    return CLOSE_SQUARE;
}
break;
case 7:
   {
    yylval.typed.ru.integer = 0;
    return OPEN_BRACE;
}
break;
case 8:
 {
    yylval.typed.ru.integer = 0;
    return CLOSE_BRACE;
}
break;
case 9:
{
    
    yylval.typed.ru.real = atof(yytext);
    return FLOAT;
}
break;
case 10:
 {
    sscanf(yytext+2,"%x",&(yylval.typed.ru.integer));
    return INTEGER;
}
break;
case 11:
 {
    sscanf(yytext+2,"%o",&(yylval.typed.ru.integer));
    return INTEGER;
}
break;
case 12:
 {
    sscanf(yytext,"%d",&(yylval.typed.ru.integer));
    return INTEGER;
}
break;
case 13:
  {
    yylval.typed.ru.integer = yytext[0];
    return MULOP;
}
break;
case 14:
  {
    yylval.typed.ru.integer = yytext[0];
    return ADDOP;
}
break;
case 15:
{
    yylval.typed.ru.integer = yytext[0];
    return SHIFTOP;
}
break;
case 16:
  {
    yylval.typed.ru.integer = (yytext[0] == '=');
    return EQOP;
}
break;
case 17:
  {
    yylval.typed.ru.integer = (yytext[1] == '=');
    return LTOP;
}
break;
case 18:
  {
    yylval.typed.ru.integer = (yytext[1] == '=');
    return GTOP;
}
break;
case 19:
 {
    yylval.typed.ru.integer = yytext[0];
    return BITAOP;
}
break;
case 20:
 {
    yylval.typed.ru.integer = yytext[0];
    return BITXOP;
}
break;
case 21:
 {
    yylval.typed.ru.integer = yytext[0];
    return BITIOP;
}
break;
case 22:
  {
    yylval.typed.ru.integer = yytext[0];
    return ANDOP;
}
break;
case 23:
   {
    yylval.typed.ru.integer = yytext[0];
    return OROP;
}
break;
case 24:
   {
    yylval.typed.ru.integer = yytext[0];
    return NOTOP;
}
break;
case 25:
{
    yylval.typed.ru.integer = yytext[0];
    return QUESTOP;
}
break;
case 26:
{
    yylval.typed.ru.integer = yytext[0];
    return COLONOP;
}
break;
case 27:
        {
    yylval.typed.ru.integer = 1;
    return INTEGER;
}
break;
case 28:
      {
    yylval.typed.ru.integer = 0;
    return INTEGER;
}
break;
case 29:
     {
    yylval.typed.ru.charptr = reader_get_symbol(yytext);
    if (reader_get_symbol_value(yylval.typed.ru.charptr))
      return MACRO_SYMBOL;
    else
      return SYMBOL;
}
break;
case 30:
  ;
break;
case 31:
{
    reader_lex_line_count++;
}
break;
case 32:
    {
    if (!reader_dot_warning_given)
    {
	yyerror("Warning: . encountered (ignored)");
	reader_dot_warning_given = 1;
    }
}
break;
case 33:
        {
    printf("Lex error on line %d.  ??? %s ???\n",
	   reader_lex_line_count, yytext);
    exit(1);
}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 22
0
yylex(){
int nstr; extern int yyprevious;
#ifdef LINUX
  if ( ! yyin)
    yyin = stdin;
  if ( ! yyout)
    yyout = stdout;
#endif
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 92 "magic.lex.l"
                           { LPRINT0("lex: exhausted, suspending!\n");
				  return(-1);
				}
break;
case 2:

# line 95 "magic.lex.l"
                           { LPRINT0("lex: got \"^D\", ENDFILE\n");
				  returnToken(ENDFILE);
				}
break;
case 3:

# line 98 "magic.lex.l"
                           { LPRINT0("lex: got \"{\", LC\n");
				  returnToken(DOLLAR);
				}
break;
case 4:

# line 101 "magic.lex.l"
                             { LPRINT0("lex: got \"{\", LC\n");
				  returnToken(LC);
				}
break;
case 5:

# line 104 "magic.lex.l"
                             { LPRINT0("lex: got \"}\", RC\n");
				  returnToken(RC);
				}
break;
case 6:

# line 107 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", CL\n",yytext);
				  returnToken(CL);
				}
break;
case 7:

# line 110 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", CM\n",yytext);
				  returnToken(CM);
				}
break;
case 8:

# line 113 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", EQ\n",yytext);
				  returnToken(EQ);
				}
break;
case 9:

# line 116 "magic.lex.l"
                           { LPRINT1("lex: got \"%s\", NE\n",yytext);
				  returnToken(NE);
				}
break;
case 10:

# line 119 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", LT\n",yytext);
				  returnToken(LT);
				}
break;
case 11:

# line 122 "magic.lex.l"
                           { LPRINT1("lex: got \"%s\", LE\n",yytext);
				  returnToken(LE);
				}
break;
case 12:

# line 125 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", GT\n",yytext);
				  returnToken(GT);
				}
break;
case 13:

# line 128 "magic.lex.l"
                           { LPRINT1("lex: got \"%s\", GE\n",yytext);
				  returnToken(GE);
				}
break;
case 14:

# line 131 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", PLUS\n",yytext);
				  returnToken(PLUS);
				}
break;
case 15:

# line 134 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", MINUS\n",yytext);
				  returnToken(MINUS);
				}
break;
case 16:

# line 137 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", MULT\n",yytext);
				  returnToken(MULT);
				}
break;
case 17:

# line 140 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", DIV\n",yytext);
				  returnToken(DIV);
				}
break;
case 18:

# line 143 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", LP\n",yytext);
				  returnToken(LP);
				}
break;
case 19:

# line 146 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", LB\n",yytext);
				  returnToken(LB);
				}
break;
case 20:

# line 149 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", RB\n",yytext);
				  returnToken(RB);
				}
break;
case 21:

# line 152 "magic.lex.l"
                            { LPRINT1("lex: got \"%s\", RP\n",yytext);
				  returnToken(RP);
				}
break;
case 22:

# line 155 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", ABORT\n",yytext);
				  returnToken(BOMB);
				}
break;
case 23:

# line 158 "magic.lex.l"
	{ LPRINT1("lex: got \"%s\",ABORTOFF\n",yytext);
				  returnToken(IGNORE);
				}
break;
case 24:

# line 161 "magic.lex.l"
                { LPRINT1("lex: got \"%s\", ABORTON\n",yytext);
				  returnToken(DONT);
				}
break;
case 25:

# line 164 "magic.lex.l"
                        { LPRINT1("lex: got \"%s\", AND\n",yytext);
				  returnToken(AND);
				}
break;
case 26:

# line 167 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", BREAK\n",yytext);
				  returnToken(BREAK);
				}
break;
case 27:

# line 170 "magic.lex.l"
                          { LPRINT1("lex: got \"%s\", DO\n",yytext);
				  returnToken(DO);
				}
break;
case 28:

# line 173 "magic.lex.l"
                      { LPRINT1("lex: got \"%s\", ELSE\n",yytext);
				  returnToken(ELSE);
				}
break;
case 29:

# line 176 "magic.lex.l"
                  { LPRINT1("lex: got \"%s\", ELSEIF\n",yytext);
				  returnToken(ELSEIF);
				}
break;
case 30:

# line 179 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", FI\n",yytext);
				  returnToken(FI);
				}
break;
case 31:

# line 182 "magic.lex.l"
              { LPRINT1("lex: got \"%s\", OD\n",yytext);
				  returnToken(OD);
				}
break;
case 32:

# line 185 "magic.lex.l"
                  { LPRINT1("lex: got \"%s\", RETURN\n",yytext);
				  returnToken(EXIT);
				}
break;
case 33:

# line 188 "magic.lex.l"
                          { LPRINT1("lex: got \"%s\", IF\n",yytext);
				  returnToken(IF);
				}
break;
case 34:

# line 191 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", MOD\n",yytext);
				  returnToken(MOD);
				}
break;
case 35:

# line 194 "magic.lex.l"
                        { LPRINT1("lex: got \"%s\", NOT\n",yytext);
				  returnToken(NOT);
				}
break;
case 36:

# line 197 "magic.lex.l"
                          { LPRINT1("lex: got \"%s\", OR\n",yytext);
				  returnToken(OR);
				}
break;
case 37:

# line 200 "magic.lex.l"
                  { LPRINT1("lex: got \"%s\", REPEAT\n",yytext);
				  returnToken(REPEAT);
				}
break;
case 38:

# line 203 "magic.lex.l"
                             { LPRINT1("lex: got \"%s\", SHOW\n",yytext);
				  returnToken(SHOW);
				}
break;
case 39:

# line 206 "magic.lex.l"
                      { LPRINT1("lex: got \"%s\", SIZE\n",yytext);
				  returnToken(SIZE);
				}
break;
case 40:

# line 209 "magic.lex.l"
                      { LPRINT1("lex: got \"%s\", SQRT\n",yytext);
				  returnToken(SQRT);
				}
break;
case 41:

# line 212 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", TRUNC\n",yytext);
				  returnToken(TRUNC);
				}
break;
case 42:

# line 215 "magic.lex.l"
                  { LPRINT1("lex: got \"%s\", TYPEOF\n",yytext);
				  returnToken(TYPEOF);
				}
break;
case 43:

# line 218 "magic.lex.l"
                      { LPRINT1("lex: got \"%s\", THEN\n",yytext);
				  returnToken(THEN);
				}
break;
case 44:

# line 221 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", UNTIL\n",yytext);
				  returnToken(UNTIL);
				}
break;
case 45:

# line 224 "magic.lex.l"
                    { LPRINT1("lex: got \"%s\", WHILE\n",yytext);
				  returnToken(WHILE);
				}
break;
case 46:

# line 227 "magic.lex.l"
   {
				  LPRINT1("lex: got \"%s\", ID\n",yytext);
				  returnToken(ID);
				}
break;
case 47:

# line 231 "magic.lex.l"
{
				  LPRINT1("lex: got \"%s\", REAL\n",yytext);
				  returnToken(REAL);
				}
break;
case 48:

# line 235 "magic.lex.l"
{
				  LPRINT1("lex: got \"%s\", UNIT\n",yytext);
				  returnToken(UNIT);
				}
break;
case 49:

# line 239 "magic.lex.l"
                             { int c,notDone,slashed;

				  slashed = 0;
				  notDone = 1;
				  while (notDone)
				  {  c = input();
				     if ((c < ' ') && (c != '\t') && (c != '\n') && (c != '\r'))
				     {  yyleng    = 1;
					yytext[0] = '\n';
					yytext[1] = '\0';
					LPRINT0("lex: unclosed string!\n");
					returnToken(EOL);
				     } 
				     if (slashed)
				     {  slashed = 0;
					switch (c)
					{ case 'b': c = '\b';
						    break;
					  case 'f': c = '\f';
						    break;
					  case 'n': c = '\n';
						    break;
					  case 'r': c = '\r';
						    break;
					  case 't': c = '\t';
						    break;
					  case '\n': c = ' ';
						    break;
					  default:  break;
					}
                                        if (yyleng < YYLMAX - 1)
                                        {
					   yytext[yyleng++] = c;
					   yytext[yyleng]   = '\0';
                                        }
                                        else
                                        {
				           yyleng    = 2;
					   yytext[0] = '\n';
					   yytext[1] = '\n';
					   yytext[2] = '\0';
					   LPRINT0("lex: unclosed string!\n");
					   returnToken(EOL);
                                        }
				     }
				     else
				     {  if (c == '\\')
					   slashed = 1;
					else
					{
                                           if (yyleng < YYLMAX-1)
                                           {
                                              yytext[yyleng++] = c;
					      yytext[yyleng]   = '\0';
                                           }
                                           else
                                           {
				              yyleng    = 2;
					      yytext[0] = '\n';
					      yytext[1] = '\n';
					      yytext[2] = '\0';
					      LPRINT0("lex: unclosed string!\n");
					      returnToken(EOL);
                                           }
					   if (c == '\'')
					      notDone = 0;
					}
				     }
				  }
				  LPRINT1("lex: got \"%s\", STRING\n",yytext);
				  returnToken(STRING);
				}
break;
case 50:

# line 311 "magic.lex.l"
                             { int c,notDone,slashed;

				  slashed = 0;
				  notDone = 1;
				  while (notDone)
				  {  c = input();
				     if ((c < ' ') && (c != '\t') && (c != '\n') && (c != '\r'))
				     {  yyleng    = 1;
					yytext[0] = '\n';
					yytext[1] = '\0';
					LPRINT0("lex: unclosed string!\n");
					returnToken(EOL);
				     } 
				     if (slashed)
				     {  slashed = 0;
					switch (c)
					{ case 'b': c = '\b';
						    break;
					  case 'f': c = '\f';
						    break;
					  case 'n': c = '\n';
						    break;
					  case 'r': c = '\r';
						    break;
					  case 't': c = '\t';
						    break;
					  case '\n': c = ' ';
						    break;
					  default:  break;
					}
                                        if (yyleng < YYLMAX - 1)
                                        {
					   yytext[yyleng++] = c;
					   yytext[yyleng]   = '\0';
                                        }
                                        else
                                        {
				           yyleng    = 2;
					   yytext[0] = '\n';
					   yytext[1] = '\n';
					   yytext[2] = '\0';
					   LPRINT0("lex: unclosed string!\n");
					   returnToken(EOL);
                                        }
				     }
				     else
				     {  if (c == '\\')
					   slashed = 1;
					else
					{
                                           if (yyleng < YYLMAX-1)
                                           {
                                              yytext[yyleng++] = c;
					      yytext[yyleng]   = '\0';
                                           }
                                           else
                                           {
				              yyleng    = 2;
					      yytext[0] = '\n';
					      yytext[1] = '\n';
					      yytext[2] = '\0';
					      LPRINT0("lex: unclosed string!\n");
					      returnToken(EOL);
                                           }
					   if (c == '`')
					      notDone = 0;
					}
				     }
				  }
				  LPRINT1("lex: got \"%s\", STRING\n",yytext);
				  returnToken(STRING);
				}
break;
case 51:

# line 383 "magic.lex.l"
                             { int c;

				  while ((c=input()) != '"')
                                      if (c == '\n')
                                      {
                                         if (!ignoreEOL)
                                         {
				            returnToken(EOL);
                                         }
                                         else
                                         {
                                            break;
                                         }
                                      }
				      else if (c < ' ' && c != '\t')
				      {    yyleng    = 1;
					   yytext[0] = '\n';
					   yytext[1] = '\0';    
					   returnToken(EOL);
				      }
				  LPRINT0("lex: got comment!\n");
				}
break;
case 52:

# line 394 "magic.lex.l"
                           { int c;
				  while ((c=input()) != '\n')
                                     ;
				  LPRINT0("lex: got comment!\n");
                                  if (!ignoreEOL)
				     returnToken(EOL);
				}
break;
case 53:

# line 401 "magic.lex.l"
                           { int c;
                                  int done = 0;
                                  
                                  if (fromFile)
                                  {
                                    while (!done)
                                    {
				     while ((c=input()) != '*')
				      if (c == '\004')
				      {    yyleng    = 2;
					   yytext[0] = '\n';
					   yytext[1] = '\004';
					   yytext[2] = '\0';    
					   returnToken(BAD);
				      }
				     while ((c=input()) == '*')
                                      ;
				     if (c == '/')
                                        done = 1;
                                    }
                                  }
                                  else
                                  {
                                    while (!done)
                                    {
				      while ( ((c=input()) != '*') && (c != '\n') )
				        ;
                                      if (c == '\n')
                                      {
                                        done = 1;
				        returnToken(EOL);
                                      }
                                      else
                                      {
				        while ((c=input()) == '*')
                                         ;
				        if (c == '/')
                                           done = 1;
                                        else if (c == '\n')
                                        {
                                          done = 1;
				          returnToken(EOL);
                                        }
                                      }
                                    }
                                  }
				  LPRINT0("lex: got comment!\n");
				}
break;
case 54:

# line 449 "magic.lex.l"
                           ;
break;
case 55:

# line 450 "magic.lex.l"
                             { if (ignoreEOL)
				  {   LPRINT0("lex: ignored \"\\n\", EOL\n");
				  }
				  else
				  {   LPRINT0("lex: got \"\\n\", EOL\n");
				      returnToken(EOL);
				  }
				}
break;
case 56:

# line 458 "magic.lex.l"
                      ;
break;
case 57:

# line 459 "magic.lex.l"
                              returnToken(BAD);
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 23
0
int yylex (void) {
  int nstr; 
//extern int yyprevious;
  while((nstr = yylook()) >= 0)
//    yyfussy: 
  switch(nstr){
      case 0:
	if(yywrap()) return(0); break;
      case 1:
	{
	  return('=');
        }
	break;
      case 2:
	{
	  return(PRINTF);
	}
	break;
      case 3:
	{
	  char     token[512];
	  register int c, i = 0;
	  
	  if (yytext[0] == '$')
	    {
	      for (;;)
		{
		  c = input();
		  if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' &&
		      c <= '9' || c == '_')
		    {
		      token[i++] = c;
		    }
		  else
		    {
		      token[i] = '\0';
		      unput(c); break;
		    }
		}
	      _numex_get_constant((char*)token);
	      if (yylval.symbol->Type == UNDEFINED ||
	          yylval.symbol->Type == EXPRESSION ||
	          yylval.symbol->Type == VARIABLE)
		{
		  return(EXPRESSION);
		}
	      else
		return(yylval.symbol->Type);
	    }
	  else
	    {
	      token[i++] = yytext[0];
	      for (;;)
		{
		  c = input();
		  if (c != '\0' && c != '$')
		    {
		      token[i++] = c;
		    }
		  else
		    {
		      token[i] = '\0';
		      unput(c); break;
		    }
		}
	      yylval.String = string(token);
//	      yylval.string = VStrcpy(token);
	      return(STRING);
	    }
	}
	break;
      case 4:
	{ ; }
	break;
      case 5:
	{	        /* skip everything inside a C style comment */
	  register int c;
	  for (;;)
	    {
	      while ((c = input()) != '*' && c != EOF && c != '\0')
		;
	      if (c == '*')
		{
		  if ((c = input()) == '/')
		    break;
		}
	      else
		break;
	    }
	}
	break;
      case 6:
	{ return(INCREMENT); }
	break;
      case 7:
	{ return(DECREMENT); }
	break;
      case 8:
	{ return(SL); }
	break;
      case 9:
	{ return(SR); }
	break;
      case 10:
	{ return(EQ); }
	break;
      case 11:
	{ return(NE); }
	break;
      case 12:
	{ return(LE); }
	break;
      case 13:
	{ return(GE); }
	break;
      case 14:
	{ return(GT); }
	break;
      case 15:
	{ return(LT); }
	break;
      case 16:
	{ return(EQ); }
	break;
      case 17:
	{ return(LE); }
	break;
      case 18:
	{ return(GE); }
	break;
      case 19:
	{ return(NE); }
	break;
      case 20:
	{ return(POW); }
	break;
      case 21:
	{ return(LT); }
	break;
      case 22:
	{ return(GT); }
	break;
      case 23:
	{ return('('); }
	break;
      case 24:
	{ return(')'); }
	break;
      case 25:
	{ return(','); }
	break;
      case 26:
	{ return(';'); }
	break;
      case 27:
	{ return('='); }
	break;
      case 28:
	{ return('+'); }
	break;
      case 29:
	{ return('-'); }
	break;
      case 30:
	{ return('*'); }
	break;
      case 31:
	{ return('/'); }
	break;
      case 32:
	{ return('~'); }
	break;
      case 33:
	{ return('!'); }
	break;
      case 34:
	{ return('%'); }
	break;
      case 35:
	{ return('&'); }
	break;
      case 36:
	{ return('^'); }
	break;
      case 37:
	{ return('|'); }
	break;
      case 38:
	{ return(AND); }
	break;
      case 39:
	{ return(AND); }
	break;
      case 40:
	{ return(OR); }
	break;
      case 41:
	{ return(OR); }
	break;
      case 42:
	{ return(AADD); }
	break;
      case 43:
	{ return(ASUB); }
	break;
      case 44:
	{ return(AMUL); }
	break;
      case 45:
	{ return(ADIV); }
	break;
      case 46:
	{ return(AOR); }
	break;
      case 47:
	{ return(AAND); }
	break;
      case 48:
	{ return(AXOR); }
	break;
      case 49:
	{ return(ASL); }
	break;
      case 50:
	{ return(ASR); }
	break;
      case 51:
	{ return(':'); }
	break;
      case 52:
	{ return('?'); }
	break;
      case 53:
	{ return(IF); }
	break;
      case 54:
	{ return(IF); }
	break;
      case 55:
	{ return(THEN); }
	break;
      case 56:
	{ return(THEN); }
	break;
      case 57:
	{ return(ELSE); }
	break;
      case 58:
	{ return(ELSE); }
	break;
      case 59:
	{ return('\0'); }
	break;
      case 60:
	{ ; }
	break;
      case 61:
      case 62:
      case 63:
      case 64:
	{
	  yylval.value = atof((char*)yytext);
	  return(NUMBER);
	}
	break;
      case 65:
	{
	  _numex_get_variable((char*)yytext, false);
	  return(VARIABLE);
	}
	break;
      case 66:
	{
	  return(EVALUATE);
	}
	break;
      case 67:
	{
	  _numex_get_function((char*)yytext);
	  return(FUNCTION);
	}
	break;
      case 68:
	{
	  _numex_get_constant((char*)yytext);
	  if (yylval.symbol->Type == UNDEFINED ||
	      yylval.symbol->Type == EXPRESSION)
	    {
	      return(VARIABLE);
	    }
	  else
	    return(yylval.symbol->Type);
	}
	break;
      case 69:
	{
	  return(CINT);
	}
	break;
      case 70:
	{
	  return(CFLOAT);
	}
	break;
      case 71:
	{
	  return(CSTRING);
	}
	break;
      case -1:
	break;
      default:
	fprintf(yyout,"bad switch yylook %d",nstr);
    } return(0); }
Ejemplo n.º 24
0
Archivo: proplex.c Proyecto: ombt/ombt
yylex(){
int nstr; extern int yyprevious;
#ifdef __cplusplus
/* to avoid CC and lint complaining yyfussy not being used ...*/
static int __lex_hack = 0;
if (__lex_hack) goto yyfussy;
#endif
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:

# line 36 "prop.l"
ECHO;
break;
case 2:

# line 37 "prop.l"
	ECHO;
break;
case 3:

# line 38 "prop.l"
GETTOKEN(NEWLINE);
break;
case 4:

# line 39 "prop.l"
	GETTOKEN(THEREFORE);
break;
case 5:

# line 40 "prop.l"
	GETTOKEN(BICONDITIONAL);
break;
case 6:

# line 41 "prop.l"
	GETTOKEN(IMPLICATION);
break;
case 7:

# line 42 "prop.l"
	GETTOKEN(OR);
break;
case 8:

# line 43 "prop.l"
	GETTOKEN(AND);
break;
case 9:

# line 44 "prop.l"
	GETTOKEN(NEGATION);
break;
case 10:

# line 45 "prop.l"
	GETTOKEN(LPAREN);
break;
case 11:

# line 46 "prop.l"
	GETTOKEN(RPAREN);
break;
case 12:

# line 47 "prop.l"
	GETTOKEN(COMMA);
break;
case 13:

# line 48 "prop.l"
	GETTOKEN(SEMICOLON);
break;
case 14:

# line 49 "prop.l"
	GETTOKEN(QUIT);
break;
case 15:

# line 50 "prop.l"
	GETTOKEN(TRUE);
break;
case 16:

# line 51 "prop.l"
	GETTOKEN(FALSE);
break;
case 17:

# line 52 "prop.l"
GETTOKEN(IDENTIFIER);
break;
case 18:

# line 53 "prop.l"
	{
		ECHO;
		YYDUMP();
		strcpy(yylval.string, yytext);
		return(*yytext);
		}
break;
case -1:
break;
default:
(void)fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }
Ejemplo n.º 25
0
Archivo: lex_yy.c Proyecto: wacke/g21k
yylex(){
int nstr; extern int yyprevious;
while((nstr = yylook()) >= 0)
yyfussy: switch(nstr){
case 0:
if(yywrap()) return(0); break;
case 1:
		{
					    if( listing_flag )
						listing_carriage_return();

					    yylineno++;
					}
break;
case 2:
		BEGIN 0;
break;
case 3:
			;
break;
case 4:
			{
					    if( listing_flag )
						listing_carriage_return();

					    yylineno++;
					    BEGIN COMMENT;
					}
break;
case 5:
			{
					    if( listing_flag )
						listing_carriage_return();

					    yylineno++;
					}
break;
case 6:
	return( check_id() );
break;
case 7:
	 {
					    yylval.dval = atof(yytext);
					    LEX_RETURN( REAL );
					}
break;
case 8:
		 {
					    yylval.dval = atof(yytext);
					    LEX_RETURN( REAL );
					}
break;
case 9:
		{
					    if( strlen(yytext) != HEX40_STRING_LENGTH )
					    {
						sscanf(yytext+2,"%lx",&yylval.lval);
						LEX_RETURN( INT_CONST );
					    }
					    else
					    {
						expression_hex_string_to_uns( yytext + 2, yylval.hex40, DM_WORD_SIZE);
						LEX_RETURN( HEX40_CONST );
					    }
					}
break;
case 10:
				{
					    yylval.lval = atol(yytext);
					    LEX_RETURN( INT_CONST );
					}
break;
case 11:
			{
					    yylval.lval = atol(&yytext[2]);
					    LEX_RETURN( INT_CONST );
					}
break;
case 12:
			{
					    yylval.lval = aotol(&yytext[2]);
					    LEX_RETURN( INT_CONST );
					}
break;
case 13:
			{
					    yylval.lval = abtol(&yytext[2]);
					    LEX_RETURN( INT_CONST );
					}
break;
case 14:
		{
					    yylval.lval = ahtol(&yytext[2]);
					    LEX_RETURN( INT_CONST );
					}
break;
case 15:
				   { LEX_RETURN( LEFT_SHIFT ); }
break;
case 16:
				   { LEX_RETURN( RIGHT_SHIFT ); }
break;
case 17:
			{
					    yytext[yyleng-1] = '\0';
					    yylval.sval = (char *) my_malloc((long) yyleng-1 );
					    sscanf(yytext + 1, "%s", yylval.sval);
					    LEX_RETURN( FILENAME );
					}
break;
case 18:
			{
					    strncat( lex_buff, yytext, BUFSIZ - strlen(lex_buff));
					}
break;
case 19:
				   ;
break;
case 20:
				{
					    if( listing_flag && !file_init_processing )
						listing_carriage_return();

					    lex_buff[0] = '\0';

					    if( init_processing )
						yylineno++;

					    if( !init_processing )
						return( NEW_LINE );
					}
break;
case 21:
    {
					    sscanf(yytext,"\n#%d %[^\n]\n",&yylineno,src_name);
					}
break;
case 22:
				{
					    LEX_RETURN( yytext[0] );
					}
break;
case -1:
break;
default:
fprintf(yyout,"bad switch yylook %d",nstr);
} return(0); }