This commit is contained in:
Paul 2000-12-08 20:40:33 +00:00
parent f857751606
commit aae2e8e05f
168 changed files with 11625 additions and 0 deletions

View file

@ -0,0 +1,18 @@
/************************************************************
main.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "yacc.h"
#ifdef YYPROTOTYPE
int main(void)
#else
int main()
#endif
{
return yyparse();
}

View file

@ -0,0 +1,21 @@
/************************************************************
yycback.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
int yylexer::yyback(const yymatch_t YYNEARFAR* p, int action) const
{
yyassert(p != NULL);
yyassert(action < 0);
while (*p != 0) {
if (*p++ == action) {
return 1;
}
}
return 0;
}

View file

@ -0,0 +1,40 @@
/************************************************************
yyccdeci.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
void yycparser::yydestructclearin()
{
if (yylookahead) {
// clean up any token attributes
if (yyctokendestptr != NULL) {
const yyctokendest_t YYNEARFAR* tokendestptr = yyctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yychar) {
// user actions in here
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyaction(tokendestptr->action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
break;
}
tokendestptr++;
}
}
yylookahead = 0;
}
}

View file

@ -0,0 +1,217 @@
/************************************************************
yycclex.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "clex.h"
int yyclexer::yylex()
{
while (1) {
int state = 1 + yystart;
if (yyeol) {
state++;
}
// yymore
if (yymoreflg) {
yymoreflg = 0; // clear flag
}
else {
yyleng = 0;
yyoldeol = yyeol;
}
int oldleng = yyleng;
// look for a string
do {
// get input character (lookahead character)
int ch = yyinput();
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
if (ch == EOF) {
break;
}
// check for possible overflow
if (yyleng == yytext_size) {
do {
if (yytextgrow) {
if (yytext_size != 0) {
int size = yytext_size * 2;
if (size / 2 == yytext_size) { // overflow check
if (yysettextsize(size)) {
break;
}
}
}
else {
if (yysettextsize(100)) {
break;
}
}
}
yytextoverflow();
exit(EXIT_FAILURE);
}
while (0);
}
// look for a transition
int index = yystate[state].base;
while (1) {
if (yyctransition[index].next == 0) {
state = yystate[state].def;
if (state <= 0) {
if (state < 0) {
if (ch >= 0 && ch <= 0xff) {
state = -state;
}
else {
state = 0;
}
}
break;
}
}
if (ch >= yyctransition[index].first &&
ch <= yyctransition[index].last) {
state = yyctransition[index].next;
break;
}
index++;
}
int leng = yyleng; // slightly more efficient code
yytext[leng] = (char)ch;
yystatebuf[leng] = state;
leng++;
yyleng = leng;
}
while (state != 0 && (yystate[state].def != 0 || yystate[state].base != 0));
// now find a match
if (yyleng > oldleng) {
int rejectmatch = 0;
while (1) {
int match = yystate[yystatebuf[yyleng - 1]].match;
if (rejectmatch != 0) {
if (match < 0) {
int index = -match;
do {
match = yymatch[index++];
}
while (match > 0 && match <= rejectmatch);
}
else {
if (match == rejectmatch) {
match = 0;
}
}
rejectmatch = 0;
}
else {
if (match < 0) {
match = yymatch[-match];
}
}
if (match > 0) {
// check for backup
if (yybackup[match]) {
while (yyleng > oldleng) {
int index = yystate[yystatebuf[yyleng - 1]].match;
if (index < 0) {
if (yyback(&yymatch[-index], -match)) {
break; // found an expression
}
}
yyleng--;
yyunput((unsigned char)yytext[yyleng]);
}
}
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; // clear flag
int rejectleng = yyleng;
if (yyleng > 0) {
yyeol = (unsigned char)(yytext[yyleng - 1] == '\n');
}
else {
yyeol = yyoldeol;
}
// perform user action
int token = yyaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (rejectleng == yyleng) {
rejectmatch = match;
}
}
else if (yyleng > oldleng + 1) {
yyleng--;
yyunput((unsigned char)yytext[yyleng]);
}
else {
yyeol = (unsigned char)(yytext[0] == '\n');
yyoutput(yytext[0]); // non-matched character
break;
}
}
}
else {
yyassert(yyleng == oldleng);
// handles <<EOF>> rules
int index = 0;
int match = yystate[state].match;
if (match < 0) {
index = -match;
match = yymatch[index++];
}
while (match > 0) {
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; // clear flag
// perform user action
int token = yyaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (index == 0) {
break;
}
match = yymatch[index++];
}
if (yywrap()) {
yyoldeol = 1;
yyeol = 1;
yystart = 0;
return 0; // eof reached
}
}
}
}

View file

@ -0,0 +1,285 @@
/************************************************************
yyccwork.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
int yycparser::yywork()
{
int errorpop = 0;
while (1) {
yystack_t state = yypeek(); // get top state
int index = yycstateaction[state];
while (1) {
if (yyctokenaction[index].token == YYTK_ALL) {
if (yyctokenaction[index].type == YYAT_DEFAULT) {
state = yyctokenaction[index].sr;
index = yycstateaction[state];
continue;
}
break;
}
if (!yylookahead) {
yychar = yygettoken();
if (yychar < 0) {
yychar = 0;
}
yylookahead = 1;
#ifdef YYDEBUG
yydgettoken(yychar);
#endif
}
if (yyctokenaction[index].token == yychar) {
break;
}
index++;
}
unsigned char type = yyctokenaction[index].type;
short sr = yyctokenaction[index].sr;
// action
switch (type) {
case YYAT_SHIFT:
#ifdef YYDEBUG
yydshift(yychar);
#endif
if (yyskip > 0) {
yysetskip(yyskip - 1);
}
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
memcpy(&((char YYFAR*)yyattributestackptr)[yytop * yyattribute_size],
yylvalptr, yyattribute_size);
yylookahead = 0;
continue; // go to top of while loop
case YYAT_REDUCE:
#ifdef YYDEBUG
yydreduce(sr);
#endif
yyretireflg = 0;
if (yyreduction[sr].action != -1) {
// user actions in here
if (yyreduction[sr].length > 0) {
memcpy(yyvalptr, &((char YYFAR*)yyattributestackptr)
[(yytop + 1 - yyreduction[sr].length) * yyattribute_size],
yyattribute_size);
}
yyerrorflg = 0;
yyexitflg = 0;
yyaction(yyreduction[sr].action);
// check for special user requected actions
if (yyexitflg) {
#ifdef YYDEBUG
yydexit(yyexitcode);
#endif
return yyexitcode;
}
if (yyerrorflg) {
errorpop = yyerrorpop;
#ifdef YYDEBUG
yydthrowerror(yyerrorpop);
#endif
yyerrorcount++;
break; // go to error handler
}
}
yypop(yyreduction[sr].length);
{
yystack_t state = yypeek(); // get top state
int nonterm = yyreduction[sr].nonterm;
int index = yycstategoto[state];
while (1) {
if (yycnontermgoto[index].nonterm == -1) {
if (yycnontermgoto[index].next != -1) {
state = yycnontermgoto[index].next;
index = yycstategoto[state];
continue;
}
break;
}
if (yycnontermgoto[index].nonterm == nonterm) {
break;
}
index++;
}
short next = yycnontermgoto[index].next;
yyassert(next != -1);
if (!yypush(next)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
if (yyreduction[sr].action != -1) {
memcpy(&((char YYFAR*)yyattributestackptr)[yytop * yyattribute_size],
yyvalptr, yyattribute_size);
}
if (yyretireflg) {
#ifdef YYDEBUG
yydretire(yyretirecode);
#endif
return yyretirecode;
}
continue; // go to top of while loop
case YYAT_ERROR:
#ifdef YYDEBUG
yydsyntaxerror();
#endif
if (yyskip == 0) {
yyerrorcount++;
yysyntaxerror();
}
break; // go to error handler
default:
yyassert(type == YYAT_ACCEPT);
#ifdef YYDEBUG
yydaccept();
#endif
return 0;
}
// error handler
if (yyskip < 3 || yyerrorpop > 0) {
#ifdef YYDEBUG
yydattemptrecovery();
#endif
yypopflg = 0; // clear flag
while (yytop >= 0) {
state = yypeek(); // get top state
index = yycstateaction[state];
while (1) {
if (yyctokenaction[index].token == YYTK_ALL) {
if (yyctokenaction[index].type == YYAT_DEFAULT) {
state = yyctokenaction[index].sr;
index = yycstateaction[state];
continue;
}
break;
}
if (yyctokenaction[index].token == YYTK_ERROR) {
break;
}
index++;
}
type = yyctokenaction[index].type;
sr = yyctokenaction[index].sr;
if (type == YYAT_SHIFT) {
if (errorpop <= 0) {
#ifdef YYDEBUG
yydshift(YYTK_ERROR);
#endif
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
yysetskip(3); // skip 3 erroneous characters
break;
}
errorpop--;
}
yypopflg = 1;
// clean up any symbol attributes
if (yydestructorptr != NULL) {
state = yypeek();
int action = yydestructorptr[state];
if (action != -1) {
// user actions in here
memcpy(yyvalptr, &((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyattribute_size);
yyaction(action);
memcpy(&((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyvalptr, yyattribute_size);
}
}
yypop(1);
if (yytop < 0) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
}
else {
if (yylookahead) {
if (yychar != 0) {
#ifdef YYDEBUG
yyddiscard(yychar);
#endif
yydiscard(yychar);
// clean up any token attributes
if (yyctokendestptr != NULL) {
const yyctokendest_t YYNEARFAR *tokendestptr = yyctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yychar) {
// user actions in here
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyaction(tokendestptr->action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
break;
}
tokendestptr++;
}
}
yylookahead = 0; // skip erroneous character
}
else {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
}
}
}

View file

@ -0,0 +1,39 @@
/************************************************************
yycdeci.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
void yyfparser::yydestructclearin()
{
if (yylookahead) {
// clean up any token attributes
if (yytokendestptr != NULL) {
int index = yytokendestbase + yychar;
if (index >= 0 && index < yytokendest_size) {
int action = yytokendestptr[index];
if (action != -1) {
// user actions in here
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyaction(action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
}
}
}
yylookahead = 0;
}
}

View file

@ -0,0 +1,45 @@
/************************************************************
yycdepop.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
void yyparser::yydestructpop(int num)
{
yyassert(num >= 0);
yyassert(yytop - num >= -1);
if (yydestructorptr != NULL) {
while (num > 0) {
yystack_t state = yypeek();
int action = yydestructorptr[state];
if (action != -1) {
// user actions in here
memcpy(yyvalptr, &((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyattribute_size);
yyaction(action);
memcpy(&((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyvalptr, yyattribute_size);
}
yypop(1);
num--;
}
}
else {
yypop(num);
}
}

View file

@ -0,0 +1,20 @@
/************************************************************
yycdisc.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include "cyacc.h"
#ifdef __BORLANDC__
#pragma argsused
#endif
void yyparser::yydiscard(int token)
{
yyassert(token > 0);
// do nothing
}

View file

@ -0,0 +1,67 @@
/************************************************************
yycdoutp.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include <ctype.h>
#include "clex.h"
#ifdef YYDEBUG
void yylexer::yydebugoutput(int ch) const
{
char string[32];
switch (ch) {
case EOF:
strcpy(string, "EOF");
break;
case '\n':
strcpy(string, "\\n");
break;
case '\t':
strcpy(string, "\\t");
break;
case '\v':
strcpy(string, "\\v");
break;
case '\b':
strcpy(string, "\\b");
break;
case '\r':
strcpy(string, "\\r");
break;
case '\f':
strcpy(string, "\\f");
break;
case '\a':
strcpy(string, "\\a");
break;
case '\\':
strcpy(string, "\\");
break;
case '\?':
strcpy(string, "\\\?");
break;
case '\'':
strcpy(string, "\\\'");
break;
case '\"':
strcpy(string, "\\\"");
break;
default:
if (isascii(ch) && isgraph(ch)) {
string[0] = (char)ch;
string[1] = '\0';
}
else {
sprintf(string, "\\%03o", (unsigned int)(unsigned char)ch);
}
break;
}
yydebugoutput(string);
}
#endif

View file

@ -0,0 +1,17 @@
/************************************************************
yycecho.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "clex.h"
void yylexer::yyecho()
{
for (int i = 0; i < yyleng; i++) {
yyoutput(yytext[i]);
}
}

View file

@ -0,0 +1,20 @@
/************************************************************
yycerror.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "cyacc.h"
void yyparser::yyerror(const char YYFAR* text)
{
yyassert(text != NULL);
yyassert(yyerr != NULL);
while (*text != '\0') {
putc(*text++, yyerr);
}
putc('\n', yyerr);
}

View file

@ -0,0 +1,214 @@
/************************************************************
yycflex.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "clex.h"
int yyflexer::yylex()
{
while (1) {
int state = 1 + yystart;
if (yyeol) {
state++;
}
// yymore
if (yymoreflg) {
yymoreflg = 0; // clear flag
}
else {
yyleng = 0;
yyoldeol = yyeol;
}
int oldleng = yyleng;
// look for a string
do {
// get input character (look ahead character)
int ch = yyinput();
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
if (ch == EOF) {
break;
}
// check for possible overflow
if (yyleng == yytext_size) {
do {
if (yytextgrow) {
if (yytext_size != 0) {
int size = yytext_size * 2;
if (size / 2 == yytext_size) { // overflow check
if (yysettextsize(size)) {
break;
}
}
}
else {
if (yysettextsize(100)) {
break;
}
}
}
yytextoverflow();
exit(EXIT_FAILURE);
}
while (0);
}
// look for a transition
do {
int index = yystate[state].base + ch;
if (index >= 0 && index < yytransitionmax) {
if (yytransition[index].check == state) {
state = yytransition[index].next;
break; // found a transition
}
}
state = yystate[state].def;
if (state < 0) {
if (ch >= 0 && ch <= 0xff) {
state = -state;
}
else {
state = 0;
}
break; // default transition
}
}
while (state != 0);
int leng = yyleng; // slightly more efficient
yytext[leng] = (char)ch;
yystatebuf[leng] = state;
leng++;
yyleng = leng;
}
while (state != 0 && (yystate[state].def != 0 || yystate[state].base != 0));
// now find a match
if (yyleng > oldleng) {
int rejectmatch = 0;
while (1) {
int match = yystate[yystatebuf[yyleng - 1]].match;
if (rejectmatch != 0) {
if (match < 0) {
int index = -match;
do {
match = yymatch[index++];
}
while (match > 0 && match <= rejectmatch);
}
else {
if (match == rejectmatch) {
match = 0;
}
}
rejectmatch = 0;
}
else {
if (match < 0) {
match = yymatch[-match];
}
}
if (match > 0) {
// check for backup
if (yybackup[match]) {
while (yyleng > oldleng) {
int index = yystate[yystatebuf[yyleng - 1]].match;
if (index < 0) {
if (yyback(&yymatch[-index], -match)) {
break; // found an expression
}
}
yyleng--;
yyunput((unsigned char)yytext[yyleng]);
}
}
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; // clear flag
int rejectleng = yyleng;
if (yyleng > 0) {
yyeol = (unsigned char)(yytext[yyleng - 1] == '\n');
}
else {
yyeol = yyoldeol;
}
// perform user action
int token = yyaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (rejectleng == yyleng) {
rejectmatch = match;
}
}
else if (yyleng > oldleng + 1) {
yyleng--;
yyunput((unsigned char)yytext[yyleng]);
}
else {
yyeol = (unsigned char)(yytext[0] == '\n');
yyoutput(yytext[0]); // non-matched character
break;
}
}
}
else {
yyassert(yyleng == oldleng);
// handles <<EOF>> rules
int index = 0;
int match = yystate[state].match;
if (match < 0) {
index = -match;
match = yymatch[index++];
}
while (match > 0) {
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; // clear flag
// perform user action
int token = yyaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (index == 0) {
break;
}
match = yymatch[index++];
}
if (yywrap()) {
yyoldeol = 1;
yyeol = 1;
yystart = 0;
return 0; // eof reached
}
}
}
}

View file

@ -0,0 +1,16 @@
/************************************************************
yycgetch.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "clex.h"
int yylexer::yygetchar()
{
yyassert(yyin != NULL);
return getc(yyin);
}

View file

@ -0,0 +1,16 @@
/************************************************************
yycgtok.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
#include "clex.h"
int yyparser::yygettoken()
{
yyassert(yylexerptr != NULL);
return yylexerptr->yylex();
}

View file

@ -0,0 +1,38 @@
/************************************************************
yycinput.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "clex.h"
int yylexer::yyinput()
{
int ch;
if (yyunputindex > 0) {
ch = yyunputbufptr[--yyunputindex];
}
else {
ch = yygetchar();
}
if (ch == '\n') {
yylineno++;
}
#ifdef YYDEBUG
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: input: \'", (void*)this);
yydebugoutput(string);
yydebugoutput(ch);
yydebugoutput("\'\n");
}
#endif
return ch;
}

View file

@ -0,0 +1,35 @@
/************************************************************
yyclcln.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <malloc.h>
#include "clex.h"
void yylexer::yycleanup()
{
if (yytext != yystext) {
free(yytext);
yytext = yystext;
}
if (yystatebuf != yysstatebuf) {
free(yystatebuf);
yystatebuf = yysstatebuf;
}
if (yyunputbufptr != yysunputbufptr) {
free(yyunputbufptr);
yyunputbufptr = yysunputbufptr;
}
yytext_size = yystext_size;
yyunput_size = yysunput_size;
if (yytext != NULL) {
*yytext = '\0';
}
yyleng = 0;
yyunputindex = 0;
}

View file

@ -0,0 +1,50 @@
/************************************************************
yyclcon.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
yylexer::yylexer()
{
yystart = 0;
yyeol = 1;
yyoldeol = 1;
yystatebuf = NULL;
yysstatebuf = NULL;
yystext = NULL;
yytext_size = 0;
yystext_size = 0;
yyunputbufptr = NULL;
yysunputbufptr = NULL;
yyunput_size = 0;
yysunput_size = 0;
yyunputindex = 0;
yymoreflg = 0;
yyrejectflg = 0;
yyreturnflg = 0;
yyparserptr = NULL;
yytextgrow = 1;
yyunputgrow = 1;
yyin = stdin;
yyout = stdout;
yyerr = stderr;
yytext = NULL;
yyleng = 0;
yylineno = 1;
// debugging
#ifdef YYDEBUG
yydebug = 0;
yydebugflush = 0;
yydebugout = stdout;
#endif
}
yylexer::~yylexer()
{
yydestroy();
}

View file

@ -0,0 +1,82 @@
/************************************************************
yyclcrea.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
#include <stdlib.h>
int yylexer::yycreate(yyparser YYFAR* parserptr)
{
yyparserptr = parserptr;
size_t textcharsize;
size_t statebufcharsize;
size_t unputbufcharsize;
// get sizes first
textcharsize = yystext_size + 1; // include the '\0'
if (textcharsize <= (size_t)yystext_size) {
return 0; // integer overflow
}
if (yystext_size != 0) {
statebufcharsize = yystext_size * sizeof(int);
if ((int)(statebufcharsize / sizeof(int)) != yystext_size) {
return 0; // integer overflow
}
}
else {
statebufcharsize = 0;
}
if (yysunput_size != 0) {
unputbufcharsize = yysunput_size * sizeof(int);
if ((int)(unputbufcharsize / sizeof(int)) != yysunput_size) {
return 0; // integer overflow
}
}
else {
unputbufcharsize = 0;
}
// allocate the memory if necessary
yystext = (char YYFAR*)malloc(textcharsize);
if (yystext == NULL) {
return 0;
}
if (statebufcharsize != 0) {
yysstatebuf = (int YYFAR*)malloc(statebufcharsize);
if (yysstatebuf == NULL) {
free(yystext);
return 0;
}
}
else {
yysstatebuf = NULL;
}
if (unputbufcharsize != 0) {
yysunputbufptr = (int YYFAR*)malloc(unputbufcharsize);
if (yysunputbufptr == NULL) {
free(yystext);
free(yysstatebuf);
return 0;
}
}
else {
yysunputbufptr = NULL;
}
// assign any other variables
yytext_size = yystext_size;
yytext = yystext;
yystatebuf = yysstatebuf;
yyunput_size = yysunput_size;
yyunputbufptr = yysunputbufptr;
// makes sure we are ready to go
yyreset();
return 1;
}

View file

@ -0,0 +1,57 @@
/************************************************************
yycldbug.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "clex.h"
#ifdef YYDEBUG
void yylexer::yydmatch(int expr) const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: match: \"", (void*)this);
yydebugoutput(string);
for (int i = 0; i < yyleng; i++) {
yydebugoutput(yytext[i]);
}
sprintf(string, "\", %d\n", (int)expr);
yydebugoutput(string);
}
}
void yylexer::yydebugoutput(const char *string) const
{
yyassert(string != NULL);
#ifdef _WIN32
if (yydebugout != NULL) {
#else
yyassert(yydebugout != NULL);
#endif
while (*string != '\0') {
putc(*string++, yydebugout);
}
if (::yydebugflush || yydebugflush) {
fflush(yydebugout);
}
#ifdef _WIN32
}
else {
OutputDebugString(string);
}
#endif
}
#endif

View file

@ -0,0 +1,18 @@
/************************************************************
yycldest.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
#include <stdlib.h>
void yylexer::yydestroy()
{
yycleanup();
free(yystext);
free(yysstatebuf);
free(yysunputbufptr);
}

View file

@ -0,0 +1,23 @@
/************************************************************
yycless.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
void yylexer::yyless(int length)
{
yyassert(length >= 0 && length <= yyleng);
while (yyleng > length) {
yyunput((unsigned char)yytext[--yyleng]);
}
if (yyleng > 0) {
yyeol = (unsigned char)(yytext[yyleng - 1] == '\n');
}
else {
yyeol = yyoldeol;
}
}

View file

@ -0,0 +1,34 @@
/************************************************************
yycoutpt.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include <limits.h>
#include "clex.h"
void yylexer::yyoutput(int ch)
{
// debugging
#ifdef YYDEBUG
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: output: \'", (void*)this);
yydebugoutput(string);
yydebugoutput(ch);
yydebugoutput("\'\n");
}
#endif
yyassert(yyout != NULL);
#ifdef __BORLANDC__
putc((char)ch, yyout);
#else
putc(ch, yyout);
#endif
}

View file

@ -0,0 +1,18 @@
/************************************************************
yycparse.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
int yyparser::yyparse()
{
int n = yysetup();
if (n != 0) {
return n;
}
return yywork();
}

View file

@ -0,0 +1,25 @@
/************************************************************
yycpcln.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include "cyacc.h"
void yyparser::yycleanup()
{
if (yystackptr != yysstackptr) {
free(yystackptr);
yystackptr = yysstackptr;
}
if (yyattributestackptr != yysattributestackptr) {
free(yyattributestackptr);
yyattributestackptr = yysattributestackptr;
}
yystack_size = yysstack_size;
yytop = -1;
}

View file

@ -0,0 +1,50 @@
/************************************************************
yycpcon.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
yyparser::yyparser()
{
yystackptr = NULL;
yysstackptr = NULL;
yyattributestackptr = NULL;
yysattributestackptr = NULL;
yystack_size = 0;
yysstack_size = 0;
yytop = -1;
yyattribute_size = 0;
yyvalptr = NULL;
yylookahead = 0;
yychar = -1;
yywipeflg = 1;
yypopflg = 0;
yyskip = 0;
yyexitflg = 0;
yyretireflg = 0;
yyerrorflg = 0;
yyexitcode = 0;
yyretirecode = 0;
yyerrorpop = 0;
yylexerptr = NULL;
yystackgrow = 1;
yylvalptr = NULL;
yyerr = stderr;
yyerrorcount = 0;
#ifdef YYDEBUG
yydebug = 0;
yydebugstack = 0;
yydebugflush = 0;
yydebugout = stdout;
#endif
}
yyparser::~yyparser()
{
yydestroy();
}

View file

@ -0,0 +1,66 @@
/************************************************************
yycpcrea.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
#include <stdlib.h>
int yyparser::yycreate(yylexer YYFAR* lexerptr)
{
yylexerptr = lexerptr;
// stack
if (yysstack_size != 0) {
size_t stackcharsize;
size_t attributestackcharsize;
stackcharsize = yysstack_size * sizeof(yystack_t);
if ((int)(stackcharsize / sizeof(yystack_t)) != yysstack_size) {
return 0; // integer overflow
}
attributestackcharsize = yysstack_size * yyattribute_size;
if ((int)(attributestackcharsize / yyattribute_size) != yysstack_size) {
return 0; // integer overflow
}
yysstackptr = (yystack_t YYFAR*)malloc(stackcharsize);
if (yysstackptr == NULL) {
return 0;
}
yysattributestackptr = malloc(attributestackcharsize);
if (yysattributestackptr == NULL) {
free(yysstackptr);
return 0;
}
}
else {
yysstackptr = NULL;
yysattributestackptr = NULL;
}
yystack_size = yysstack_size;
yystackptr = yysstackptr;
yyattributestackptr = yysattributestackptr;
// yylval
yylvalptr = malloc(yyattribute_size);
if (yylvalptr == NULL) {
free(yysstackptr);
free(yysattributestackptr);
return 0;
}
// yyval ($$)
yyvalptr = malloc(yyattribute_size);
if (yyvalptr == NULL) {
free(yysstackptr);
free(yysattributestackptr);
free(yylvalptr);
return 0;
}
return 1;
}

View file

@ -0,0 +1,189 @@
/************************************************************
yycpdbug.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "cyacc.h"
#ifdef YYDEBUG
const char* yyparser::yytokenstring(int token) const
{
yyassert(token >= 0);
const yysymbol_t YYNEARFAR* symbol = yysymbol;
while (symbol->name != NULL) {
if (symbol->token == token) {
return symbol->name;
}
symbol++;
}
return "illegal-token";
}
void yyparser::yydgettoken(int token) const
{
yyassert(token >= 0);
if (::yydebug || yydebug) {
char string[128];
const char* tokenstring = yytokenstring(token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: get token ", (void*)this);
yydebugoutput(string);
yydebugoutput(tokenstring);
sprintf(string, " (%d)\n", (int)token);
yydebugoutput(string);
}
}
void yyparser::yydshift(int token) const
{
yyassert(token >= 0);
if (::yydebug || yydebug) {
char string[128];
const char* tokenstring = yytokenstring(token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: shift token ", (void*)this);
yydebugoutput(string);
yydebugoutput(tokenstring);
sprintf(string, " (%d)\n", (int)token);
yydebugoutput(string);
}
}
void yyparser::yydreduce(int rule) const
{
yyassert(rule >= 0);
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: reduce rule ", (void*)this);
yydebugoutput(string);
yydebugoutput(yyrule[rule]);
sprintf(string, " (%d)\n", (int)rule);
yydebugoutput(string);
}
}
void yyparser::yydsyntaxerror() const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: syntax error\n", (void*)this);
yydebugoutput(string);
}
}
void yyparser::yydaccept() const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: accept\n", (void*)this);
yydebugoutput(string);
}
}
void yyparser::yydabort() const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: abort\n", (void*)this);
yydebugoutput(string);
}
}
void yyparser::yyddiscard(int token) const
{
yyassert(token >= 0);
if (::yydebug || yydebug) {
char string[128];
const char* tokenstring = yytokenstring(token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: discard token ", (void*)this);
yydebugoutput(string);
yydebugoutput(tokenstring);
sprintf(string, " (%d)\n", (int)token);
yydebugoutput(string);
}
}
void yyparser::yydexit(int exitcode) const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: exit with code %d\n", (void*)this, (int)exitcode);
yydebugoutput(string);
}
}
void yyparser::yydthrowerror(int errorpop) const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: throw error and pop %d error handling state(s)\n",
(void*)this, (int)errorpop);
yydebugoutput(string);
}
}
void yyparser::yydretire(int retirecode) const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: retire with code %d\n", (void*)this, (int)retirecode);
yydebugoutput(string);
}
}
void yyparser::yydattemptrecovery() const
{
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: attempting error recovery\n", (void*)this);
yydebugoutput(string);
}
}
void yyparser::yydebugoutput(const char *string) const
{
yyassert(string != NULL);
#ifdef _WIN32
if (yydebugout != NULL) {
#else
yyassert(yydebugout != NULL);
#endif
while (*string != '\0') {
putc(*string++, yydebugout);
}
if (::yydebugflush || yydebugflush) {
fflush(yydebugout);
}
#ifdef _WIN32
}
else {
OutputDebugString(string);
}
#endif
}
#endif

View file

@ -0,0 +1,20 @@
/************************************************************
yycpdest.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
#include <stdlib.h>
void yyparser::yydestroy()
{
yycleanup();
free(yysstackptr);
free(yysattributestackptr);
free(yylvalptr);
free(yyvalptr);
}

View file

@ -0,0 +1,33 @@
/************************************************************
yycpop.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
#ifdef YYDEBUG
void yyparser::yypop(int num)
{
yyassert(num >= 0);
yytop -= num;
yyassert(yytop >= -1);
// debugging
if (::yydebug || yydebug) {
if (num > 0) {
char string[128];
sprintf(string, "%p: pop %d state(s)", (void*)this, (int)num);
yydebugoutput(string);
if (yytop >= 0) {
sprintf(string, " uncovering state %d", (int)yystackptr[yytop]);
yydebugoutput(string);
}
yydebugoutput("\n");
}
}
}
#endif

View file

@ -0,0 +1,98 @@
/************************************************************
yycpush.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "cyacc.h"
int yyparser::yypush(yystack_t state)
{
yytop++; // increment first
if (yytop == yystack_size) {
do {
if (yystackgrow) {
if (yystack_size != 0) {
int size = yystack_size * 2;
if (size / 2 == yystack_size) { // overflow check
if (yysetstacksize(size)) {
break;
}
}
}
else {
if (yysetstacksize(100)) {
break;
}
}
}
yytop--;
// debugging
#ifdef YYDEBUG
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: stack overflow\n", (void*)this);
yydebugoutput(string);
}
#endif
yystackoverflow();
return 0;
}
while (0);
}
yystackptr[yytop] = state;
// debugging
#ifdef YYDEBUG
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: push state %d", (void*)this, (int)state);
yydebugoutput(string);
if (yytop > 0) {
sprintf(string, " covering state %d", (int)yystackptr[yytop - 1]);
yydebugoutput(string);
}
yydebugoutput("\n");
// output stack contents
if (::yydebugstack || yydebugstack) {
yydebugoutput("\nstack");
int n = sprintf(string, "\n +");
int i;
for (i = 0; i < 10; i++) {
n += sprintf(&string[n], " %5d", (int) i);
}
yydebugoutput(string);
int rows = 1;
if (yytop >= 0) {
rows += yytop / 10;
}
for (i = 0; i < rows; i++) {
n = sprintf(string, "\n %5d", (int) (10 * i));
for (int j = 0; j < 10; j++) {
int index = 10 * i + j;
if (index <= yytop) {
n += sprintf(&string[n], " %5d", (int) yystackptr[index]);
}
else {
n += sprintf(&string[n], " -");
}
}
yydebugoutput(string);
}
yydebugoutput("\n\n");
}
}
#endif
return 1;
}

View file

@ -0,0 +1,21 @@
/************************************************************
yycreset.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
void yylexer::yyreset()
{
yyleng = 0;
yylineno = 1;
yyunputindex = 0;
yymoreflg = 0;
yyrejectflg = 0;
yyeol = 1;
yyoldeol = 1;
yystart = 0;
}

View file

@ -0,0 +1,18 @@
/************************************************************
yycsetin.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
void yyparser::yysetin(int token)
{
if (token < 0) {
token = 0;
}
yychar = token;
yylookahead = 1;
}

View file

@ -0,0 +1,29 @@
/************************************************************
yycsetup.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
int yyparser::yysetup()
{
// initialise variables
yytop = -1;
yylookahead = 0;
yyskip = 0;
yyerrorcount = 0;
yychar = -1;
yypopflg = 0;
// push initial state onto the stack
if (!yypush(0)) {
#ifdef YYDEBUG
yydabort();
#endif
return 1;
}
return 0;
}

View file

@ -0,0 +1,15 @@
/************************************************************
yycsoflw.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include "cyacc.h"
void yyparser::yystackoverflow()
{
yyerror("yacc stack overflow");
}

View file

@ -0,0 +1,39 @@
/************************************************************
yycsskip.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "cyacc.h"
#ifdef YYDEBUG
void yyparser::yysetskip(int skip)
{
yyassert(skip >= 0);
// debugging
if (::yydebug || yydebug) {
if (skip > 0) {
if (yyskip == 0) {
char string[128];
sprintf(string, "%p: entering error recovery\n", (void*)this);
yydebugoutput(string);
}
}
else {
if (yyskip > 0) {
char string[128];
sprintf(string, "%p: leaving error recovery\n", (void*)this);
yydebugoutput(string);
}
}
}
yyskip = skip;
}
#endif

View file

@ -0,0 +1,85 @@
/************************************************************
yycsssiz.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "cyacc.h"
#ifndef min
#define min(x, y) ((x) <= (y) ? (x) : (y))
#endif
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
int yyparser::yysetstacksize(int size)
{
yyassert(size >= 0);
if (yystack_size != size) {
if (size <= yytop) {
return 0;
}
size_t stackcharsize = size * sizeof(yystack_t);
if ((int)(stackcharsize / sizeof(yystack_t)) != size) {
return 0; // integer overflow
}
size_t attributestackcharsize = size * yyattribute_size;
if ((int)(attributestackcharsize / yyattribute_size) != size) {
return 0; // integer overflow
}
// allocate
yystack_t YYFAR* stackptr;
void YYFAR* attributestackptr;
if (size <= yysstack_size) {
stackptr = yysstackptr;
attributestackptr = yysattributestackptr;
}
else {
stackptr = (yystack_t YYFAR*)malloc(stackcharsize);
if (stackptr == NULL) {
return 0;
}
attributestackptr = malloc(attributestackcharsize);
if (attributestackptr == NULL) {
free(stackptr); // clean up
return 0;
}
}
// copy
if (stackptr != yystackptr) {
size_t charsize = yystack_size * sizeof(yystack_t);
memcpy(stackptr, yystackptr, min(stackcharsize, charsize));
}
if (attributestackptr != yyattributestackptr) {
size_t charsize = yystack_size * yyattribute_size;
memcpy(attributestackptr, yyattributestackptr, min(attributestackcharsize,
charsize));
}
// free
if (yystackptr != yysstackptr) {
free(yystackptr);
}
if (yyattributestackptr != yysattributestackptr) {
free(yyattributestackptr);
}
// assign
yystackptr = stackptr;
yyattributestackptr = attributestackptr;
yystack_size = size;
}
return 1;
}

View file

@ -0,0 +1,84 @@
/************************************************************
yycstsiz.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "clex.h"
#ifndef min
#define min(x, y) ((x) <= (y) ? (x) : (y))
#endif
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
int yylexer::yysettextsize(int size)
{
yyassert(size >= 0);
if (yytext_size != size) {
if (size < yyleng) {
return 0;
}
size_t textcharsize = size + 1; // include the '\0'
if (textcharsize <= (size_t) size) {
return 0; // integer overflow
}
size_t statebufcharsize = size * sizeof(int);
if ((int)(statebufcharsize / sizeof(int)) != size) {
return 0; // integer overflow
}
// allocate
char YYFAR* text;
int YYFAR* statebuf;
if (size <= yystext_size) {
text = yystext;
statebuf = yysstatebuf;
}
else {
text = (char YYFAR*)malloc(textcharsize);
if (text == NULL) {
return 0;
}
statebuf = (int YYFAR*)malloc(statebufcharsize);
if (statebuf == NULL) {
free(text); // clean up
return 0;
}
}
// copy
if (text != yytext) {
size_t charsize = yytext_size + 1;
memcpy(text, yytext, min(textcharsize, charsize));
}
if (statebuf != yystatebuf) {
size_t charsize = yytext_size * sizeof(int);
memcpy(statebuf, yystatebuf, min(statebufcharsize, charsize));
}
// free
if (yytext != yystext) {
free(yytext);
}
if (yystatebuf != yysstatebuf) {
free(yystatebuf);
}
// assign
yytext = text;
yystatebuf = statebuf;
yytext_size = size;
}
return 1;
}

View file

@ -0,0 +1,65 @@
/************************************************************
yycsusiz.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "clex.h"
#ifndef min
#define min(x, y) ((x) <= (y) ? (x) : (y))
#endif
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
int yylexer::yysetunputsize(int size)
{
yyassert(size >= 0);
if (yyunput_size != size) {
if (size < yyunputindex) {
return 0;
}
size_t unputbufcharsize = size * sizeof(int);
if ((int)(unputbufcharsize / sizeof(int)) != size) {
return 0; // integer overflow
}
// allocate
int YYFAR* unputbufptr;
if (size <= yysunput_size) {
unputbufptr = yysunputbufptr;
}
else {
unputbufptr = (int YYFAR*)malloc(unputbufcharsize);
if (unputbufptr == NULL) {
return 0;
}
}
// copy
if (unputbufptr != yyunputbufptr) {
size_t charsize = yyunput_size * sizeof(int);
memcpy(unputbufptr, yyunputbufptr, min(unputbufcharsize, charsize));
}
// free
if (yyunputbufptr != yysunputbufptr) {
free(yyunputbufptr);
}
// assign
yyunputbufptr = unputbufptr;
yyunput_size = size;
}
return 1;
}

View file

@ -0,0 +1,14 @@
/************************************************************
yycsyner.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
void yyparser::yysyntaxerror(void)
{
yyerror("syntax error");
}

View file

@ -0,0 +1,15 @@
/************************************************************
yyctoflw.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
void yylexer::yytextoverflow()
{
yyassert(yyerr != NULL);
fprintf(yyerr, "lex text buffer overflow (%d)\n", (int)yytext_size);
}

View file

@ -0,0 +1,18 @@
/************************************************************
yycuncin.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "cyacc.h"
int yyparser::yyunclearin()
{
if (!yylookahead && yychar != -1) {
yylookahead = 1;
return 1;
}
return 0;
}

View file

@ -0,0 +1,62 @@
/************************************************************
yycunput.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "clex.h"
void yylexer::yyunput(int ch)
{
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
yyassert(yyunputindex >= 0 && yyunputindex <= yyunput_size);
// check unput buffer size
if (yyunputindex == yyunput_size) {
do {
if (yyunputgrow) {
if (yyunput_size != 0) {
int size = yyunput_size * 2;
if (size / 2 == yyunput_size) { // overflow check
if (yysetunputsize(size)) {
break;
}
}
}
else {
if (yysetunputsize(100)) {
break;
}
}
}
yyunputoverflow();
exit(EXIT_FAILURE);
}
while (0);
}
yyunputbufptr[yyunputindex++] = ch;
// check line number
if (ch == '\n') {
yylineno--;
}
// debugging
#ifdef YYDEBUG
if (::yydebug || yydebug) {
char string[128];
sprintf(string, "%p: unput: \'", (void*)this);
yydebugoutput(string);
yydebugoutput(ch);
yydebugoutput("\'\n");
}
#endif
}

View file

@ -0,0 +1,15 @@
/************************************************************
yycuoflw.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
void yylexer::yyunputoverflow()
{
yyassert(yyerr != NULL);
fprintf(yyerr, "lex unput buffer overflow (%d)\n", (int)yyunput_size);
}

View file

@ -0,0 +1,16 @@
/************************************************************
yycwipe.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
void yyparser::yywipe()
{
yydestructpop(yytop + 1);
yydestructclearin();
}

View file

@ -0,0 +1,290 @@
/************************************************************
yycwork.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "cyacc.h"
// the Visual C++ v1.52 compiler generates an error in NT if this isn't present!
#ifdef _MSC_VER
#if defined(M_I86HM) && defined(NDEBUG)
#pragma function(memcpy)
#endif
#endif
int yyfparser::yywork()
{
int errorpop = 0;
while (1) {
unsigned char type;
short sr;
yystack_t state = yypeek(); // get top state
while (1) {
if (yystateaction[state].lookahead) {
int index;
if (!yylookahead) {
yychar = yygettoken();
if (yychar < 0) {
yychar = 0;
}
yylookahead = 1;
#ifdef YYDEBUG
yydgettoken(yychar);
#endif
}
index = yystateaction[state].base + yychar;
if (index >= 0 && index < yytokenaction_size) {
if (yytokenaction[index].check == state) {
type = yytokenaction[index].type;
sr = yytokenaction[index].sr;
break; // escape from loop
}
}
}
type = yystateaction[state].type;
sr = yystateaction[state].sr;
if (type != YYAT_DEFAULT) {
break; // escape from loop
}
state = sr;
}
// action
switch (type) {
case YYAT_SHIFT:
#ifdef YYDEBUG
yydshift(yychar);
#endif
if (yyskip > 0) {
yysetskip(yyskip - 1);
}
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
memcpy(&((char YYFAR*)yyattributestackptr)[yytop * yyattribute_size],
yylvalptr, yyattribute_size);
yylookahead = 0;
continue; // go to top of while loop
case YYAT_REDUCE:
#ifdef YYDEBUG
yydreduce(sr);
#endif
yyretireflg = 0;
if (yyreduction[sr].action != -1) {
// user actions in here
if (yyreduction[sr].length > 0) {
memcpy(yyvalptr, &((char YYFAR*)yyattributestackptr)
[(yytop + 1 - yyreduction[sr].length) * yyattribute_size],
yyattribute_size);
}
yyerrorflg = 0;
yyexitflg = 0;
yyaction(yyreduction[sr].action);
// check for special user requected actions
if (yyexitflg) {
#ifdef YYDEBUG
yydexit(yyexitcode);
#endif
return yyexitcode;
}
if (yyerrorflg) {
errorpop = yyerrorpop;
#ifdef YYDEBUG
yydthrowerror(yyerrorpop);
#endif
yyerrorcount++;
break; // go to error handler
}
}
yypop(yyreduction[sr].length);
{
yystack_t state = yypeek(); // get top state
short next;
int nonterm = yyreduction[sr].nonterm;
while (1) {
int index = yystategoto[state].base + nonterm;
if (index >= 0 && index < yynontermgoto_size) {
if (yynontermgoto[index].check == state) {
next = yynontermgoto[index].next;
break;
}
}
next = yystategoto[state].def;
if (next == -1) {
break;
}
state = next;
}
yyassert(next != -1);
if (!yypush(next)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
if (yyreduction[sr].action != -1) {
memcpy(&((char YYFAR*)yyattributestackptr)[yytop * yyattribute_size],
yyvalptr, yyattribute_size);
}
if (yyretireflg) {
#ifdef YYDEBUG
yydretire(yyretirecode);
#endif
return yyretirecode;
}
continue; // go to top of while loop
case YYAT_ERROR:
#ifdef YYDEBUG
yydsyntaxerror();
#endif
if (yyskip == 0) {
yyerrorcount++;
yysyntaxerror();
}
break; // go to error handler
default:
yyassert(type == YYAT_ACCEPT);
#ifdef YYDEBUG
yydaccept();
#endif
return 0;
}
// error handler
if (yyskip < 3 || errorpop > 0) {
#ifdef YYDEBUG
yydattemptrecovery();
#endif
yypopflg = 0; // clear flag
while (1) {
state = yypeek(); // get top state
while (1) {
if (yystateaction[state].lookahead) {
int index = yystateaction[state].base + YYTK_ERROR;
if (index >= 0 && index < yytokenaction_size) {
if (yytokenaction[index].check == state) {
type = yytokenaction[index].type;
sr = yytokenaction[index].sr;
break; // escape from loop
}
}
}
type = yystateaction[state].type;
sr = yystateaction[state].sr;
if (type != YYAT_DEFAULT) {
break; // escape from loop
}
state = sr;
}
if (type == YYAT_SHIFT) {
if (errorpop <= 0) {
#ifdef YYDEBUG
yydshift(YYTK_ERROR);
#endif
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
yysetskip(3); // skip 3 erroneous characters
break;
}
errorpop--;
}
yypopflg = 1;
// clean up any symbol attributes
if (yydestructorptr != NULL) {
int action;
state = yypeek();
action = yydestructorptr[state];
if (action != -1) {
// user actions in here
memcpy(yyvalptr, &((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyattribute_size);
yyaction(action);
memcpy(&((char YYFAR*)yyattributestackptr)
[yytop * yyattribute_size], yyvalptr, yyattribute_size);
}
}
yypop(1);
if (yytop < 0) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
}
else {
if (yylookahead) {
if (yychar != 0) {
#ifdef YYDEBUG
yyddiscard(yychar);
#endif
yydiscard(yychar);
// clean up any token attributes
if (yytokendestptr != NULL) {
int index = yytokendestbase + yychar;
if (index >= 0 && index < yytokendest_size) {
int action = yytokendestptr[index];
if (action != -1) {
// user actions in here
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyaction(action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
}
}
}
yylookahead = 0; // skip erroneous character
}
else {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yywipe(); // clean up
}
return 1;
}
}
}
}
}

View file

@ -0,0 +1,14 @@
/************************************************************
yycwrap.cpp
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "clex.h"
int yylexer::yywrap(void)
{
return 1;
}

View file

@ -0,0 +1,18 @@
/************************************************************
yydebug.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "yacc.h"
#include "lex.h"
#include "myacc.h"
#include "mlex.h"
#ifdef YYDEBUG
int YYNEAR YYDCDECL yydebug = 0;
int YYNEAR YYDCDECL yydebugstack = 0; /* parsers only */
int YYNEAR YYDCDECL yydebugflush = 0;
#endif

