📄 mylexer.c
字号:
/****************************************************************************
* U N R E G I S T E R E D C O P Y
*
* You are on day 15 of your 30 day trial period.
*
* This file was produced by an UNREGISTERED COPY of Parser Generator. It is
* for evaluation purposes only. If you continue to use Parser Generator 30
* days after installation then you are required to purchase a license. For
* more information see the online help or go to the Bumble-Bee Software
* homepage at:
*
* http://www.bumblebeesoftware.com
*
* This notice must remain present in the file. It cannot be removed.
****************************************************************************/
/****************************************************************************
* mylexer.c
* C source file generated from mylexer.l.
*
* Date: 12/05/07
* Time: 21:54:01
*
* ALex Version: 2.07
****************************************************************************/
#include <yylex.h>
/* namespaces */
#if defined(__cplusplus) && defined(YYSTDCPPLIB)
using namespace std;
#endif
#if defined(__cplusplus) && defined(YYNAMESPACE)
using namespace yl;
#endif
#define YYFASTLEXER
#line 1 ".\\mylexer.l"
/****************************************************************************
mylexer.l
ParserWizard generated Lex file.
Date: 2007年11月1日
****************************************************************************/
#include <stdio.h>
#include <string.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef enum{HEAD,ELSE,IF,INT,RETURN,VOID,WHILE,LT,GT,LE,GE,EQ,NE,COMMENT,LETTER,DIGIT,ID,NUMBER} TOKEN;
#line 62 "mylexer.c"
/* repeated because of possible precompiled header */
#include <yylex.h>
/* namespaces */
#if defined(__cplusplus) && defined(YYSTDCPPLIB)
using namespace std;
#endif
#if defined(__cplusplus) && defined(YYNAMESPACE)
using namespace yl;
#endif
#define YYFASTLEXER
#include ".\mylexer.h"
#ifndef YYTEXT_SIZE
#define YYTEXT_SIZE 100
#endif
#ifndef YYUNPUT_SIZE
#define YYUNPUT_SIZE YYTEXT_SIZE
#endif
#ifndef YYTEXT_MAX
#define YYTEXT_MAX 0
#endif
#ifndef YYUNPUT_MAX
#define YYUNPUT_MAX YYTEXT_MAX
#endif
/* yytext */
static char YYNEAR yysatext[(YYTEXT_SIZE) + 1]; /* extra char for \0 */
char YYFAR *YYNEAR YYDCDECL yystext = yysatext;
char YYFAR *YYNEAR YYDCDECL yytext = yysatext;
int YYNEAR YYDCDECL yystext_size = (YYTEXT_SIZE);
int YYNEAR YYDCDECL yytext_size = (YYTEXT_SIZE);
int YYNEAR YYDCDECL yytext_max = (YYTEXT_MAX);
/* yystatebuf */
#if (YYTEXT_SIZE) != 0
static int YYNEAR yysastatebuf[(YYTEXT_SIZE)];
int YYFAR *YYNEAR YYDCDECL yysstatebuf = yysastatebuf;
int YYFAR *YYNEAR YYDCDECL yystatebuf = yysastatebuf;
#else
int YYFAR *YYNEAR YYDCDECL yysstatebuf = NULL;
int YYFAR *YYNEAR YYDCDECL yystatebuf = NULL;
#endif
/* yyunputbuf */
#if (YYUNPUT_SIZE) != 0
static int YYNEAR yysaunputbuf[(YYUNPUT_SIZE)];
int YYFAR *YYNEAR YYDCDECL yysunputbufptr = yysaunputbuf;
int YYFAR *YYNEAR YYDCDECL yyunputbufptr = yysaunputbuf;
#else
int YYFAR *YYNEAR YYDCDECL yysunputbufptr = NULL;
int YYFAR *YYNEAR YYDCDECL yyunputbufptr = NULL;
#endif
int YYNEAR YYDCDECL yysunput_size = (YYUNPUT_SIZE);
int YYNEAR YYDCDECL yyunput_size = (YYUNPUT_SIZE);
int YYNEAR YYDCDECL yyunput_max = (YYUNPUT_MAX);
/* backwards compatability with lex */
#ifdef input
#ifdef YYPROTOTYPE
int YYCDECL yyinput(void)
#else
int YYCDECL yyinput()
#endif
{
return input();
}
#else
#define input yyinput
#endif
#ifdef output
#ifdef YYPROTOTYPE
void YYCDECL yyoutput(int ch)
#else
void YYCDECL yyoutput(ch)
int ch;
#endif
{
output(ch);
}
#else
#define output yyoutput
#endif
#ifdef unput
#ifdef YYPROTOTYPE
void YYCDECL yyunput(int ch)
#else
void YYCDECL yyunput(ch)
int ch;
#endif
{
unput(ch);
}
#else
#define unput yyunput
#endif
#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn -rch /* <warning: unreachable code> off */
#endif
#endif
#ifdef YYPROTOTYPE
int YYCDECL yylexeraction(int action)
#else
int YYCDECL yylexeraction(action)
int action;
#endif
{
yyreturnflg = YYTRUE;
switch (action) {
case 1:
{
#line 41 ".\\mylexer.l"
printf("ELSE:%s%c ",yytext,' ');return ELSE;
#line 183 "mylexer.c"
}
break;
case 2:
{
#line 42 ".\\mylexer.l"
printf("IF:%s%c ",yytext,' ');return IF;
#line 190 "mylexer.c"
}
break;
case 3:
{
#line 43 ".\\mylexer.l"
printf("INT:%s%c ",yytext,' ');return INT;
#line 197 "mylexer.c"
}
break;
case 4:
{
#line 44 ".\\mylexer.l"
printf("RETURN:%s%c ",yytext,' ');return RETURN;
#line 204 "mylexer.c"
}
break;
case 5:
{
#line 45 ".\\mylexer.l"
printf("VOID:%s%c ",yytext,' ');return VOID;
#line 211 "mylexer.c"
}
break;
case 6:
{
#line 46 ".\\mylexer.l"
printf("WHILE:%s%c ",yytext,' ');return WHILE;
#line 218 "mylexer.c"
}
break;
case 7:
{
#line 48 ".\\mylexer.l"
printf("LT:%s%c ",yytext,' ');return LT;
#line 225 "mylexer.c"
}
break;
case 8:
{
#line 49 ".\\mylexer.l"
printf("GT:%s%c ",yytext,' ');return GT;
#line 232 "mylexer.c"
}
break;
case 9:
{
#line 50 ".\\mylexer.l"
printf("LE:%s%c ",yytext,' ');return LE;
#line 239 "mylexer.c"
}
break;
case 10:
{
#line 51 ".\\mylexer.l"
printf("GE:%s%c ",yytext,' ');return GE;
#line 246 "mylexer.c"
}
break;
case 11:
{
#line 52 ".\\mylexer.l"
printf("EQ:%s%c ",yytext,' ');return EQ;
#line 253 "mylexer.c"
}
break;
case 12:
{
#line 53 ".\\mylexer.l"
printf("NE:%s%c ",yytext,' ');return NE;
#line 260 "mylexer.c"
}
break;
case 13:
{
#line 54 ".\\mylexer.l"
printf("{:%s%c ",yytext,' '); return '{';
#line 267 "mylexer.c"
}
break;
case 14:
{
#line 55 ".\\mylexer.l"
printf("}:%s%c ",yytext,' '); return '}';
#line 274 "mylexer.c"
}
break;
case 15:
{
#line 56 ".\\mylexer.l"
printf("(:%s%c ",yytext,' ');return '(';
#line 281 "mylexer.c"
}
break;
case 16:
{
#line 57 ".\\mylexer.l"
printf("):%s%c ",yytext,' ');return ')';
#line 288 "mylexer.c"
}
break;
case 17:
{
#line 58 ".\\mylexer.l"
printf("[:%s%c ",yytext,' ');return '[';
#line 295 "mylexer.c"
}
break;
case 18:
{
#line 59 ".\\mylexer.l"
printf("]:%s%c ",yytext,' ');return ']';
#line 302 "mylexer.c"
}
break;
case 19:
{
#line 60 ".\\mylexer.l"
printf("+:%s%c ",yytext,' ');return '+';
#line 309 "mylexer.c"
}
break;
case 20:
{
#line 61 ".\\mylexer.l"
printf("-:%s%c ",yytext,' ');return '-';
#line 316 "mylexer.c"
}
break;
case 21:
{
#line 62 ".\\mylexer.l"
printf("*:%s%c ",yytext,' ');return '*';
#line 323 "mylexer.c"
}
break;
case 22:
{
#line 63 ".\\mylexer.l"
printf("/:%s%c ",yytext,' ');return '/';
#line 330 "mylexer.c"
}
break;
case 23:
{
#line 64 ".\\mylexer.l"
printf("%:%s%c ",yytext,' ');return '%';
#line 337 "mylexer.c"
}
break;
case 24:
{
#line 65 ".\\mylexer.l"
printf(";:%s%c ",yytext,' ');return ';';
#line 344 "mylexer.c"
}
break;
case 25:
{
#line 66 ".\\mylexer.l"
printf("=:%s%c ",yytext,' ');return '=';
#line 351 "mylexer.c"
}
break;
case 26:
{
#line 67 ".\\mylexer.l"
printf(",:%s%c ",yytext,' ');return ',';
#line 358 "mylexer.c"
}
break;
case 27:
{
#line 68 ".\\mylexer.l"
printf("id:%s%c ",yytext,' ');return ID;
#line 365 "mylexer.c"
}
break;
case 28:
{
#line 70 ".\\mylexer.l"
printf("number:%s%c ",yytext,' '); return NUMBER;
#line 372 "mylexer.c"
}
break;
case 29:
{
#line 72 ".\\mylexer.l"
char c;
int done = FALSE;
ECHO;
do
{ while((c=input())!='*')
putchar(c);
putchar(c);
while((c=input())=='*')
putchar(c);
putchar(c);
if(c=='/') done =TRUE;
} while(!done);
printf("\n: There are the conment!");
return COMMENT;
#line 395 "mylexer.c"
}
break;
default:
yyassert(0);
break;
}
yyreturnflg = YYFALSE;
return 0;
}
#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn .rch /* <warning: unreachable code> to the old state */
#endif
#endif
YYCONST yymatch_t YYNEARFAR YYBASED_CODE YYDCDECL yymatch[] = {
0
};
int YYNEAR YYDCDECL yytransitionmax = 152;
YYCONST yytransition_t YYNEARFAR YYBASED_CODE YYDCDECL yytransition[] = {
{ 0, 0 },
{ 3, 1 },
{ 29, 14 },
{ 30, 15 },
{ 31, 16 },
{ 4, 1 },
{ 33, 21 },
{ 32, 20 },
{ 5, 1 },
{ 6, 1 },
{ 7, 1 },
{ 8, 1 },
{ 9, 1 },
{ 10, 1 },
{ 34, 21 },
{ 11, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 12, 1 },
{ 28, 11 },
{ 13, 1 },
{ 14, 1 },
{ 15, 1 },
{ 16, 1 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 12, 12 },
{ 35, 22 },
{ 36, 23 },
{ 37, 24 },
{ 38, 32 },
{ 39, 34 },
{ 40, 35 },
{ 41, 36 },
{ 42, 37 },
{ 43, 38 },
{ 44, 40 },
{ 45, 41 },
{ 46, 42 },
{ 47, 44 },
{ 48, 46 },
{ 49, 47 },
{ 27, 3 },
{ 0, 0 },
{ 0, 0 },
{ 18, 1 },
{ 0, 0 },
{ 19, 1 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 20, 1 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 21, 1 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 22, 1 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 23, 1 },
{ 24, 1 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 25, 1 },
{ 0, 0 },
{ 26, 1 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 },
{ 17, 49 }
};
YYCONST yystate_t YYNEARFAR YYBASED_CODE YYDCDECL yystate[] = {
{ 0, 0, 0 },
{ 49, -32, 0 },
{ 1, 0, 0 },
{ 0, -5, 0 },
{ 0, 0, 23 },
{ 0, 0, 15 },
{ 0, 0, 16 },
{ 0, 0, 21 },
{ 0, 0, 19 },
{ 0, 0, 26 },
{ 0, 0, 20 },
{ 0, -16, 22 },
{ 0, -17, 28 },
{ 0, 0, 24 },
{ 0, -59, 7 },
{ 0, -58, 25 },
{ 0, -57, 8 },
{ 49, 0, 27 },
{ 0, 0, 17 },
{ 0, 0, 18 },
{ 49, -101, 27 },
{ 49, -96, 27 },
{ 49, -60, 27 },
{ 49, -69, 27 },
{ 49, -61, 27 },
{ 0, 0, 13 },
{ 0, 0, 14 },
{ 0, 0, 12 },
{ 0, 0, 29 },
{ 0, 0, 9 },
{ 0, 0, 11 },
{ 0, 0, 10 },
{ 49, -71, 27 },
{ 49, 0, 2 },
{ 49, -71, 27 },
{ 49, -70, 27 },
{ 49, -58, 27 },
{ 49, -57, 27 },
{ 49, -52, 27 },
{ 49, 0, 3 },
{ 49, -67, 27 },
{ 49, -49, 27 },
{ 49, -56, 27 },
{ 49, 0, 1 },
{ 49, -61, 27 },
{ 49, 0, 5 },
{ 49, -47, 27 },
{ 49, -55, 27 },
{ 49, 0, 6 },
{ 0, 29, 4 }
};
YYCONST yybackup_t YYNEARFAR YYBASED_CODE YYDCDECL yybackup[] = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
};
#line 90 ".\\mylexer.l"
/////////////////////////////////////////////////////////////////////////////
// programs section
int main(void)
{
while (yylex()) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -