SBSPSS/Utils/Scripter/lexer.cpp

605 lines
9.7 KiB
C++
Raw Normal View History

2000-12-08 21:51:13 +01:00
#include <clex.h>
#line 1 "C:\\spongebob\\Utils\\scripter\\lexer.l"
/****************************************************************************
lexer.l
ParserWizard generated Lex file.
Date: 07 December 2000
****************************************************************************/
#include "parser.h"
#include "var.h"
2000-12-11 21:28:41 +01:00
#include "prepro.h"
2000-12-08 21:51:13 +01:00
#include <stdlib.h>
2000-12-11 21:28:41 +01:00
#line 20 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
// repeated because of possible precompiled header
#include <clex.h>
#include "lexer.h"
/////////////////////////////////////////////////////////////////////////////
// constructor
YYLEXNAME::YYLEXNAME()
{
yytables();
2000-12-12 17:29:42 +01:00
#line 51 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-08 21:51:13 +01:00
// place any extra initialisation code here
2000-12-11 21:28:41 +01:00
#line 36 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
#ifndef YYTEXT_SIZE
#define YYTEXT_SIZE 100
#endif
#ifndef YYUNPUT_SIZE
#define YYUNPUT_SIZE YYTEXT_SIZE
#endif
// backwards compatability with lex
#ifdef input
int YYLEXNAME::yyinput()
{
return input();
}
#else
#define input yyinput
#endif
#ifdef output
void YYLEXNAME::yyoutput(int ch)
{
output(ch);
}
#else
#define output yyoutput
#endif
#ifdef unput
void YYLEXNAME::yyunput(int ch)
{
unput(ch);
}
#else
#define unput yyunput
#endif
#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn -rch // <warning: unreachable code> off
#endif
#endif
int YYLEXNAME::yyaction(int action)
{
2000-12-12 17:29:42 +01:00
#line 63 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-08 21:51:13 +01:00
// extract yylval for use later on in actions
YYSTYPE& yylval = *(YYSTYPE*)yyparserptr->yylvalptr;
2000-12-11 21:28:41 +01:00
#line 87 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
yyreturnflg = 1;
switch (action) {
case 1:
{
2000-12-12 17:29:42 +01:00
#line 70 "C:\\spongebob\\Utils\\scripter\\lexer.l"
if(preprocessorCmd(yytext+1)!=true)error();
2000-12-11 21:28:41 +01:00
#line 94 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 2:
{
2000-12-12 17:29:42 +01:00
#line 71 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
printf("# commands must be at start of line! ( line %d )\n",getCurrentLine());error();
#line 101 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 3:
{
2000-12-12 17:29:42 +01:00
#line 73 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return STOP;
#line 108 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 4:
{
2000-12-12 17:29:42 +01:00
#line 74 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return IF;
#line 115 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 5:
{
2000-12-12 17:29:42 +01:00
#line 75 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return ELSE;
#line 122 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 6:
{
2000-12-12 17:29:42 +01:00
#line 76 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return PAUSE;
#line 129 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 7:
{
2000-12-12 17:29:42 +01:00
#line 77 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return PRINT;
#line 136 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 8:
{
2000-12-12 17:29:42 +01:00
#line 78 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return ASSIGN;
#line 143 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 9:
{
2000-12-12 17:29:42 +01:00
#line 79 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return EQUAL;
#line 150 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 10:
{
2000-12-12 17:29:42 +01:00
#line 80 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return NOTEQUAL;
#line 157 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 11:
{
2000-12-12 17:29:42 +01:00
#line 81 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return PLUS;
#line 164 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 12:
{
2000-12-12 17:29:42 +01:00
#line 82 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return END_STMT;
#line 171 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 13:
{
2000-12-12 17:29:42 +01:00
#line 83 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return OPEN_PAR;
#line 178 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 14:
{
2000-12-12 17:29:42 +01:00
#line 84 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return CLOSE_PAR;
#line 185 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 15:
{
2000-12-12 17:29:42 +01:00
#line 85 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return BEGIN_CS;
#line 192 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 16:
{
2000-12-12 17:29:42 +01:00
#line 86 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
return END_CS;
#line 199 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 17:
{
2000-12-12 17:29:42 +01:00
#line 88 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
yylval.variableIdx=lookupVarName(yytext+1);return VARIABLE;
#line 206 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 18:
{
2000-12-12 17:29:42 +01:00
#line 89 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-08 21:51:13 +01:00
yylval.value=atoi(yytext);return VALUE;
2000-12-11 21:28:41 +01:00
#line 213 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 19:
{
2000-12-12 17:29:42 +01:00
#line 92 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-08 21:51:13 +01:00
2000-12-11 21:28:41 +01:00
#line 220 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 20:
{
2000-12-12 17:29:42 +01:00
#line 93 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
#line 227 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
case 21:
{
2000-12-12 17:29:42 +01:00
#line 94 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
#line 234 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
}
break;
case 22:
{
2000-12-12 17:29:42 +01:00
#line 96 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-11 21:28:41 +01:00
printf("UNEXPECTED CHAR: '%s' in line %d ( char %d )\n",yytext,getCurrentLine(),getCurrentCharOnLine());error();
#line 241 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
}
break;
default:
yyassert(0);
break;
}
yyreturnflg = 0;
return 0;
}
#ifndef YYNBORLANDWARN
#ifdef __BORLANDC__
#pragma warn .rch // <warning: unreachable code> to the old state
#endif
#endif
2000-12-12 17:29:42 +01:00
#line 98 "C:\\spongebob\\Utils\\scripter\\lexer.l"
2000-12-08 21:51:13 +01:00
/////////////////////////////////////////////////////////////////////////////
// programs section
2000-12-11 21:28:41 +01:00
#line 265 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
2000-12-08 21:51:13 +01:00
void YYLEXNAME::yytables()
{
yystext_size = YYTEXT_SIZE;
yysunput_size = YYUNPUT_SIZE;
static const yymatch_t YYNEARFAR YYBASED_CODE match[] = {
0
};
yymatch = match;
yytransitionmax = 251;
static const yytransition_t YYNEARFAR YYBASED_CODE transition[] = {
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 19, 19 },
{ 0, 30 },
2000-12-08 21:51:13 +01:00
{ 0, 41 },
{ 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 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 19, 19 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 3, 1 },
{ 0, 0 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 30, 18 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 0, 0 },
{ 0, 0 },
{ 27, 8 },
{ 28, 9 },
{ 0, 0 },
{ 0, 0 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 29, 29 },
{ 0, 0 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 29, 29 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
{ 0, 16 },
2000-12-08 21:51:13 +01:00
{ 19, 2 },
2000-12-11 21:28:41 +01:00
{ 20, 2 },
{ 33, 25 },
{ 40, 38 },
{ 22, 4 },
{ 25, 7 },
2000-12-08 21:51:13 +01:00
{ 32, 24 },
{ 37, 33 },
2000-12-11 21:28:41 +01:00
{ 35, 31 },
{ 31, 22 },
{ 38, 34 },
{ 24, 6 },
2000-12-08 21:51:13 +01:00
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
{ 17, 17 },
2000-12-11 21:28:41 +01:00
{ 26, 7 },
{ 19, 2 },
{ 9, 2 },
{ 34, 26 },
2000-12-08 21:51:13 +01:00
{ 41, 2 },
2000-12-11 21:28:41 +01:00
{ 16, 2 },
{ 23, 5 },
{ 36, 32 },
{ 39, 37 },
2000-12-08 21:51:13 +01:00
{ 12, 2 },
2000-12-11 21:28:41 +01:00
{ 13, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 10, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 18, 2 },
2000-12-08 21:51:13 +01:00
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 17, 2 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 11, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 8, 2 },
2000-12-08 21:51:13 +01:00
{ 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 },
{ 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 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 6, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 5, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 7, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 4, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 14, 2 },
2000-12-08 21:51:13 +01:00
{ 0, 0 },
2000-12-11 21:28:41 +01:00
{ 15, 2 }
2000-12-08 21:51:13 +01:00
};
yytransition = transition;
static const yystate_t YYNEARFAR YYBASED_CODE state[] = {
{ 0, 0, 0 },
{ 2, 1, 0 },
2000-12-11 21:28:41 +01:00
{ -21, 125, 0 },
{ 0, 0, 2 },
{ 38, 22, 22 },
{ 0, 60, 22 },
{ 0, 37, 22 },
{ 0, 42, 22 },
{ 9, 1, 8 },
{ 0, 2, 22 },
2000-12-08 21:51:13 +01:00
{ 0, 0, 11 },
{ 0, 0, 12 },
{ 0, 0, 13 },
{ 0, 0, 14 },
{ 0, 0, 15 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 16 },
{ 29, 76, 22 },
2000-12-08 21:51:13 +01:00
{ 0, 98, 18 },
2000-12-11 21:28:41 +01:00
{ 0, 1, 22 },
{ 0, 1, 20 },
2000-12-08 21:51:13 +01:00
{ 0, 0, 21 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 22 },
2000-12-08 21:51:13 +01:00
{ 0, 32, 0 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 4 },
{ 33, 25, 0 },
2000-12-08 21:51:13 +01:00
{ 0, 19, 0 },
{ 0, 54, 0 },
{ 0, 0, 9 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 10 },
{ 38, 1, 17 },
{ -30, 1, 19 },
2000-12-08 21:51:13 +01:00
{ 0, 30, 0 },
2000-12-11 21:28:41 +01:00
{ 37, 62, 0 },
2000-12-08 21:51:13 +01:00
{ 0, 26, 0 },
{ 0, 34, 0 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 3 },
{ 0, 0, 5 },
2000-12-08 21:51:13 +01:00
{ 0, 63, 0 },
{ 0, 21, 0 },
{ 0, 0, 6 },
2000-12-11 21:28:41 +01:00
{ 0, 0, 7 },
{ -41, 2, 1 }
2000-12-08 21:51:13 +01:00
};
yystate = state;
static const yybackup_t YYNEARFAR YYBASED_CODE backup[] = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2000-12-11 21:28:41 +01:00
0,
2000-12-08 21:51:13 +01:00
0
};
yybackup = backup;
}