View file

@ -0,0 +1,27 @@
/************************************************************
yymback.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymback(YYCONST yymatch_t YYNEARFAR *p, int action)
#else
int YYCDECL yymback(p, action)
YYCONST yymatch_t YYNEARFAR *p;
int action;
#endif
{
yyassert(p != NULL);
yyassert(action < 0);
while (*p != 0) {
if (*p++ == action) {
return 1;
}
}
return 0;
}

View file

@ -0,0 +1,41 @@
/************************************************************
yymcdeci.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymcdestructclearin(yymparse_t YYFAR *yy)
#else
void YYCDECL yymcdestructclearin(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymiscompactparser(yy)); /* make sure it's a compact parser */
if (yy->yymlookahead) {
/* clean up any token attributes */
if (yy->yymctokendestptr != NULL) {
YYCONST yyctokendest_t YYNEARFAR *tokendestptr = yy->yymctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yy->yymchar) {
/* user actions in here */
memcpy(yy->yymvalptr, yy->yymlvalptr, yy->yymattribute_size);
(*yy->yymparseaction)(yy, tokendestptr->action);
memcpy(yy->yymlvalptr, yy->yymvalptr, yy->yymattribute_size);
break;
}
tokendestptr++;
}
}
yy->yymlookahead = 0;
}
}

View file

@ -0,0 +1,236 @@
/************************************************************
yymclex.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymclex(yymlex_t YYFAR *yy)
#else
int YYCDECL yymclex(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymiscompactlexer(yy)); /* make sure it's a compact lexical analyser */
while (1) {
int oldleng;
int state = 1 + yy->yymstart;
if (yy->yymeol) {
state++;
}
/* yymore */
if (yy->yymmoreflg) {
yy->yymmoreflg = 0; /* clear flag */
}
else {
yy->yymleng = 0;
yy->yymoldeol = yy->yymeol;
}
oldleng = yy->yymleng;
/* look for a string */
do {
int index;
int ch; /* lookahead character */
/* get input character */
ch = (*yy->yyminput)(yy);
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
if (ch == EOF) {
break;
}
/* check for possible overflow */
if (yy->yymleng == yy->yymtext_size) {
do {
if (yy->yymtextgrow) {
if (yy->yymtext_size != 0) {
int size = yy->yymtext_size * 2;
if (size / 2 == yy->yymtext_size) { /* overflow check */
if (yymsettextsize(yy, size)) {
break;
}
}
}
else {
if (yymsettextsize(yy, 100)) {
break;
}
}
}
(*yy->yymtextoverflow)(yy);
exit(EXIT_FAILURE);
}
while (0);
}
/* handles eof condition automatically */
index = yy->yymstate[state].base;
while (1) {
if (yy->yymctransition[index].next == 0) {
state = yy->yymstate[state].def;
if (state <= 0) {
if (state < 0) {
if (ch >= 0 && ch <= 0xff) {
state = -state;
}
else {
state = 0;
}
}
break;
}
}
if (ch >= yy->yymctransition[index].first &&
ch <= yy->yymctransition[index].last) {
state = yy->yymctransition[index].next;
break;
}
index++;
}
{
int leng = yy->yymleng; /* slightly more efficient */
yy->yymtext[leng] = (char) ch;
yy->yymstatebuf[leng] = state;
leng++;
yy->yymleng = leng;
}
}
while (state != 0 && (yy->yymstate[state].def != 0 || yy->yymstate[state].base != 0));
/* now find a match */
if (yy->yymleng > oldleng) {
int rejectmatch = 0;
while (1) {
int match = yy->yymstate[yy->yymstatebuf[yy->yymleng - 1]].match;
if (rejectmatch != 0) {
if (match < 0) {
int index = -match;
do {
match = yy->yymmatch[index++];
}
while (match > 0 && match <= rejectmatch);
}
else {
if (match == rejectmatch) {
match = 0;
}
}
rejectmatch = 0;
}
else {
if (match < 0) {
match = yy->yymmatch[-match];
}
}
if (match > 0) {
int rejectleng;
int token;
/* check for backup */
if (yy->yymbackup[match]) {
while (yy->yymleng > oldleng) {
int index = yy->yymstate[yy->yymstatebuf[yy->yymleng - 1]].match;
if (index < 0) {
if (yymback(&yy->yymmatch[-index], -match)) {
break; /* found an expression */
}
}
yy->yymleng--;
(*yy->yymunput)(yy, (unsigned char) yy->yymtext[yy->yymleng]);
}
}
yy->yymtext[yy->yymleng] = '\0';
#ifdef YYDEBUG
yymdmatch(yy, match);
#endif
yy->yymrejectflg = 0;
rejectleng = yy->yymleng;
if (yy->yymleng > 0) {
yy->yymeol = (unsigned char) (yy->yymtext[yy->yymleng - 1] == '\n');
}
else {
yy->yymeol = yy->yymoldeol;
}
/* perform user action */
token = (*yy->yymlexaction)(yy, match);
if (yy->yymreturnflg) {
return token;
}
if (!yy->yymrejectflg) {
break;
}
if (rejectleng == yy->yymleng) {
rejectmatch = match;
}
}
else if (yy->yymleng > oldleng + 1) {
yy->yymleng--;
(*yy->yymunput)(yy, (unsigned char) yy->yymtext[yy->yymleng]);
}
else {
yy->yymeol = (unsigned char) (yy->yymtext[0] == '\n');
(*yy->yymoutput)(yy, yy->yymtext[0]); /* non-matched character */
break;
}
}
}
else {
int index;
int match;
yyassert(yy->yymleng == oldleng);
/* handles <<EOF>> rules */
index = 0;
match = yy->yymstate[state].match;
if (match < 0) {
index = -match;
match = yy->yymmatch[index++];
}
while (match > 0) {
int token;
yy->yymtext[yy->yymleng] = '\0';
#ifdef YYDEBUG
yymdmatch(yy, match);
#endif
yy->yymrejectflg = 0; /* clear flag */
/* perform user action */
token = (*yy->yymlexaction)(yy, match);
if (yy->yymreturnflg) {
return token;
}
if (!yy->yymrejectflg) {
break;
}
if (index == 0) {
break;
}
match = yy->yymmatch[index++];
}
if ((*yy->yymwrap)(yy)) {
yy->yymoldeol = 1;
yy->yymeol = 1;
yy->yymstart = 0;
return 0; /* eof reached */
}
}
}
}

View file

@ -0,0 +1,27 @@
/************************************************************
yymcpars.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymcparse(yymparse_t YYFAR *yy)
#else
int YYCDECL yymcparse(yy)
yymparse_t YYFAR *yy;
#endif
{
int n;
yyassert(yy != NULL);
yyassert(yymiscompactparser(yy)); /* make sure it's a compact parser */
n = yymsetup(yy);
if (n != 0) {
return n;
}
return yymcwork(yy);
}

View file

@ -0,0 +1,24 @@
/************************************************************
yymcwipe.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymcwipe(yymparse_t YYFAR *yy)
#else
void YYCDECL yymcwipe(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymiscompactparser(yy)); /* make sure it's a compact parser */
yymdestructpop(yy, yy->yymtop + 1);
yymcdestructclearin(yy);
}

View file

@ -0,0 +1,293 @@
/************************************************************
yymcwork.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymcwork(yymparse_t YYFAR *yy)
#else
int YYCDECL yymcwork(yy)
yymparse_t YYFAR *yy;
#endif
{
int errorpop = 0;
yyassert(yy != NULL);
yyassert(yymiscompactparser(yy)); /* make sure it's a compact parser */
while (1) {
unsigned char type;
short sr;
yystack_t state = yympeek(yy); /* get top state */
int index = yy->yymcstateaction[state];
while (1) {
if (yy->yymctokenaction[index].token == YYTK_ALL) {
if (yy->yymctokenaction[index].type == YYAT_DEFAULT) {
state = yy->yymctokenaction[index].sr;
index = yy->yymcstateaction[state];
continue;
}
break;
}
if (!yy->yymlookahead) {
yy->yymlookahead = 1;
yy->yymchar = (*yy->yymgettoken)(yy);
if (yy->yymchar < 0) {
yy->yymchar = 0;
}
#ifdef YYDEBUG
yymdgettoken(yy, yy->yymchar);
#endif
}
if (yy->yymctokenaction[index].token == yy->yymchar) {
break;
}
index++;
}
type = yy->yymctokenaction[index].type;
sr = yy->yymctokenaction[index].sr;
/* action */
switch (type) {
case YYAT_SHIFT:
#ifdef YYDEBUG
yymdshift(yy, yy->yymchar);
#endif
if (yy->yymskip > 0) {
yymsetskip(yy, yy->yymskip - 1);
}
if (!yympush(yy, sr)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymcwipe(yy); /* clean up */
}
return 1;
}
memcpy(&((char YYFAR *) yy->yymattributestackptr)[yy->yymtop *
yy->yymattribute_size], yy->yymlvalptr, yy->yymattribute_size);
yy->yymlookahead = 0;
continue; /* go to top of while loop */
case YYAT_REDUCE:
#ifdef YYDEBUG
yymdreduce(yy, sr);
#endif
yy->yymretireflg = 0;
if (yy->yymreduction[sr].action != -1) {
/* user actions in here */
if (yy->yymreduction[sr].length > 0) {
memcpy(yy->yymvalptr, &((char YYFAR *) yy->yymattributestackptr)
[(yy->yymtop + 1 - yy->yymreduction[sr].length) *
yy->yymattribute_size], yy->yymattribute_size);
}
yy->yymerrorflg = 0;
yy->yymexitflg = 0;
(*yy->yymparseaction)(yy, yy->yymreduction[sr].action);
/* check for special user requected actions */
if (yy->yymexitflg) {
#ifdef YYDEBUG
yymexit(yy, yy->yymexitcode);
#endif
return yy->yymexitcode;
}
if (yy->yymerrorflg) {
errorpop = yy->yymerrorpop;
#ifdef YYDEBUG
yymdthrowerror(yy, yy->yymerrorpop);
#endif
yy->yymerrorcount++;
break; /* go to error handler */
}
}
yympop(yy, yy->yymreduction[sr].length);
{
yystack_t state = yympeek(yy); /* get top state */
short next;
int nonterm = yy->yymreduction[sr].nonterm;
int index = yy->yymcstategoto[state];
while (1) {
if (yy->yymcnontermgoto[index].nonterm == -1) {
if (yy->yymcnontermgoto[index].next != -1) {
state = yy->yymcnontermgoto[index].next;
index = yy->yymcstategoto[state];
continue;
}
break;
}
if (yy->yymcnontermgoto[index].nonterm == nonterm) {
break;
}
index++;
}
next = yy->yymcnontermgoto[index].next;
yyassert(next != -1);
if (!yympush(yy, next)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymcwipe(yy); /* clean up */
}
return 1;
}
}
if (yy->yymreduction[sr].action != -1) {
memcpy(&((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size],
yy->yymvalptr, yy->yymattribute_size);
}
if (yy->yymretireflg) {
#ifdef YYDEBUG
yymdretire(yy, yy->yymretirecode);
#endif
return yy->yymretirecode;
}
continue; /* go to top of while loop */
case YYAT_ERROR:
#ifdef YYDEBUG
yymdsyntaxerror(yy);
#endif
if (yy->yymskip == 0) {
yy->yymerrorcount++;
(*yy->yymsyntaxerror)(yy);
}
break; /* go to error handler */
default:
yyassert(type == YYAT_ACCEPT);
#ifdef YYDEBUG
yymdaccept(yy);
#endif
return 0;
}
/* error handler */
if (yy->yymskip < 3 || errorpop > 0) {
#ifdef YYDEBUG
yymdattemptrecovery(yy);
#endif
yy->yympopflg = 0; /* clear flag */
while (1) {
state = yympeek(yy); /* get top state */
index = yy->yymcstateaction[state];
while (1) {
if (yy->yymctokenaction[index].token == YYTK_ALL) {
if (yy->yymctokenaction[index].type == YYAT_DEFAULT) {
state = yy->yymctokenaction[index].sr;
index = yy->yymcstateaction[state];
continue;
}
break;
}
if (yy->yymctokenaction[index].token == YYTK_ERROR) {
break;
}
index++;
}
type = yy->yymctokenaction[index].type;
sr = yy->yymctokenaction[index].sr;
if (type == YYAT_SHIFT) {
if (errorpop <= 0) {
#ifdef YYDEBUG
yymdshift(yy, YYTK_ERROR);
#endif
if (!yympush(yy, sr)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymcwipe(yy); /* clean up */
}
return 1;
}
yymsetskip(yy, 3); /* skip 3 erroneous characters */
break;
}
errorpop--;
}
yy->yympopflg = 1;
/* clean up any symbol attributes */
if (yy->yymdestructorptr != NULL) {
int action;
state = yympeek(yy);
action = yy->yymdestructorptr[state];
if (action != -1) {
/* user actions in here */
memcpy(yy->yymvalptr, &((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size],
yy->yymattribute_size);
(*yy->yymparseaction)(yy, action);
memcpy(&((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size], yy->yymvalptr,
yy->yymattribute_size);
}
}
yympop(yy, 1);
if (yy->yymtop < 0) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymcwipe(yy); /* clean up */
}
return 1;
}
}
}
else {
if (yy->yymlookahead) {
if (yy->yymchar != 0) {
#ifdef YYDEBUG
yymddiscard(yy, yy->yymchar);
#endif
(*yy->yymdiscard)(yy, yy->yymchar);
/* clean up any token attributes */
if (yy->yymctokendestptr != NULL) {
YYCONST yyctokendest_t YYNEARFAR *tokendestptr = yy->yymctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yy->yymchar) {
/* user actions in here */
memcpy(yy->yymvalptr, yy->yymlvalptr, yy->yymattribute_size);
(*yy->yymparseaction)(yy, tokendestptr->action);
memcpy(yy->yymlvalptr, yy->yymvalptr, yy->yymattribute_size);
break;
}
tokendestptr++;
}
}
yy->yymlookahead = 0; /* skip erroneous character */
}
else {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymcwipe(yy); /* clean up */
}
return 1;
}
}
}
}
}

View file

@ -0,0 +1,40 @@
/************************************************************
yymdeci.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymdestructclearin(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdestructclearin(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymisfastparser(yy)); /* make sure it's a fast parser */
if (yy->yymlookahead) {
/* clean up any token attributes */
if (yy->yymtokendestptr != NULL) {
int index = yy->yymtokendestbase + yy->yymchar;
if (index >= 0 && index < yy->yymtokendest_size) {
int action = yy->yymtokendestptr[index];
if (action != -1) {
/* user actions in here */
memcpy(yy->yymvalptr, yy->yymlvalptr, yy->yymattribute_size);
(*yy->yymparseaction)(yy, action);
memcpy(yy->yymlvalptr, yy->yymvalptr, yy->yymattribute_size);
}
}
}
yy->yymlookahead = 0;
}
}

View file

@ -0,0 +1,46 @@
/************************************************************
yymdepop.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymdestructpop(yymparse_t YYFAR *yy, int num)
#else
void YYCDECL yymdestructpop(yy, num)
yymparse_t YYFAR *yy;
int num;
#endif
{
yyassert(yy != NULL);
yyassert(num >= 0);
yyassert(yy->yymtop - num >= -1);
if (yy->yymdestructorptr != NULL) {
while (num > 0) {
yystack_t state = yympeek(yy);
int action = yy->yymdestructorptr[state];
if (action != -1) {
/* user actions in here */
memcpy(yy->yymvalptr, &((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size], yy->yymattribute_size);
(*yy->yymparseaction)(yy, action);
memcpy(&((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size], yy->yymvalptr,
yy->yymattribute_size);
}
yympop(yy, 1);
num--;
}
}
else {
yympop(yy, num);
}
}

View file

@ -0,0 +1,26 @@
/************************************************************
yymdisc.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef __BORLANDC__
#pragma argsused
#endif
#ifdef YYPROTOTYPE
void YYCDECL yymdiscard(yymparse_t YYFAR *yy, int token)
#else
void YYCDECL yymdiscard(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
yyassert(yy != NULL);
yyassert(token > 0);
/* do nothing */
}

View file

@ -0,0 +1,75 @@
/************************************************************
yymdoutp.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include <ctype.h>
#include "mlex.h"
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
void YYCDECL yymdebugoutput(yymlex_t YYFAR *yy, int ch)
#else
void YYCDECL yymdebugoutput(yy, ch)
yymlex_t YYFAR *yy;
int ch;
#endif
{
char string[32];
yyassert(yy != NULL);
switch (ch) {
case EOF:
strcpy(string, "EOF");
break;
case '\n':
strcpy(string, "\\n");
break;
case '\t':
strcpy(string, "\\t");
break;
case '\v':
strcpy(string, "\\v");
break;
case '\b':
strcpy(string, "\\b");
break;
case '\r':
strcpy(string, "\\r");
break;
case '\f':
strcpy(string, "\\f");
break;
case '\a':
strcpy(string, "\\a");
break;
case '\\':
strcpy(string, "\\");
break;
case '\?':
strcpy(string, "\\\?");
break;
case '\'':
strcpy(string, "\\\'");
break;
case '\"':
strcpy(string, "\\\"");
break;
default:
if (isascii(ch) && isgraph(ch)) {
string[0] = (char) ch;
string[1] = '\0';
}
else {
sprintf(string, "\\%03o", (unsigned int) (unsigned char) ch);
}
break;
}
yymlexdebugoutput(yy, string);
}
#endif

View file

@ -0,0 +1,25 @@
/************************************************************
yymecho.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymecho(yymlex_t YYFAR *yy)
#else
void YYCDECL yymecho(yy)
yymlex_t YYFAR *yy;
#endif
{
int i;
yyassert(yy != NULL);
for (i = 0; i < yy->yymleng; i++) {
(*yy->yymoutput)(yy, yy->yymtext[i]);
}
}

View file

@ -0,0 +1,27 @@
/************************************************************
yymerror.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymerror(yymparse_t YYFAR *yy, YYCONST char YYFAR *text)
#else
void YYCDECL yymerror(yy, text)
yymparse_t YYFAR *yy;
YYCONST char YYFAR *text;
#endif
{
yyassert(yy != NULL);
yyassert(text != NULL);
yyassert(yy->yymerr != NULL);
while (*text != '\0') {
putc(*text++, yy->yymerr);
}
putc('\n', yy->yymerr);
}

View file

@ -0,0 +1,23 @@
/************************************************************
yymgetch.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include <assert.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymgetchar(yymlex_t YYFAR *yy)
#else
int YYCDECL yymgetchar(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yy->yymin != NULL);
return getc(yy->yymin);
}

View file

@ -0,0 +1,25 @@
/************************************************************
yymgtok.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymgettoken(yymparse_t YYFAR *yy)
#else
int YYCDECL yymgettoken(yy)
yymparse_t YYFAR *yy;
#endif
{
yymlex_t YYFAR *p;
yyassert(yy != NULL);
p = (yymlex_t YYFAR *) yy->yymdata;
yyassert(p != NULL);
return yymlex(p);
}

View file

@ -0,0 +1,46 @@
/************************************************************
yyminput.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yyminput(yymlex_t YYFAR *yy)
#else
int YYCDECL yyminput(yy)
yymlex_t YYFAR *yy;
#endif
{
int ch;
yyassert(yy != NULL);
if (yy->yymunputindex > 0) {
ch = yy->yymunputbufptr[--yy->yymunputindex];
}
else {
ch = yy->yymgetchar(yy);
}
if (ch == '\n') {
yy->yymlineno++;
}
/* debugging */
#ifdef YYDEBUG
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: input: \'", (void *) yy);
yymlexdebugoutput(yy, string);
yymdebugoutput(yy, ch);
yymlexdebugoutput(yy, "\'\n");
}
#endif
return ch;
}

View file

@ -0,0 +1,41 @@
/************************************************************
yymlcln.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <malloc.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymlexcleanup(yymlex_t YYFAR *yy)
#else
void YYCDECL yymlexcleanup(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (yy->yymtext != yy->yymstext) {
free(yy->yymtext);
yy->yymtext = yy->yymstext;
}
if (yy->yymstatebuf != yy->yymsstatebuf) {
free(yy->yymstatebuf);
yy->yymstatebuf = yy->yymsstatebuf;
}
if (yy->yymunputbufptr != yy->yymsunputbufptr) {
free(yy->yymunputbufptr);
yy->yymunputbufptr = yy->yymsunputbufptr;
}
yy->yymtext_size = yy->yymstext_size;
yy->yymunput_size = yy->yymsunput_size;
if (yy->yymtext != NULL) {
*yy->yymtext = '\0';
}
yy->yymleng = 0;
yy->yymunputindex = 0;
}

View file

@ -0,0 +1,90 @@
/************************************************************
yymlcrea.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#include <stdlib.h>
#ifdef YYPROTOTYPE
int YYCDECL yymcreatelex(yymlex_t YYFAR *yy, YYCONST yymlex_t YYFAR *src)
#else
int YYCDECL yymcreatelex(yy, src)
yymlex_t YYFAR *yy;
YYCONST yymlex_t YYFAR *src;
#endif
{
size_t textcharsize;
size_t statebufcharsize;
size_t unputbufcharsize;
yyassert(yy != NULL);
yyassert(src != NULL);
*yy = *src;
/* get sizes first */
textcharsize = yy->yymstext_size + 1; /* include the '\0' */
if (textcharsize <= (size_t) yy->yymstext_size) {
return 0; /* integer overflow */
}
if (yy->yymstext_size != 0) {
statebufcharsize = yy->yymstext_size * sizeof(int);
if ((int) (statebufcharsize / sizeof(int)) != yy->yymstext_size) {
return 0; /* integer overflow */
}
}
else {
statebufcharsize = 0;
}
if (yy->yymsunput_size != 0) {
unputbufcharsize = yy->yymsunput_size * sizeof(int);
if ((int) (unputbufcharsize / sizeof(int)) != yy->yymsunput_size) {
return 0; /* integer overflow */
}
}
else {
unputbufcharsize = 0;
}
/* allocate the memory if necessary */
yy->yymstext = (char YYFAR *) malloc(textcharsize);
if (yy->yymstext == NULL) {
return 0;
}
if (statebufcharsize != 0) {
yy->yymsstatebuf = (int YYFAR *) malloc(statebufcharsize);
if (yy->yymsstatebuf == NULL) {
free(yy->yymstext);
return 0;
}
}
else {
yy->yymsstatebuf = NULL;
}
if (unputbufcharsize != 0) {
yy->yymsunputbufptr = (int YYFAR *) malloc(unputbufcharsize);
if (yy->yymsunputbufptr == NULL) {
free(yy->yymstext);
free(yy->yymsstatebuf);
return 0;
}
}
else {
yy->yymsunputbufptr = NULL;
}
/* assign any other variables */
yy->yymtext_size = yy->yymstext_size;
yy->yymtext = yy->yymstext;
yy->yymstatebuf = yy->yymsstatebuf;
yy->yymunput_size = yy->yymsunput_size;
yy->yymunputbufptr = yy->yymsunputbufptr;
/* make sure we are ready to go */
yymreset(yy);
return 1;
}

View file

@ -0,0 +1,72 @@
/************************************************************
yymldbug.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "mlex.h"
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
void YYCDECL yymdmatch(yymlex_t YYFAR *yy, int expr)
#else
void YYCDECL yymdmatch(yy, expr)
yymlex_t YYFAR *yy;
int expr;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
int i;
sprintf(string, "%p: match: \"", (void *) yy);
yymlexdebugoutput(yy, string);
for (i = 0; i < yy->yymleng; i++) {
yymdebugoutput(yy, yy->yymtext[i]);
}
sprintf(string, "\", %d\n", (int) expr);
yymlexdebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymlexdebugoutput(yymlex_t YYFAR *yy, YYCONST char *string)
#else
void YYCDECL yymlexdebugoutput(yy, string)
yymlex_t YYFAR *yy;
YYCONST char *string;
#endif
{
yyassert(yy != NULL);
yyassert(string != NULL);
#ifdef _WIN32
if (yy->yymdebugout != NULL) {
#else
yyassert(yy->yymdebugout != NULL);
#endif
while (*string != '\0') {
putc(*string++, yy->yymdebugout);
}
if (yydebugflush || yy->yymdebugflush) {
fflush(yy->yymdebugout);
}
#ifdef _WIN32
}
else {
OutputDebugString(string);
}
#endif
}
#endif

View file

@ -0,0 +1,25 @@
/************************************************************
yymldest.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#include <stdlib.h>
#ifdef YYPROTOTYPE
void YYCDECL yymdestroylex(yymlex_t YYFAR *yy)
#else
void YYCDECL yymdestroylex(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert( yy != NULL);
yymlexcleanup(yy);
free(yy->yymstext);
free(yy->yymsstatebuf);
free(yy->yymsunputbufptr);
}

View file

@ -0,0 +1,30 @@
/************************************************************
yymless.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymless(yymlex_t YYFAR *yy, int length)
#else
void YYCDECL yymless(yy, length)
yymlex_t YYFAR *yy;
int length;
#endif
{
yyassert(yy != NULL);
yyassert(length >= 0 && length <= yy->yymleng);
while (yy->yymleng > length) {
(*yy->yymunput)(yy, (unsigned char) yy->yymtext[--yy->yymleng]);
}
if (yy->yymleng > 0) {
yy->yymeol = (unsigned char) (yy->yymtext[yy->yymleng - 1] == '\n');
}
else {
yy->yymeol = yy->yymoldeol;
}
}

View file

@ -0,0 +1,231 @@
/************************************************************
yymlex.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymlex(yymlex_t YYFAR *yy)
#else
int YYCDECL yymlex(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymisfastlexer(yy)); /* make sure it's a fast lexical analyser */
while (1) {
int oldleng;
int state = 1 + yy->yymstart;
if (yy->yymeol) {
state++;
}
/* yymore */
if (yy->yymmoreflg) {
yy->yymmoreflg = 0; /* clear flag */
}
else {
yy->yymleng = 0;
yy->yymoldeol = yy->yymeol;
}
oldleng = yy->yymleng;
/* look for a string */
do {
int ch; /* lookahead character */
/* get input character */
ch = (*yy->yyminput)(yy);
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
if (ch == EOF) {
break;
}
/* check for possible overflow */
if (yy->yymleng == yy->yymtext_size) {
do {
if (yy->yymtextgrow) {
if (yy->yymtext_size != 0) {
int size = yy->yymtext_size * 2;
if (size / 2 == yy->yymtext_size) { /* overflow check */
if (yymsettextsize(yy, size)) {
break;
}
}
}
else {
if (yymsettextsize(yy, 100)) {
break;
}
}
}
(*yy->yymtextoverflow)(yy);
exit(EXIT_FAILURE);
}
while (0);
}
/* handles eof condition automatically */
while (state != 0) {
int index = yy->yymstate[state].base + ch;
if (index >= 0 && index < yy->yymtransitionmax) {
if (yy->yymtransition[index].check == state) {
state = yy->yymtransition[index].next;
break; /* found a transition */
}
}
state = yy->yymstate[state].def;
if (state < 0) {
if (ch >= 0 && ch <= 0xff) {
state = -state;
}
else {
state = 0;
}
break;
}
}
{
int leng = yy->yymleng; /* slightly more efficient */
yy->yymtext[leng] = (char) ch;
yy->yymstatebuf[leng] = state;
leng++;
yy->yymleng = leng;
}
}
while (state != 0 && (yy->yymstate[state].def != 0 || yy->yymstate[state].base != 0));
/* now find a match */
if (yy->yymleng > oldleng) {
int rejectmatch = 0;
while (1) {
int match = yy->yymstate[yy->yymstatebuf[yy->yymleng - 1]].match;
if (rejectmatch != 0) {
if (match < 0) {
int index = -match;
do {
match = yy->yymmatch[index++];
}
while (match > 0 && match <= rejectmatch);
}
else {
if (match == rejectmatch) {
match = 0;
}
}
rejectmatch = 0;
}
else {
if (match < 0) {
match = yy->yymmatch[-match];
}
}
if (match > 0) {
int rejectleng;
int token;
/* check for backup */
if (yy->yymbackup[match]) {
while (yy->yymleng > oldleng) {
int index = yy->yymstate[yy->yymstatebuf[yy->yymleng - 1]].match;
if (index < 0) {
if (yymback(&yy->yymmatch[-index], -match)) {
break; /* found an expression */
}
}
yy->yymleng--;
(*yy->yymunput)(yy, (unsigned char) yy->yymtext[yy->yymleng]);
}
}
yy->yymtext[yy->yymleng] = '\0';
#ifdef YYDEBUG
yymdmatch(yy, match);
#endif
yy->yymrejectflg = 0;
rejectleng = yy->yymleng;
if (yy->yymleng > 0) {
yy->yymeol = (unsigned char) (yy->yymtext[yy->yymleng - 1] == '\n');
}
else {
yy->yymeol = yy->yymoldeol;
}
/* perform user action */
token = (*yy->yymlexaction)(yy, match);
if (yy->yymreturnflg) {
return token;
}
if (!yy->yymrejectflg) {
break;
}
if (rejectleng == yy->yymleng) {
rejectmatch = match;
}
}
else if (yy->yymleng > oldleng + 1) {
yy->yymleng--;
(*yy->yymunput)(yy, (unsigned char) yy->yymtext[yy->yymleng]);
}
else {
yy->yymeol = (unsigned char) (yy->yymtext[0] == '\n');
(*yy->yymoutput)(yy, yy->yymtext[0]); /* non-matched character */
break;
}
}
}
else {
int index;
int match;
yyassert(yy->yymleng == oldleng);
/* handles <<EOF>> rules */
index = 0;
match = yy->yymstate[state].match;
if (match < 0) {
index = -match;
match = yy->yymmatch[index++];
}
while (match > 0) {
int token;
yy->yymtext[yy->yymleng] = '\0';
#ifdef YYDEBUG
yymdmatch(yy, match);
#endif
yy->yymrejectflg = 0; /* clear flag */
/* perform user action */
token = (*yy->yymlexaction)(yy, match);
if (yy->yymreturnflg) {
return token;
}
if (!yy->yymrejectflg) {
break;
}
if (index == 0) {
break;
}
match = yy->yymmatch[index++];
}
if ((*yy->yymwrap)(yy)) {
yy->yymoldeol = 1;
yy->yymeol = 1;
yy->yymstart = 0;
return 0; /* eof reached */
}
}
}
}

View file

@ -0,0 +1,26 @@
/************************************************************
yymlinit.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymlexinit(yymlex_t YYFAR *yy)
#else
void YYCDECL yymlexinit(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yy->yymin = stdin;
yy->yymout = stdout;
yy->yymerr = stderr;
#ifdef YYDEBUG
yy->yymdebugout = stdout;
#endif
}

View file

@ -0,0 +1,42 @@
/************************************************************
yymoutpt.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include <limits.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymoutput(yymlex_t YYFAR *yy, int ch)
#else
void YYCDECL yymoutput(yy, ch)
yymlex_t YYFAR *yy;
int ch;
#endif
{
yyassert(yy != NULL);
/* debugging */
#ifdef YYDEBUG
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: output: \'", (void *) yy);
yymlexdebugoutput(yy, string);
yymdebugoutput(yy, ch);
yymlexdebugoutput(yy, "\'\n");
}
#endif
yyassert(yy->yymout != NULL);
#ifdef __BORLANDC__
putc((char) ch, yy->yymout);
#else
putc(ch, yy->yymout);
#endif
}

View file

@ -0,0 +1,28 @@
/************************************************************
yymparse.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymparse(yymparse_t YYFAR *yy)
#else
int YYCDECL yymparse(yy)
yymparse_t YYFAR *yy;
#endif
{
int n;
yyassert(yy != NULL);
yyassert(yymisfastparser(yy)); /* make sure it's a fast parser */
n = yymsetup(yy);
if (n != 0) {
return n;
}
return yymwork(yy);
}

View file

@ -0,0 +1,30 @@
/************************************************************
yympcln.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymparsecleanup(yymparse_t YYFAR *yy)
#else
void YYCDECL yymparsecleanup(yy)
yymparse_t YYFAR *yy;
#endif
{
if (yy->yymstackptr != yy->yymsstackptr) {
free(yy->yymstackptr);
yy->yymstackptr = yy->yymsstackptr;
}
if (yy->yymattributestackptr != yy->yymsattributestackptr) {
free(yy->yymattributestackptr);
yy->yymattributestackptr = yy->yymsattributestackptr;
}
yy->yymstack_size = yy->yymsstack_size;
yy->yymtop = -1;
}

View file

@ -0,0 +1,75 @@
/************************************************************
yympcrea.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#include <stdlib.h>
#ifdef YYPROTOTYPE
int YYCDECL yymcreateparse(yymparse_t YYFAR *yy, YYCONST yymparse_t YYFAR *src)
#else
int YYCDECL yymcreateparse(yy, src)
yymparse_t YYFAR *yy;
YYCONST yymparse_t YYFAR *src;
#endif
{
yyassert(yy != NULL);
yyassert(src != NULL);
*yy = *src;
/* stack */
if (yy->yymsstack_size != 0) {
size_t stackcharsize;
size_t attributestackcharsize;
stackcharsize = yy->yymsstack_size * sizeof(yystack_t);
if ((int) (stackcharsize / sizeof(yystack_t)) != yy->yymsstack_size) {
return 0; /* integer overflow */
}
attributestackcharsize = yy->yymsstack_size * yy->yymattribute_size;
if ((int) (attributestackcharsize / yy->yymattribute_size) != yy->yymsstack_size) {
return 0; /* integer overflow */
}
yy->yymsstackptr = (yystack_t YYFAR *) malloc(stackcharsize);
if (yy->yymsstackptr == NULL) {
return 0;
}
yy->yymsattributestackptr = malloc(attributestackcharsize);
if (yy->yymsattributestackptr == NULL) {
free(yy->yymsstackptr);
return 0;
}
}
else {
yy->yymsstackptr = NULL;
yy->yymsattributestackptr = NULL;
}
yy->yymstack_size = yy->yymsstack_size;
yy->yymstackptr = yy->yymsstackptr;
yy->yymattributestackptr = yy->yymsattributestackptr;
/* yylval */
yy->yymlvalptr = malloc(yy->yymattribute_size);
if (yy->yymlvalptr == NULL) {
free(yy->yymsstackptr);
free(yy->yymsattributestackptr);
return 0;
}
/* yyval ($$) */
yy->yymvalptr = malloc(yy->yymattribute_size);
if (yy->yymvalptr == NULL) {
free(yy->yymsstackptr);
free(yy->yymsattributestackptr);
free(yy->yymlvalptr);
return 0;
}
return 1;
}

View file

@ -0,0 +1,277 @@
/************************************************************
yympdbug.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "myacc.h"
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
YYCONST char *YYCDECL yymtokenstring(yymparse_t YYFAR *yy, int token)
#else
YYCONST char *YYCDECL yymtokenstring(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
YYCONST yysymbol_t YYNEARFAR *symbol;
yyassert(yy != NULL);
yyassert(token >= 0);
symbol = yy->yymsymbol;
while (symbol->name != NULL) {
if (symbol->token == token) {
return symbol->name;
}
symbol++;
}
return "illegal-token";
}
#ifdef YYPROTOTYPE
void YYCDECL yymdgettoken(yymparse_t YYFAR *yy, int token)
#else
void YYCDECL yymdgettoken(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
yyassert(yy != NULL);
yyassert(token >= 0);
if (yydebug || yy->yymdebug) {
char string[128];
YYCONST char *tokenstring = yymtokenstring(yy, token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: get token ", (void *) yy);
yymparsedebugoutput(yy, string);
yymparsedebugoutput(yy, tokenstring);
sprintf(string, " (%d)\n", (int) token);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdshift(yymparse_t YYFAR *yy, int token)
#else
void YYCDECL yymdshift(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
yyassert(yy != NULL);
yyassert(token >= 0);
if (yydebug || yy->yymdebug) {
char string[128];
YYCONST char *tokenstring = yymtokenstring(yy, token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: shift token ", (void *) yy);
yymparsedebugoutput(yy, string);
yymparsedebugoutput(yy, tokenstring);
sprintf(string, " (%d)\n", (int) token);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdreduce(yymparse_t YYFAR *yy, int rule)
#else
void YYCDECL yymdreduce(yy, rule)
yymparse_t YYFAR *yy;
int rule;
#endif
{
yyassert(yy != NULL);
yyassert(rule >= 0);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: reduce rule ", (void *) yy);
yymparsedebugoutput(yy, string);
yymparsedebugoutput(yy, yy->yymrule[rule]);
sprintf(string, " (%d)\n", (int) rule);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdsyntaxerror(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdsyntaxerror(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: syntax error\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdaccept(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdaccept(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: accept\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdabort(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdabort(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: abort\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymddiscard(yymparse_t YYFAR *yy, int token)
#else
void YYCDECL yymddiscard(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
yyassert(yy != NULL);
yyassert(token >= 0);
if (yydebug || yy->yymdebug) {
char string[128];
YYCONST char *tokenstring = yymtokenstring(yy, token);
yyassert(tokenstring != NULL);
sprintf(string, "%p: discard token ", (void *) yy);
yymparsedebugoutput(yy, string);
yymparsedebugoutput(yy, tokenstring);
sprintf(string, " (%d)\n", (int) token);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdexit(yymparse_t YYFAR *yy, int exitcode)
#else
void YYCDECL yymdexit(yy, exitcode)
yymparse_t YYFAR *yy;
int exitcode;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: exit with code %d\n", (void *) yy, (int) exitcode);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdthrowerror(yymparse_t YYFAR *yy, int errorpop)
#else
void YYCDECL yymdthrowerror(yy, errorpop)
yymparse_t YYFAR *yy;
int errorpop;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: throw error and pop %d error handling state(s)\n",
(void *) yy, (int) errorpop);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdretire(yymparse_t YYFAR *yy, int retirecode)
#else
void YYCDECL yymdretire(yy, retirecode)
yymparse_t YYFAR *yy;
int retirecode;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: retire with code %d\n", (void *) yy, (int) retirecode);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymdattemptrecovery(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdattemptrecovery(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: attempting error recovery\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
#ifdef YYPROTOTYPE
void YYCDECL yymparsedebugoutput(yymparse_t YYFAR *yy, YYCONST char *string)
#else
void YYCDECL yymparsedebugoutput(yy, string)
yymparse_t YYFAR *yy;
YYCONST char *string;
#endif
{
yyassert(yy != NULL);
yyassert(string != NULL);
#ifdef _WIN32
if (yy->yymdebugout != NULL) {
#else
yyassert(yy->yymdebugout != NULL);
#endif
while (*string != '\0') {
putc(*string++, yy->yymdebugout);
}
if (yydebugflush || yy->yymdebugflush) {
fflush(yy->yymdebugout);
}
#ifdef _WIN32
}
else {
OutputDebugString(string);
}
#endif
}
#endif

View file

@ -0,0 +1,27 @@
/************************************************************
yympdest.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#include <stdlib.h>
#ifdef YYPROTOTYPE
void YYCDECL yymdestroyparse(yymparse_t YYFAR *yy)
#else
void YYCDECL yymdestroyparse(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yymparsecleanup(yy);
free(yy->yymsstackptr);
free(yy->yymsattributestackptr);
free(yy->yymlvalptr);
free(yy->yymvalptr);
}

View file

@ -0,0 +1,24 @@
/************************************************************
yympinit.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymparseinit(yymparse_t YYFAR *yy)
#else
void YYCDECL yymparseinit(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yy->yymerr = stderr;
#ifdef YYDEBUG
yy->yymdebugout = stdout;
#endif
}

View file

@ -0,0 +1,41 @@
/************************************************************
yympop.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
void YYCDECL yympop(yymparse_t YYFAR *yy, int num)
#else
void YYCDECL yympop(yy, num)
yymparse_t YYFAR *yy;
int num;
#endif
{
yyassert(yy != NULL);
yyassert(num >= 0);
yy->yymtop -= num;
yyassert(yy->yymtop >= -1);
/* debugging */
if (yydebug || yy->yymdebug) {
if (num > 0) {
char string[128];
sprintf(string, "%p: pop %d state(s)", (void *) yy, (int) num);
yymparsedebugoutput(yy, string);
if (yy->yymtop >= 0) {
sprintf(string, " uncovering state %d",
(int) yy->yymstackptr[yy->yymtop]);
yymparsedebugoutput(yy, string);
}
yymparsedebugoutput(yy, "\n");
}
}
}
#endif

View file

@ -0,0 +1,111 @@
/************************************************************
yympush.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yympush(yymparse_t YYFAR *yy, yystack_t state)
#else
int YYCDECL yympush(yy, state)
yymparse_t YYFAR *yy;
yystack_t state;
#endif
{
yyassert(yy != NULL);
yy->yymtop++; /* increment first */
if (yy->yymtop == yy->yymstack_size) {
do {
if (yy->yymstackgrow) {
if (yy->yymstack_size != 0) {
int size = yy->yymstack_size * 2;
if (size / 2 == yy->yymstack_size) { /* overflow check */
if (yymsetstacksize(yy, size)) {
break;
}
}
}
else {
if (yymsetstacksize(yy, 100)) {
break;
}
}
}
yy->yymtop--;
/* debugging */
#ifdef YYDEBUG
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: stack overflow\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
#endif
(*yy->yymstackoverflow)(yy);
return 0;
}
while (0);
}
yy->yymstackptr[yy->yymtop] = state;
/* debugging */
#ifdef YYDEBUG
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: push state %d", (void *) yy, (int) state);
yymparsedebugoutput(yy, string);
if (yy->yymtop > 0) {
sprintf(string, " covering state %d",
(int) yy->yymstackptr[yy->yymtop - 1]);
yymparsedebugoutput(yy, string);
}
yymparsedebugoutput(yy, "\n");
/* output stack contents */
if (yydebugstack || yy->yymdebugstack) {
int rows;
int i;
int n;
yymparsedebugoutput(yy, "\nstack");
n = sprintf(string, "\n +");
for (i = 0; i < 10; i++) {
n += sprintf(&string[n], " %5d", (int) i);
}
yymparsedebugoutput(yy, string);
rows = 1;
if (yy->yymtop >= 0) {
rows += yy->yymtop / 10;
}
for (i = 0; i < rows; i++) {
int j;
n = sprintf(string, "\n %5d", (int) (10 * i));
for (j = 0; j < 10; j++) {
int index = 10 * i + j;
if (index <= yy->yymtop) {
n += sprintf(&string[n], " %5d", (int) yy->yymstackptr[index]);
}
else {
n += sprintf(&string[n], " -");
}
}
yymparsedebugoutput(yy, string);
}
yymparsedebugoutput(yy, "\n\n");
}
}
#endif
return 1;
}

View file

@ -0,0 +1,27 @@
/************************************************************
yymreset.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymreset(yymlex_t YYFAR *yy)
#else
void YYCDECL yymreset(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yy->yymleng = 0;
yy->yymlineno = 1;
yy->yymunputindex = 0;
yy->yymmoreflg = 0;
yy->yymrejectflg = 0;
yy->yymeol = 1;
yy->yymoldeol = 1;
yy->yymstart = 0;
}

View file

@ -0,0 +1,25 @@
/************************************************************
yymsetin.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymsetin(yymparse_t YYFAR *yy, int token)
#else
void YYCDECL yymsetin(yy, token)
yymparse_t YYFAR *yy;
int token;
#endif
{
yyassert(yy != NULL);
if (token < 0) {
token = 0;
}
yy->yymchar = token;
yy->yymlookahead = 1;
}

View file

@ -0,0 +1,36 @@
/************************************************************
yymsetup.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymsetup(yymparse_t YYFAR *yy)
#else
int YYCDECL yymsetup(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
/* initialise variables */
yy->yymtop = -1;
yy->yymlookahead = 0;
yy->yymskip = 0;
yy->yymerrorcount = 0;
yy->yymchar = -1;
yy->yympopflg = 0;
/* push initial state onto the stack */
if (!yympush(yy, 0)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
return 1;
}
return 0;
}

View file

@ -0,0 +1,21 @@
/************************************************************
yymsoflw.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymstackoverflow(yymparse_t YYFAR *yy)
#else
void YYCDECL yymstackoverflow(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
(*yy->yymerror)(yy, "yacc stack overflow");
}

View file

@ -0,0 +1,46 @@
/************************************************************
yymsskip.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdio.h>
#include "myacc.h"
#ifdef YYDEBUG
#ifdef YYPROTOTYPE
void YYCDECL yymsetskip(yymparse_t YYFAR *yy, int skip)
#else
void YYCDECL yymsetskip(yy, skip)
yymparse_t YYFAR *yy;
int skip;
#endif
{
yyassert(yy != NULL);
yyassert(skip >= 0);
/* debugging */
if (yydebug || yy->yymdebug) {
if (skip > 0) {
if (yy->yymskip == 0) {
char string[128];
sprintf(string, "%p: entering error recovery\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
else {
if (yy->yymskip > 0) {
char string[128];
sprintf(string, "%p: leaving error recovery\n", (void *) yy);
yymparsedebugoutput(yy, string);
}
}
}
yy->yymskip = skip;
}
#endif

View file

@ -0,0 +1,88 @@
/************************************************************
yymsssiz.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymsetstacksize(yymparse_t YYFAR *yy, int size)
#else
int YYCDECL yymsetstacksize(yy, size)
yymparse_t YYFAR *yy;
int size;
#endif
{
yyassert(yy != NULL);
yyassert(size >= 0);
if (yy->yymstack_size != size) {
yystack_t YYFAR *stackptr;
#if defined(__STDC__) || defined(__cplusplus)
void YYFAR *attributestackptr;
#else
char YYFAR *attributestackptr;
#endif
size_t stackcharsize;
size_t attributestackcharsize;
if (size <= yy->yymtop) {
return 0;
}
stackcharsize = size * sizeof(yystack_t);
if ((int) (stackcharsize / sizeof(yystack_t)) != size) {
return 0; /* integer overflow */
}
attributestackcharsize = size * yy->yymattribute_size;
if ((int) (attributestackcharsize / yy->yymattribute_size) != size) {
return 0; /* integer overflow */
}
/* allocate */
if (size <= yy->yymsstack_size) {
stackptr = yy->yymsstackptr;
attributestackptr = yy->yymsattributestackptr;
}
else {
stackptr = (yystack_t YYFAR *) malloc(stackcharsize);
if (stackptr == NULL) {
return 0;
}
attributestackptr = malloc(attributestackcharsize);
if (attributestackptr == NULL) {
free(stackptr); /* clean up */
return 0;
}
}
/* copy */
if (stackptr != yy->yymstackptr) {
size_t charsize = yy->yymstack_size * sizeof(yystack_t);
memcpy(stackptr, yy->yymstackptr, min(stackcharsize, charsize));
}
if (attributestackptr != yy->yymattributestackptr) {
size_t charsize = yy->yymstack_size * yy->yymattribute_size;
memcpy(attributestackptr, yy->yymattributestackptr, min(attributestackcharsize,
charsize));
}
/* free */
if (yy->yymstackptr != yy->yymsstackptr) {
free(yy->yymstackptr);
}
if (yy->yymattributestackptr != yy->yymsattributestackptr) {
free(yy->yymattributestackptr);
}
/* assign */
yy->yymstackptr = stackptr;
yy->yymattributestackptr = attributestackptr;
yy->yymstack_size = size;
}
return 1;
}

View file

@ -0,0 +1,84 @@
/************************************************************
yymstsiz.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymsettextsize(yymlex_t YYFAR *yy, int size)
#else
int YYCDECL yymsettextsize(yy, size)
yymlex_t YYFAR *yy;
int size;
#endif
{
yyassert(yy != NULL);
yyassert(size >= 0);
if (yy->yymtext_size != size) {
char YYFAR *text;
int YYFAR *statebuf;
size_t textcharsize;
size_t statebufcharsize;
if (size < yy->yymleng) {
return 0;
}
textcharsize = size + 1; /* include the '\0' */
if (textcharsize <= (size_t) size) {
return 0; /* integer overflow */
}
statebufcharsize = size * sizeof(int);
if ((int) (statebufcharsize / sizeof(int)) != size) {
return 0; /* integer overflow */
}
/* allocate */
if (size <= yy->yymstext_size) {
text = yy->yymstext;
statebuf = yy->yymsstatebuf;
}
else {
text = (char YYFAR *) malloc(textcharsize);
if (text == NULL) {
return 0;
}
statebuf = (int YYFAR *) malloc(statebufcharsize);
if (statebuf == NULL) {
free(text); /* clean up */
return 0;
}
}
/* copy */
if (text != yy->yymtext) {
size_t charsize = yy->yymtext_size + 1;
memcpy(text, yy->yymtext, min(textcharsize, charsize));
}
if (statebuf != yy->yymstatebuf) {
size_t charsize = yy->yymtext_size * sizeof(int);
memcpy(statebuf, yy->yymstatebuf, min(statebufcharsize, charsize));
}
/* free */
if (yy->yymtext != yy->yymstext) {
free(yy->yymtext);
}
if (yy->yymstatebuf != yy->yymsstatebuf) {
free(yy->yymstatebuf);
}
/* assign */
yy->yymtext = text;
yy->yymstatebuf = statebuf;
yy->yymtext_size = size;
}
return 1;
}

View file

@ -0,0 +1,64 @@
/************************************************************
yymsusiz.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <string.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
int YYCDECL yymsetunputsize(yymlex_t YYFAR *yy, int size)
#else
int YYCDECL yymsetunputsize(yy, size)
yymlex_t YYFAR *yy;
int size;
#endif
{
yyassert(yy != NULL);
yyassert(size >= 0);
if (yy->yymunput_size != size) {
int YYFAR *unputbufptr;
size_t unputbufcharsize;
if (size < yy->yymunputindex) {
return 0;
}
unputbufcharsize = size * sizeof(int);
if ((int) (unputbufcharsize / sizeof(int)) != size) {
return 0; /* integer overflow */
}
/* allocate */
if (size <= yy->yymsunput_size) {
unputbufptr = yy->yymsunputbufptr;
}
else {
unputbufptr = (int YYFAR *) malloc(unputbufcharsize);
if (unputbufptr == NULL) {
return 0;
}
}
/* copy */
if (unputbufptr != yy->yymunputbufptr) {
size_t charsize = yy->yymunput_size * sizeof(int);
memcpy(unputbufptr, yy->yymunputbufptr, min(unputbufcharsize, charsize));
}
/* free */
if (yy->yymunputbufptr != yy->yymsunputbufptr) {
free(yy->yymunputbufptr);
}
/* assign */
yy->yymunputbufptr = unputbufptr;
yy->yymunput_size = size;
}
return 1;
}

View file

@ -0,0 +1,21 @@
/************************************************************
yymsyner.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymsyntaxerror(yymparse_t YYFAR *yy)
#else
void YYCDECL yymsyntaxerror(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
(*yy->yymerror)(yy, "syntax error");
}

View file

@ -0,0 +1,21 @@
/************************************************************
yymtoflw.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymtextoverflow(yymlex_t YYFAR *yy)
#else
void YYCDECL yymtextoverflow(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yy->yymerr != NULL);
fprintf(yy->yymerr, "lex text buffer overflow (%d)\n", (int) yy->yymtext_size);
}

View file

@ -0,0 +1,24 @@
/************************************************************
yymuncin.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymunclearin(yymparse_t YYFAR *yy)
#else
int YYCDECL yymunclearin(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
if (!yy->yymlookahead && yy->yymchar != -1) {
yy->yymlookahead = 1;
return 1;
}
return 0;
}

View file

@ -0,0 +1,69 @@
/************************************************************
yymunput.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymunput(yymlex_t YYFAR *yy, int ch)
#else
void YYCDECL yymunput(yy, ch)
yymlex_t YYFAR *yy;
int ch;
#endif
{
yyassert(yy != NULL);
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
yyassert(yy->yymunputindex >= 0 && yy->yymunputindex <= yy->yymunput_size);
/* check unput buffer size */
if (yy->yymunputindex == yy->yymunput_size) {
do {
if (yy->yymunputgrow) {
if (yy->yymunput_size != 0) {
int size = yy->yymunput_size * 2;
if (size / 2 == yy->yymunput_size) { /* overflow check */
if (yymsetunputsize(yy, size)) {
break;
}
}
}
else {
if (yymsetunputsize(yy, 100)) {
break;
}
}
}
(*yy->yymunputoverflow)(yy);
exit(EXIT_FAILURE);
}
while (0);
}
yy->yymunputbufptr[yy->yymunputindex++] = ch;
/* check line number */
if (ch == '\n') {
yy->yymlineno--;
}
/* debugging */
#ifdef YYDEBUG
if (yydebug || yy->yymdebug) {
char string[128];
sprintf(string, "%p: unput: \'", (void *) yy);
yymlexdebugoutput(yy, string);
yymdebugoutput(yy, ch);
yymlexdebugoutput(yy, "\'\n");
}
#endif
}

View file

@ -0,0 +1,21 @@
/************************************************************
yymuoflw.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef YYPROTOTYPE
void YYCDECL yymunputoverflow(yymlex_t YYFAR *yy)
#else
void YYCDECL yymunputoverflow(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yy->yymerr != NULL);
fprintf(yy->yymerr, "lex unput buffer overflow (%d)\n", (int) yy->yymunput_size);
}

View file

@ -0,0 +1,24 @@
/************************************************************
yymwipe.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yymwipe(yymparse_t YYFAR *yy)
#else
void YYCDECL yymwipe(yy)
yymparse_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
yyassert(yymisfastparser(yy)); /* make sure it's a fast parser */
yymdestructpop(yy, yy->yymtop + 1);
yymdestructclearin(yy);
}

View file

@ -0,0 +1,293 @@
/************************************************************
yymwork.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "myacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yymwork(yymparse_t YYFAR *yy)
#else
int YYCDECL yymwork(yy)
yymparse_t YYFAR *yy;
#endif
{
int errorpop = 0;
yyassert(yy != NULL);
yyassert(yymisfastparser(yy)); /* make sure it's a fast parser */
while (1) {
unsigned char type;
short sr;
yystack_t state = yympeek(yy); /* get top state */
while (1) {
if (yy->yymstateaction[state].lookahead) {
int index;
if (!yy->yymlookahead) {
yy->yymlookahead = 1;
yy->yymchar = (*yy->yymgettoken)(yy);
if (yy->yymchar < 0) {
yy->yymchar = 0;
}
#ifdef YYDEBUG
yymdgettoken(yy, yy->yymchar);
#endif
}
index = yy->yymstateaction[state].base + yy->yymchar;
if (index >= 0 && index < yy->yymtokenaction_size) {
if (yy->yymtokenaction[index].check == state) {
type = yy->yymtokenaction[index].type;
sr = yy->yymtokenaction[index].sr;
break; /* escape from loop */
}
}
}
type = yy->yymstateaction[state].type;
sr = yy->yymstateaction[state].sr;
if (type != YYAT_DEFAULT) {
break; /* escape from loop */
}
state = sr;
}
/* action */
switch (type) {
case YYAT_SHIFT:
#ifdef YYDEBUG
yymdshift(yy, yy->yymchar);
#endif
if (yy->yymskip > 0) {
yymsetskip(yy, yy->yymskip - 1);
}
if (!yympush(yy, sr)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymwipe(yy); /* clean up */
}
return 1;
}
memcpy(&((char YYFAR *) yy->yymattributestackptr)[yy->yymtop *
yy->yymattribute_size], yy->yymlvalptr, yy->yymattribute_size);
yy->yymlookahead = 0;
continue; /* go to top of while loop */
case YYAT_REDUCE:
#ifdef YYDEBUG
yymdreduce(yy, sr);
#endif
yy->yymretireflg = 0;
if (yy->yymreduction[sr].action != -1) {
/* user actions in here */
if (yy->yymreduction[sr].length > 0) {
memcpy(yy->yymvalptr, &((char YYFAR *) yy->yymattributestackptr)
[(yy->yymtop + 1 - yy->yymreduction[sr].length) *
yy->yymattribute_size], yy->yymattribute_size);
}
yy->yymerrorflg = 0;
yy->yymexitflg = 0;
(*yy->yymparseaction)(yy, yy->yymreduction[sr].action);
/* check for special user requected actions */
if (yy->yymexitflg) {
#ifdef YYDEBUG
yymdexit(yy, yy->yymexitcode);
#endif
return yy->yymexitcode;
}
if (yy->yymerrorflg) {
errorpop = yy->yymerrorpop;
#ifdef YYDEBUG
yymdthrowerror(yy, yy->yymerrorpop);
#endif
yy->yymerrorcount++;
break; /* go to error handler */
}
}
yympop(yy, yy->yymreduction[sr].length);
{
yystack_t state = yympeek(yy); /* get top state */
short next;
int nonterm = yy->yymreduction[sr].nonterm;
while (1) {
int index = yy->yymstategoto[state].base + nonterm;
if (index >= 0 && index < yy->yymnontermgoto_size) {
if (yy->yymnontermgoto[index].check == state) {
next = yy->yymnontermgoto[index].next;
break;
}
}
next = yy->yymstategoto[state].def;
if (next == -1) {
break;
}
state = next;
}
yyassert(next != -1);
if (!yympush(yy, next)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymwipe(yy); /* clean up */
}
return 1;
}
}
if (yy->yymreduction[sr].action != -1) {
memcpy(&((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size],
yy->yymvalptr, yy->yymattribute_size);
}
if (yy->yymretireflg) {
#ifdef YYDEBUG
yymdretire(yy, yy->yymretirecode);
#endif
return yy->yymretirecode;
}
continue; /* go to top of while loop */
case YYAT_ERROR:
#ifdef YYDEBUG
yymdsyntaxerror(yy);
#endif
if (yy->yymskip == 0) {
yy->yymerrorcount++;
(*yy->yymsyntaxerror)(yy);
}
break; /* go to error handler */
default:
yyassert(type == YYAT_ACCEPT);
#ifdef YYDEBUG
yymdaccept(yy);
#endif
return 0;
}
/* error handler */
if (yy->yymskip < 3 || errorpop > 0) {
#ifdef YYDEBUG
yymdattemptrecovery(yy);
#endif
yy->yympopflg = 0; /* clear flag */
while (1) {
state = yympeek(yy); /* get top state */
while (1) {
int index = yy->yymstateaction[state].base + YYTK_ERROR;
if (index >= 0 && index < yy->yymtokenaction_size) {
if (yy->yymtokenaction[index].check == state) {
type = yy->yymtokenaction[index].type;
sr = yy->yymtokenaction[index].sr;
break; /* escape from loop */
}
}
type = yy->yymstateaction[state].type;
sr = yy->yymstateaction[state].sr;
if (type != YYAT_DEFAULT) {
break; /* escape from loop */
}
state = sr;
}
if (type == YYAT_SHIFT) {
if (errorpop <= 0) {
#ifdef YYDEBUG
yymdshift(yy, YYTK_ERROR);
#endif
if (!yympush(yy, sr)) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymwipe(yy); /* clean up */
}
return 1;
}
yymsetskip(yy, 3); /* skip 3 erroneous characters */
break;
}
errorpop--;
}
yy->yympopflg = 1;
/* clean up any symbol attributes */
if (yy->yymdestructorptr != NULL) {
int action;
state = yympeek(yy);
action = yy->yymdestructorptr[state];
if (action != -1) {
/* user actions in here */
memcpy(yy->yymvalptr, &((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size],
yy->yymattribute_size);
(*yy->yymparseaction)(yy, action);
memcpy(&((char YYFAR *) yy->yymattributestackptr)
[yy->yymtop * yy->yymattribute_size], yy->yymvalptr,
yy->yymattribute_size);
}
}
yympop(yy, 1);
if (yy->yymtop < 0) {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymwipe(yy); /* clean up */
}
return 1;
}
}
}
else {
if (yy->yymlookahead) {
if (yy->yymchar != 0) {
#ifdef YYDEBUG
yymddiscard(yy, yy->yymchar);
#endif
(*yy->yymdiscard)(yy, yy->yymchar);
/* clean up any token attributes */
if (yy->yymtokendestptr != NULL) {
int index = yy->yymtokendestbase + yy->yymchar;
if (index >= 0 && index < yy->yymtokendest_size) {
int action = yy->yymtokendestptr[index];
if (action != -1) {
/* user actions in here */
memcpy(yy->yymvalptr, yy->yymlvalptr, yy->yymattribute_size);
(*yy->yymparseaction)(yy, action);
memcpy(yy->yymlvalptr, yy->yymvalptr, yy->yymattribute_size);
}
}
}
yy->yymlookahead = 0; /* skip erroneous character */
}
else {
#ifdef YYDEBUG
yymdabort(yy);
#endif
if (yy->yymwipeflg) {
yymwipe(yy); /* clean up */
}
return 1;
}
}
}
}
}

View file

@ -0,0 +1,24 @@
/************************************************************
yymwrap.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "mlex.h"
#ifdef __BORLANDC__
#pragma argsused
#endif
#ifdef YYPROTOTYPE
int YYCDECL yymwrap(yymlex_t YYFAR *yy)
#else
int YYCDECL yymwrap(yy)
yymlex_t YYFAR *yy;
#endif
{
yyassert(yy != NULL);
return 1;
}

View file

@ -0,0 +1,27 @@
/************************************************************
yysback.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include "lex.h"
#ifdef YYPROTOTYPE
int YYCDECL yyback(YYCONST yymatch_t YYNEARFAR *p, int action)
#else
int YYCDECL yyback(p, action)
YYCONST yymatch_t YYNEARFAR *p;
int action;
#endif
{
yyassert(p != NULL);
yyassert(action < 0);
while (*p != 0) {
if (*p++ == action) {
return 1;
}
}
return 0;
}

View file

@ -0,0 +1,37 @@
/************************************************************
yyscdeci.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "yacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yycdestructclearin(void)
#else
void YYCDECL yycdestructclearin()
#endif
{
if (yylookahead) {
/* clean up any token attributes */
if (yyctokendestptr != NULL) {
YYCONST yyctokendest_t YYNEARFAR *tokendestptr = yyctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yychar) {
/* user actions in here */
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyparseaction(tokendestptr->action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
break;
}
tokendestptr++;
}
}
yylookahead = 0;
}
}

View file

@ -0,0 +1,232 @@
/************************************************************
yysclex.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "lex.h"
#ifdef YYPROTOTYPE
int YYCDECL yyclex(void)
#else
int YYCDECL yyclex()
#endif
{
while (1) {
int oldleng;
int state = 1 + yystart;
if (yyeol) {
state++;
}
/* yymore */
if (yymoreflg) {
yymoreflg = 0; /* clear flag */
}
else {
yyleng = 0;
yyoldeol = yyeol;
}
oldleng = yyleng;
/* look for a string */
do {
int index;
int ch; /* lookahead character */
/* get input character */
ch = yyinput();
yyassert(ch >= 0 && ch <= UCHAR_MAX || ch == EOF);
if (ch == EOF) {
break;
}
/* check for possible overflow */
if (yyleng == yytext_size) {
do {
if (yytextgrow) {
if (yytext_size != 0) {
int size = yytext_size * 2;
if (size / 2 == yytext_size) { /* overflow check */
if (yysettextsize(size)) {
break;
}
}
}
else {
if (yysettextsize(100)) {
break;
}
}
}
yytextoverflow();
exit(EXIT_FAILURE);
}
while (0);
}
/* look for a transition */
index = yystate[state].base;
while (1) {
if (yyctransition[index].next == 0) {
state = yystate[state].def;
if (state <= 0) {
if (state < 0) {
if (ch >= 0 && ch <= 0xff) {
state = -state;
}
else {
state = 0;
}
}
break;
}
}
if (ch >= yyctransition[index].first &&
ch <= yyctransition[index].last) {
state = yyctransition[index].next;
break;
}
index++;
}
{
int leng = yyleng; /* slightly more efficient */
yytext[leng] = (char) ch;
yystatebuf[leng] = state;
leng++;
yyleng = leng;
}
}
while (state != 0 && (yystate[state].def != 0 || yystate[state].base != 0));
/* now find a match */
if (yyleng > oldleng) {
int rejectmatch = 0;
while (1) {
int match = yystate[yystatebuf[yyleng - 1]].match;
if (rejectmatch != 0) {
if (match < 0) {
int index = -match;
do {
match = yymatch[index++];
}
while (match > 0 && match <= rejectmatch);
}
else {
if (match == rejectmatch) {
match = 0;
}
}
rejectmatch = 0;
}
else {
if (match < 0) {
match = yymatch[-match];
}
}
if (match > 0) {
int rejectleng;
int token;
/* check for backup */
if (yybackup[match]) {
while (yyleng > oldleng) {
int index = yystate[yystatebuf[yyleng - 1]].match;
if (index < 0) {
if (yyback(&yymatch[-index], -match)) {
break; /* found an expression */
}
}
yyleng--;
yyunput((unsigned char) yytext[yyleng]);
}
}
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; /* clear flag */
rejectleng = yyleng;
if (yyleng > 0) {
yyeol = (unsigned char) (yytext[yyleng - 1] == '\n');
}
else {
yyeol = yyoldeol;
}
/* perform user action */
token = yylexaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (rejectleng == yyleng) {
rejectmatch = match;
}
}
else if (yyleng > oldleng + 1) {
yyleng--;
yyunput((unsigned char) yytext[yyleng]);
}
else {
yyeol = (unsigned char) (yytext[0] == '\n');
yyoutput(yytext[0]); /* non-matched character */
break;
}
}
}
else {
int index;
int match;
yyassert(yyleng == oldleng);
/* handles <<EOF>> rules */
index = 0;
match = yystate[state].match;
if (match < 0) {
index = -match;
match = yymatch[index++];
}
while (match > 0) {
int token;
yytext[yyleng] = '\0';
#ifdef YYDEBUG
yydmatch(match);
#endif
yyrejectflg = 0; /* clear flag */
/* perform user action */
token = yylexaction(match);
if (yyreturnflg) {
return token;
}
if (!yyrejectflg) {
break;
}
if (index == 0) {
break;
}
match = yymatch[index++];
}
if (yywrap()) {
yyoldeol = 1;
yyeol = 1;
yystart = 0;
return 0; /* eof reached */
}
}
}
}

View file

@ -0,0 +1,23 @@
/************************************************************
yyscpars.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "yacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yycparse(void)
#else
int YYCDECL yycparse()
#endif
{
int n = yysetup();
if (n != 0) {
return n;
}
return yycwork();
}

View file

@ -0,0 +1,20 @@
/************************************************************
yyscwipe.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "yacc.h"
#ifdef YYPROTOTYPE
void YYCDECL yycwipe(void)
#else
void YYCDECL yycwipe()
#endif
{
yydestructpop(yytop + 1);
yycdestructclearin();
}

View file

@ -0,0 +1,286 @@
/************************************************************
yyscwork.c
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999 Bumble-Bee Software Ltd.
************************************************************/
#include <string.h>
#include "yacc.h"
#ifdef YYPROTOTYPE
int YYCDECL yycwork(void)
#else
int YYCDECL yycwork()
#endif
{
int errorpop = 0;
while (1) {
unsigned char type;
short sr;
yystack_t state = yypeek(); /* get top state */
int index = yycstateaction[state];
while (1) {
if (yyctokenaction[index].token == YYTK_ALL) {
if (yyctokenaction[index].type == YYAT_DEFAULT) {
state = yyctokenaction[index].sr;
index = yycstateaction[state];
continue;
}
break;
}
if (!yylookahead) {
yychar = yygettoken();
if (yychar < 0) {
yychar = 0;
}
yylookahead = 1;
#ifdef YYDEBUG
yydgettoken(yychar);
#endif
}
if (yyctokenaction[index].token == yychar) {
break;
}
index++;
}
type = yyctokenaction[index].type;
sr = yyctokenaction[index].sr;
/* action */
switch (type) {
case YYAT_SHIFT:
#ifdef YYDEBUG
yydshift(yychar);
#endif
if (yyskip > 0) {
yysetskip(yyskip - 1);
}
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yycwipe(); /* clean up */
}
return 1;
}
memcpy(&((char YYFAR *) yyattributestackptr)[yytop * yyattribute_size],
yylvalptr, yyattribute_size);
yylookahead = 0;
continue; /* go to top of while loop */
case YYAT_REDUCE:
#ifdef YYDEBUG
yydreduce(sr);
#endif
yyretireflg = 0;
if (yyreduction[sr].action != -1) {
/* user actions in here */
if (yyreduction[sr].length > 0) {
memcpy(yyvalptr, &((char YYFAR *) yyattributestackptr)
[(yytop + 1 - yyreduction[sr].length) * yyattribute_size],
yyattribute_size);
}
yyerrorflg = 0;
yyexitflg = 0;
yyparseaction(yyreduction[sr].action);
/* check for special user requected actions */
if (yyexitflg) {
#ifdef YYDEBUG
yydexit(yyexitcode);
#endif
return yyexitcode;
}
if (yyerrorflg) {
errorpop = yyerrorpop;
#ifdef YYDEBUG
yydthrowerror(errorpop);
#endif
yyerrorcount++;
break; /* go to error handler */
}
}
yypop(yyreduction[sr].length);
{
yystack_t state = yypeek(); /* get top state */
short next;
int nonterm = yyreduction[sr].nonterm;
int index = yycstategoto[state];
while (1) {
if (yycnontermgoto[index].nonterm == -1) {
if (yycnontermgoto[index].next != -1) {
state = yycnontermgoto[index].next;
index = yycstategoto[state];
continue;
}
break;
}
if (yycnontermgoto[index].nonterm == nonterm) {
break;
}
index++;
}
next = yycnontermgoto[index].next;
yyassert(next != -1);
if (!yypush(next)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yycwipe(); /* clean up */
}
return 1;
}
}
if (yyreduction[sr].action != -1) {
memcpy(&((char YYFAR *) yyattributestackptr)[yytop * yyattribute_size],
yyvalptr, yyattribute_size);
}
if (yyretireflg) {
#ifdef YYDEBUG
yydretire(yyretirecode);
#endif
return yyretirecode;
}
continue; /* go to top of while loop */
case YYAT_ERROR:
#ifdef YYDEBUG
yydsyntaxerror();
#endif
if (yyskip == 0) {
yyerrorcount++;
yysyntaxerror();
}
break; /* go to error handler */
default:
yyassert(type == YYAT_ACCEPT);
#ifdef YYDEBUG
yydaccept();
#endif
return 0;
}
/* error handler */
if (yyskip < 3 || yyerrorpop > 0) {
#ifdef YYDEBUG
yydattemptrecovery();
#endif
yypopflg = 0; /* clear flag */
while (yytop >= 0) {
state = yypeek(); /* get top state */
index = yycstateaction[state];
while (1) {
if (yyctokenaction[index].token == YYTK_ALL) {
if (yyctokenaction[index].type == YYAT_DEFAULT) {
state = yyctokenaction[index].sr;
index = yycstateaction[state];
continue;
}
break;
}
if (yyctokenaction[index].token == YYTK_ERROR) {
break;
}
index++;
}
type = yyctokenaction[index].type;
sr = yyctokenaction[index].sr;
if (type == YYAT_SHIFT) {
if (errorpop <= 0) {
#ifdef YYDEBUG
yydshift(YYTK_ERROR);
#endif
if (!yypush(sr)) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yycwipe(); /* clean up */
}
return 1;
}
yysetskip(3); /* skip 3 erroneous characters */
break;
}
errorpop--;
}
yypopflg = 1;
/* clean up any symbol attributes */
if (yydestructorptr != NULL) {
int action;
state = yypeek();
action = yydestructorptr[state];
if (action != -1) {
/* user actions in here */
memcpy(yyvalptr, &((char YYFAR *) yyattributestackptr)
[yytop * yyattribute_size], yyattribute_size);
yyparseaction(action);
memcpy(&((char YYFAR *) yyattributestackptr)
[yytop * yyattribute_size], yyvalptr, yyattribute_size);
}
}
yypop(1);
if (yytop < 0) {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yycwipe(); /* clean up */
}
return 1;
}
}
}
else {
if (yylookahead) {
if (yychar != 0) {
#ifdef YYDEBUG
yyddiscard(yychar);
#endif
yydiscard(yychar);
/* clean up any token attributes */
if (yyctokendestptr != NULL) {
YYCONST yyctokendest_t YYNEARFAR *tokendestptr = yyctokendestptr;
while (tokendestptr->token != 0) {
if (tokendestptr->token == yychar) {
/* user actions in here */
memcpy(yyvalptr, yylvalptr, yyattribute_size);
yyparseaction(tokendestptr->action);
memcpy(yylvalptr, yyvalptr, yyattribute_size);
break;
}
tokendestptr++;
}
}
yylookahead = 0; /* skip erroneous character */
}
else {
#ifdef YYDEBUG
yydabort();
#endif
if (yywipeflg) {
yycwipe(); /* clean up */
}
return 1;
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show more