This commit is contained in:
parent
48629e2f3d
commit
e98f64c419
20 changed files with 1052 additions and 637 deletions
|
@ -26,6 +26,10 @@
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FUNCTION_H__
|
||||||
|
#include "function.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -76,7 +80,7 @@ extern int parseFile(char *_filename,CTreeNode *_baseNode)
|
||||||
{
|
{
|
||||||
if(s_lexer.yycreate(&s_parser))
|
if(s_lexer.yycreate(&s_parser))
|
||||||
{
|
{
|
||||||
if(s_lexer.openInputFile(_filename)==true)
|
if(s_lexer.openInputFile(_filename)==(int)true)
|
||||||
{
|
{
|
||||||
s_parser.setCurrentLexer(&s_lexer);
|
s_parser.setCurrentLexer(&s_lexer);
|
||||||
s_parser.setBaseNode(_baseNode);
|
s_parser.setBaseNode(_baseNode);
|
||||||
|
@ -180,6 +184,9 @@ CTreeNode::CTreeNode(NodeType _type,int _data)
|
||||||
case VALUE_EXPR:
|
case VALUE_EXPR:
|
||||||
m_value=_data;
|
m_value=_data;
|
||||||
break;
|
break;
|
||||||
|
case FUNCTION_EXPR:
|
||||||
|
m_functionNumber=_data;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("ARSE\n");
|
printf("ARSE\n");
|
||||||
break;
|
break;
|
||||||
|
@ -240,7 +247,11 @@ int CTreeNode::generateCode(int _write)
|
||||||
codeSize+=emit(OP_JMP,_write);
|
codeSize+=emit(OP_JMP,_write);
|
||||||
codeSize+=m_children[2]->generateCode(_write);
|
codeSize+=m_children[2]->generateCode(_write);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case POP_STMT: // pop
|
||||||
|
codeSize+=emit(OP_POP,_write);
|
||||||
|
break;
|
||||||
|
|
||||||
case ASSIGN_EXPR: // assign [ variable, number ]
|
case ASSIGN_EXPR: // assign [ variable, number ]
|
||||||
codeSize+=m_children[1]->generateCode(_write);
|
codeSize+=m_children[1]->generateCode(_write);
|
||||||
codeSize+=emit(OP_PUSHVALUE,_write);
|
codeSize+=emit(OP_PUSHVALUE,_write);
|
||||||
|
@ -274,6 +285,12 @@ int CTreeNode::generateCode(int _write)
|
||||||
codeSize+=emit(OP_ADD,_write);
|
codeSize+=emit(OP_ADD,_write);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FUNCTION_EXPR: // function [functionNumber]
|
||||||
|
codeSize+=emit(OP_CALL_FUNCTION,_write);
|
||||||
|
codeSize+=emit(getFunctionNumber(),_write);
|
||||||
|
codeSize+=emit(getFunctionArgCount(getFunctionNumber()),_write);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("UNHANDLED CASE %d\n",m_type);
|
printf("UNHANDLED CASE %d\n",m_type);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,6 +35,7 @@ typedef enum
|
||||||
PAUSE_STMT, // pause
|
PAUSE_STMT, // pause
|
||||||
IF_STMT, // if [expression, ifcode]
|
IF_STMT, // if [expression, ifcode]
|
||||||
IFELSE_STMT, // if [expression, ifcode, elsecode]
|
IFELSE_STMT, // if [expression, ifcode, elsecode]
|
||||||
|
POP_STMT, // pop
|
||||||
|
|
||||||
// Expressions
|
// Expressions
|
||||||
ASSIGN_EXPR, // assignment [variable, value]
|
ASSIGN_EXPR, // assignment [variable, value]
|
||||||
|
@ -43,6 +44,7 @@ typedef enum
|
||||||
VARIABLE_EXPR, // variable
|
VARIABLE_EXPR, // variable
|
||||||
VALUE_EXPR, // value
|
VALUE_EXPR, // value
|
||||||
PLUS_EXPR, // + [value, value]
|
PLUS_EXPR, // + [value, value]
|
||||||
|
FUNCTION_EXPR, // function [functionNumber]
|
||||||
}NodeType;
|
}NodeType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,26 +66,29 @@ public:
|
||||||
int getVariableIdx() {return m_variableIdx;}
|
int getVariableIdx() {return m_variableIdx;}
|
||||||
int getValue() {return m_value;}
|
int getValue() {return m_value;}
|
||||||
int getType() {return m_type;}
|
int getType() {return m_type;}
|
||||||
|
int getFunctionNumber() {return m_functionNumber;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Nothing else needs to know these so we may as well protect them
|
// Nothing else needs to know these so we may as well protect them
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// args stack data result
|
// args stack data result
|
||||||
OP_NOP=0x1100, //
|
OP_NOP=0x1100, //
|
||||||
OP_STOP, //
|
OP_STOP, //
|
||||||
OP_PAUSE, //
|
OP_PAUSE, //
|
||||||
OP_PUSHVALUE, // value
|
OP_PUSHVALUE, // value
|
||||||
OP_PUSHVARVALUE, // varidx
|
OP_PUSHVARVALUE, // varidx
|
||||||
OP_JMP, // jump
|
OP_POP, // value
|
||||||
OP_JMPF, // jump, value
|
OP_JMP, // jump
|
||||||
OP_JMPT, // jump, value
|
OP_JMPF, // jump, value
|
||||||
OP_IS_EQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
OP_JMPT, // jump, value
|
||||||
OP_IS_NOTEQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
OP_IS_EQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||||
OP_ASSIGN, // varidx, value
|
OP_IS_NOTEQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||||
OP_ADD, // value, value pushes result to stack
|
OP_ASSIGN, // varidx, value
|
||||||
OP_PRINT, // value
|
OP_ADD, // value, value pushes result to stack
|
||||||
|
OP_PRINT, // value
|
||||||
|
OP_CALL_FUNCTION, // functionNumber, argcount args pushes return value to stack
|
||||||
};
|
};
|
||||||
|
|
||||||
enum{MAX_CHILD_NODES=3};
|
enum{MAX_CHILD_NODES=3};
|
||||||
|
@ -95,6 +100,7 @@ private:
|
||||||
NodeType m_type;
|
NodeType m_type;
|
||||||
CTreeNode *m_children[MAX_CHILD_NODES];
|
CTreeNode *m_children[MAX_CHILD_NODES];
|
||||||
int m_numChildren;
|
int m_numChildren;
|
||||||
|
int m_functionNumber;
|
||||||
|
|
||||||
signed short m_variableIdx;
|
signed short m_variableIdx;
|
||||||
signed short m_value;
|
signed short m_value;
|
||||||
|
|
|
@ -45,6 +45,13 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
|
struct FunctionDef
|
||||||
|
{
|
||||||
|
char *m_name;
|
||||||
|
int m_argCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function Prototypes
|
Function Prototypes
|
||||||
------------------- */
|
------------------- */
|
||||||
|
@ -54,7 +61,8 @@
|
||||||
---- */
|
---- */
|
||||||
static FunctionDef s_functionNames[]=
|
static FunctionDef s_functionNames[]=
|
||||||
{
|
{
|
||||||
{ 0, "print", 1, },
|
{ "setCharacterExpression", 2, }, // character, expression
|
||||||
|
{ "setText", 1, }, // textId
|
||||||
};
|
};
|
||||||
static int s_functionCount=sizeof(s_functionNames)/sizeof(FunctionDef);
|
static int s_functionCount=sizeof(s_functionNames)/sizeof(FunctionDef);
|
||||||
|
|
||||||
|
@ -68,7 +76,7 @@ extern myparser s_parser;
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
extern FunctionDef *lookupFunctionName(char *_name)
|
extern int lookupFunctionName(char *_name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FunctionDef *fp;
|
FunctionDef *fp;
|
||||||
|
@ -78,14 +86,14 @@ extern FunctionDef *lookupFunctionName(char *_name)
|
||||||
{
|
{
|
||||||
if(strcmp(fp->m_name,_name)==0)
|
if(strcmp(fp->m_name,_name)==0)
|
||||||
{
|
{
|
||||||
return fp;
|
return i;
|
||||||
}
|
}
|
||||||
fp++;
|
fp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Unknown function name _%s\n",_name);
|
printf("Unknown function name _%s\n",_name);
|
||||||
s_lexer.error();
|
s_lexer.error();
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,38 +115,63 @@ extern int getFunctionArgCount(int _functionNumber)
|
||||||
Params:
|
Params:
|
||||||
Returns: A treenode that contains all of the functions arguments
|
Returns: A treenode that contains all of the functions arguments
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
extern CTreeNode *getFunctionArgs(int _argCount)
|
extern CTreeNode *getFunctionArgs(int _functionNumber)
|
||||||
{
|
{
|
||||||
int i;
|
int argCount,i;
|
||||||
int tokenType;
|
int tokenType;
|
||||||
|
|
||||||
if(_argCount)
|
argCount=s_functionNames[_functionNumber].m_argCount;
|
||||||
|
if(argCount)
|
||||||
{
|
{
|
||||||
CTreeNode *base;
|
CTreeNode *base;
|
||||||
|
|
||||||
// base=new CTreeNode(STMT_LIST
|
base=NULL;
|
||||||
for(i=0;i<_argCount;i++)
|
for(i=0;i<argCount;i++)
|
||||||
{
|
{
|
||||||
tokenType=s_parser.yygettoken();
|
tokenType=s_parser.yygettoken();
|
||||||
switch(tokenType)
|
switch(tokenType)
|
||||||
{
|
{
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
|
{
|
||||||
|
int var;
|
||||||
|
var=*((int*)s_parser.yylvalptr);
|
||||||
|
if(base)
|
||||||
|
base=new CTreeNode(STMT_LIST,base,new CTreeNode(VARIABLE_EXPR,(int)var));
|
||||||
|
else
|
||||||
|
base=new CTreeNode(STMT_LIST,new CTreeNode(VARIABLE_EXPR,(int)var));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case VALUE:
|
case VALUE:
|
||||||
|
{
|
||||||
|
signed short value;
|
||||||
|
value=*((signed short*)s_parser.yylvalptr);
|
||||||
|
if(base)
|
||||||
|
base=new CTreeNode(STMT_LIST,base,new CTreeNode(VALUE_EXPR,(int)value));
|
||||||
|
else
|
||||||
|
base=new CTreeNode(STMT_LIST,new CTreeNode(VALUE_EXPR,(int)value));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
printf("UNEXPECTED TOKEN '%s' FOR ARGUMENT %d\n",s_lexer.yytext,i+1);
|
printf("UNEXPECTED TOKEN '%s' FOR ARGUMENT %d\n",s_lexer.yytext,i+1);
|
||||||
s_lexer.error();
|
s_lexer.error();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(i<argCount-1)
|
||||||
|
{
|
||||||
|
if(s_parser.yygettoken()!=COMMA)
|
||||||
|
{
|
||||||
|
printf("EXPETCING ',' BUT FOUND '%s'\n",s_lexer.yytext);
|
||||||
|
s_lexer.error();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CTreeNode(EMPTY_STMT);
|
return base;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new CTreeNode(EMPTY_STMT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new CTreeNode(EMPTY_STMT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,6 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
struct FunctionDef
|
|
||||||
{
|
|
||||||
int m_functionNumber;
|
|
||||||
char *m_name;
|
|
||||||
int m_argCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Globals
|
Globals
|
||||||
------- */
|
------- */
|
||||||
|
@ -50,11 +42,11 @@ struct FunctionDef
|
||||||
Functions
|
Functions
|
||||||
--------- */
|
--------- */
|
||||||
|
|
||||||
extern FunctionDef *lookupFunctionName(char *_name);
|
extern int lookupFunctionName(char *_name);
|
||||||
|
|
||||||
extern int getFunctionArgCount(int _functionNumber);
|
extern int getFunctionArgCount(int _functionNumber);
|
||||||
|
|
||||||
extern CTreeNode *getFunctionArgs(int _argCount);
|
extern CTreeNode *getFunctionArgs(int _functionNumber);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------- */
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
|
@ -11,12 +11,13 @@ Date: 07 December 2000
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
|
#include "function.h"
|
||||||
#include "prepro.h"
|
#include "prepro.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 20 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 21 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
// repeated because of possible precompiled header
|
// repeated because of possible precompiled header
|
||||||
#include <clex.h>
|
#include <clex.h>
|
||||||
|
|
||||||
|
@ -28,11 +29,11 @@ Date: 07 December 2000
|
||||||
YYLEXNAME::YYLEXNAME()
|
YYLEXNAME::YYLEXNAME()
|
||||||
{
|
{
|
||||||
yytables();
|
yytables();
|
||||||
#line 45 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 46 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
// place any extra initialisation code here
|
// place any extra initialisation code here
|
||||||
|
|
||||||
#line 36 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 37 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef YYTEXT_SIZE
|
#ifndef YYTEXT_SIZE
|
||||||
|
@ -78,166 +79,180 @@ void YYLEXNAME::yyunput(int ch)
|
||||||
|
|
||||||
int YYLEXNAME::yyaction(int action)
|
int YYLEXNAME::yyaction(int action)
|
||||||
{
|
{
|
||||||
#line 57 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 58 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
// extract yylval for use later on in actions
|
// extract yylval for use later on in actions
|
||||||
YYSTYPE& yylval = *(YYSTYPE*)yyparserptr->yylvalptr;
|
YYSTYPE& yylval = *(YYSTYPE*)yyparserptr->yylvalptr;
|
||||||
|
|
||||||
#line 87 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 88 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
yyreturnflg = 1;
|
yyreturnflg = 1;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
#line 64 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 65 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
if(preprocessorCmd(yytext+1)!=(int)true)error();
|
if(preprocessorCmd(yytext+1)!=(int)true)error();
|
||||||
#line 94 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 95 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
#line 65 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 66 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
printf("# commands must be at start of line!\n");error();
|
printf("# commands must be at start of line!\n");error();
|
||||||
#line 101 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 102 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
#line 67 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 68 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return STOP;
|
return STOP;
|
||||||
#line 108 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 109 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
#line 68 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 69 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return IF;
|
return IF;
|
||||||
#line 115 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 116 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
#line 69 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 70 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return ELSE;
|
return ELSE;
|
||||||
#line 122 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 123 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
#line 70 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 71 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return PAUSE;
|
return PAUSE;
|
||||||
#line 129 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 130 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
#line 71 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 72 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return PRINT;
|
return PRINT;
|
||||||
#line 136 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 137 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
#line 72 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 73 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return ASSIGN;
|
return ASSIGN;
|
||||||
#line 143 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 144 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
{
|
{
|
||||||
#line 73 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 74 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return EQUAL;
|
return EQUAL;
|
||||||
#line 150 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 151 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
{
|
{
|
||||||
#line 74 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 75 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return NOTEQUAL;
|
return NOTEQUAL;
|
||||||
#line 157 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 158 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
{
|
{
|
||||||
#line 75 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 76 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return PLUS;
|
return PLUS;
|
||||||
#line 164 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 165 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
{
|
{
|
||||||
#line 76 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 77 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return END_STMT;
|
return END_STMT;
|
||||||
#line 171 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 172 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
{
|
{
|
||||||
#line 77 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 78 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return OPEN_PAR;
|
return OPEN_PAR;
|
||||||
#line 178 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 179 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
{
|
{
|
||||||
#line 78 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 79 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return CLOSE_PAR;
|
return CLOSE_PAR;
|
||||||
#line 185 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 186 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
{
|
{
|
||||||
#line 79 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 80 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return BEGIN_CS;
|
return BEGIN_CS;
|
||||||
#line 192 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 193 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
#line 80 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 81 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
return END_CS;
|
return END_CS;
|
||||||
#line 199 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 200 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
{
|
{
|
||||||
#line 82 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 82 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
yylval.variableIdx=lookupVarName(yytext+1);return VARIABLE;
|
return COMMA;
|
||||||
#line 206 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 207 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
{
|
{
|
||||||
#line 83 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 85 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
yylval.value=atoi(yytext);return VALUE;
|
yylval.variableIdx=lookupVarName(yytext+1);return VARIABLE;
|
||||||
#line 213 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 214 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
{
|
{
|
||||||
#line 86 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 86 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
yylval.value=atoi(yytext);return VALUE;
|
||||||
#line 220 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 221 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
{
|
{
|
||||||
#line 87 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 89 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
yylval.functionNumber=lookupFunctionName(yytext+1);return FUNCTION;
|
||||||
#line 227 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 228 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
{
|
{
|
||||||
#line 88 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 91 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
#line 234 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 235 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
{
|
{
|
||||||
#line 90 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 92 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
|
#line 242 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
#line 93 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
|
#line 249 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
{
|
||||||
|
#line 95 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
unexpectedChar();
|
unexpectedChar();
|
||||||
#line 241 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 256 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -253,7 +268,7 @@ unexpectedChar();
|
||||||
#pragma warn .rch // <warning: unreachable code> to the old state
|
#pragma warn .rch // <warning: unreachable code> to the old state
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#line 92 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 97 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +276,7 @@ unexpectedChar();
|
||||||
// programs section
|
// programs section
|
||||||
|
|
||||||
|
|
||||||
#line 265 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
#line 280 "C:\\spongebob\\Utils\\scripter\\lexer.cpp"
|
||||||
|
|
||||||
void YYLEXNAME::yytables()
|
void YYLEXNAME::yytables()
|
||||||
{
|
{
|
||||||
|
@ -273,7 +288,7 @@ void YYLEXNAME::yytables()
|
||||||
};
|
};
|
||||||
yymatch = match;
|
yymatch = match;
|
||||||
|
|
||||||
yytransitionmax = 251;
|
yytransitionmax = 336;
|
||||||
static const yytransition_t YYNEARFAR YYBASED_CODE transition[] = {
|
static const yytransition_t YYNEARFAR YYBASED_CODE transition[] = {
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -285,9 +300,9 @@ void YYLEXNAME::yytables()
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 19, 19 },
|
{ 21, 21 },
|
||||||
{ 0, 30 },
|
{ 0, 33 },
|
||||||
{ 0, 41 },
|
{ 0, 44 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -308,7 +323,7 @@ void YYLEXNAME::yytables()
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 19, 19 },
|
{ 21, 21 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 3, 1 },
|
{ 3, 1 },
|
||||||
|
@ -323,141 +338,226 @@ void YYLEXNAME::yytables()
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 30, 18 },
|
{ 33, 20 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 27, 8 },
|
{ 29, 8 },
|
||||||
{ 28, 9 },
|
{ 30, 9 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 29, 29 },
|
{ 31, 31 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 0, 16 },
|
{ 32, 32 },
|
||||||
{ 19, 2 },
|
{ 36, 27 },
|
||||||
{ 20, 2 },
|
{ 43, 41 },
|
||||||
{ 33, 25 },
|
{ 24, 4 },
|
||||||
{ 40, 38 },
|
{ 35, 26 },
|
||||||
{ 22, 4 },
|
{ 40, 36 },
|
||||||
{ 25, 7 },
|
|
||||||
{ 32, 24 },
|
|
||||||
{ 37, 33 },
|
|
||||||
{ 35, 31 },
|
|
||||||
{ 31, 22 },
|
|
||||||
{ 38, 34 },
|
{ 38, 34 },
|
||||||
{ 24, 6 },
|
{ 34, 24 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 17, 17 },
|
{ 32, 32 },
|
||||||
{ 26, 7 },
|
{ 32, 32 },
|
||||||
{ 19, 2 },
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 41, 37 },
|
||||||
|
{ 26, 6 },
|
||||||
|
{ 37, 28 },
|
||||||
|
{ 25, 5 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 39, 35 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 17 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 0, 19 },
|
||||||
|
{ 21, 2 },
|
||||||
|
{ 22, 2 },
|
||||||
|
{ 27, 7 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 18, 18 },
|
||||||
|
{ 42, 40 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 28, 7 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 21, 2 },
|
||||||
{ 9, 2 },
|
{ 9, 2 },
|
||||||
{ 34, 26 },
|
{ 0, 0 },
|
||||||
{ 41, 2 },
|
{ 44, 2 },
|
||||||
{ 16, 2 },
|
{ 17, 2 },
|
||||||
{ 23, 5 },
|
{ 0, 0 },
|
||||||
{ 36, 32 },
|
{ 0, 0 },
|
||||||
{ 39, 37 },
|
{ 0, 0 },
|
||||||
{ 12, 2 },
|
{ 12, 2 },
|
||||||
{ 13, 2 },
|
{ 13, 2 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 10, 2 },
|
{ 10, 2 },
|
||||||
|
{ 16, 2 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 20, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
|
{ 18, 2 },
|
||||||
{ 18, 2 },
|
{ 18, 2 },
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 17, 2 },
|
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 11, 2 },
|
{ 11, 2 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -495,7 +595,7 @@ void YYLEXNAME::yytables()
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 19, 2 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -532,46 +632,49 @@ void YYLEXNAME::yytables()
|
||||||
static const yystate_t YYNEARFAR YYBASED_CODE state[] = {
|
static const yystate_t YYNEARFAR YYBASED_CODE state[] = {
|
||||||
{ 0, 0, 0 },
|
{ 0, 0, 0 },
|
||||||
{ 2, 1, 0 },
|
{ 2, 1, 0 },
|
||||||
{ -21, 125, 0 },
|
{ -23, 210, 0 },
|
||||||
{ 0, 0, 2 },
|
{ 0, 0, 2 },
|
||||||
{ 38, 22, 22 },
|
{ 41, 20, 24 },
|
||||||
{ 0, 60, 22 },
|
{ 0, 68, 24 },
|
||||||
{ 0, 37, 22 },
|
{ 0, 60, 24 },
|
||||||
{ 0, 42, 22 },
|
{ 0, 124, 24 },
|
||||||
{ 9, 1, 8 },
|
{ 9, 1, 8 },
|
||||||
{ 0, 2, 22 },
|
{ 0, 2, 24 },
|
||||||
{ 0, 0, 11 },
|
{ 0, 0, 11 },
|
||||||
{ 0, 0, 12 },
|
{ 0, 0, 12 },
|
||||||
{ 0, 0, 13 },
|
{ 0, 0, 13 },
|
||||||
{ 0, 0, 14 },
|
{ 0, 0, 14 },
|
||||||
{ 0, 0, 15 },
|
{ 0, 0, 15 },
|
||||||
{ 0, 0, 16 },
|
{ 0, 0, 16 },
|
||||||
{ 29, 76, 22 },
|
{ 0, 0, 17 },
|
||||||
{ 0, 98, 18 },
|
{ 31, 151, 24 },
|
||||||
|
{ 0, 174, 19 },
|
||||||
|
{ 32, 161, 24 },
|
||||||
|
{ 0, 1, 24 },
|
||||||
{ 0, 1, 22 },
|
{ 0, 1, 22 },
|
||||||
{ 0, 1, 20 },
|
{ 0, 0, 23 },
|
||||||
{ 0, 0, 21 },
|
{ 0, 0, 24 },
|
||||||
{ 0, 0, 22 },
|
{ 0, 29, 0 },
|
||||||
{ 0, 32, 0 },
|
|
||||||
{ 0, 0, 4 },
|
{ 0, 0, 4 },
|
||||||
{ 33, 25, 0 },
|
{ 36, 22, 0 },
|
||||||
{ 0, 19, 0 },
|
{ 0, 17, 0 },
|
||||||
{ 0, 54, 0 },
|
{ 0, 64, 0 },
|
||||||
{ 0, 0, 9 },
|
{ 0, 0, 9 },
|
||||||
{ 0, 0, 10 },
|
{ 0, 0, 10 },
|
||||||
{ 38, 1, 17 },
|
{ 41, 1, 18 },
|
||||||
{ -30, 1, 19 },
|
{ 41, 76, 20 },
|
||||||
{ 0, 30, 0 },
|
{ -33, 1, 21 },
|
||||||
{ 37, 62, 0 },
|
{ 0, 27, 0 },
|
||||||
{ 0, 26, 0 },
|
{ 40, 71, 0 },
|
||||||
{ 0, 34, 0 },
|
{ 0, 23, 0 },
|
||||||
|
{ 0, 57, 0 },
|
||||||
{ 0, 0, 3 },
|
{ 0, 0, 3 },
|
||||||
{ 0, 0, 5 },
|
{ 0, 0, 5 },
|
||||||
{ 0, 63, 0 },
|
{ 0, 131, 0 },
|
||||||
{ 0, 21, 0 },
|
{ 0, 19, 0 },
|
||||||
{ 0, 0, 6 },
|
{ 0, 0, 6 },
|
||||||
{ 0, 0, 7 },
|
{ 0, 0, 7 },
|
||||||
{ -41, 2, 1 }
|
{ -44, 2, 1 }
|
||||||
};
|
};
|
||||||
yystate = state;
|
yystate = state;
|
||||||
|
|
||||||
|
@ -598,6 +701,8 @@ void YYLEXNAME::yytables()
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
yybackup = backup;
|
yybackup = backup;
|
||||||
|
|
|
@ -15,7 +15,7 @@ protected:
|
||||||
virtual int yyaction(int action);
|
virtual int yyaction(int action);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#line 24 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
#line 25 "C:\\spongebob\\Utils\\scripter\\lexer.l"
|
||||||
|
|
||||||
int openInputFile(char *_filename);
|
int openInputFile(char *_filename);
|
||||||
int closeInputFile();
|
int closeInputFile();
|
||||||
|
|
|
@ -8,6 +8,7 @@ Date: 07 December 2000
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
|
#include "function.h"
|
||||||
#include "prepro.h"
|
#include "prepro.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -78,11 +79,15 @@ print {return PRINT;}
|
||||||
\) {return CLOSE_PAR;}
|
\) {return CLOSE_PAR;}
|
||||||
\{ {return BEGIN_CS;}
|
\{ {return BEGIN_CS;}
|
||||||
\} {return END_CS;}
|
\} {return END_CS;}
|
||||||
|
, {return COMMA;}
|
||||||
|
|
||||||
|
|
||||||
\$[a-zA-Z_][a-zA-Z_0-9]* {yylval.variableIdx=lookupVarName(yytext+1);return VARIABLE;}
|
\$[a-zA-Z_][a-zA-Z_0-9]* {yylval.variableIdx=lookupVarName(yytext+1);return VARIABLE;}
|
||||||
[0-9]+ {yylval.value=atoi(yytext);return VALUE;}
|
[0-9]+ {yylval.value=atoi(yytext);return VALUE;}
|
||||||
// \"[^\"]*\" {printf("s:%s\n",yytext);return STRING;}
|
// \"[^\"]*\" {printf("s:%s\n",yytext);return STRING;}
|
||||||
|
|
||||||
|
_[a-zA-Z_][a-zA-Z_0-9]* {yylval.functionNumber=lookupFunctionName(yytext+1);return FUNCTION;}
|
||||||
|
|
||||||
\/\/.* {}
|
\/\/.* {}
|
||||||
[ \t]+ {}
|
[ \t]+ {}
|
||||||
\n {}
|
\n {}
|
||||||
|
|
|
@ -9,12 +9,13 @@ ParserWizard generated YACC file.
|
||||||
Date: 07 December 2000
|
Date: 07 December 2000
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "function.h"
|
||||||
#include "lexer.h"
|
#include "lexer.h"
|
||||||
#include "codegen.h"
|
#include "codegen.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 18 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 19 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
// repeated because of possible precompiled header
|
// repeated because of possible precompiled header
|
||||||
#include <cyacc.h>
|
#include <cyacc.h>
|
||||||
|
|
||||||
|
@ -26,11 +27,11 @@ Date: 07 December 2000
|
||||||
YYPARSENAME::YYPARSENAME()
|
YYPARSENAME::YYPARSENAME()
|
||||||
{
|
{
|
||||||
yytables();
|
yytables();
|
||||||
#line 38 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 43 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
|
||||||
// place any extra initialisation code here
|
// place any extra initialisation code here
|
||||||
|
|
||||||
#line 34 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 35 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
|
@ -75,9 +76,9 @@ void YYPARSENAME::yyaction(int action)
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 92 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 102 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
s_baseTreeNode=yyattribute(1 - 1).treenode;
|
s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
#line 81 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 82 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -88,17 +89,17 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 3);
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 96 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 106 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,yyattribute(1 - 2).treenode,yyattribute(2 - 2).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,yyattribute(1 - 2).treenode,yyattribute(2 - 2).treenode);
|
||||||
#line 94 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 95 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
#line 97 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 107 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EMPTY_STMT);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EMPTY_STMT);
|
||||||
#line 102 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 103 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -108,9 +109,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 101 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 111 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EMPTY_STMT);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EMPTY_STMT);
|
||||||
#line 114 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 115 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -121,9 +122,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 3);
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 102 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 112 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STOP_STMT);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STOP_STMT);
|
||||||
#line 127 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 128 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -134,9 +135,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 3);
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 103 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 113 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PAUSE_STMT);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PAUSE_STMT);
|
||||||
#line 140 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 141 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -147,9 +148,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 6);
|
yyinitdebug((void YYFAR**)yya, 6);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 104 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 114 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PRINT_STMT,yyattribute(3 - 5).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PRINT_STMT,yyattribute(3 - 5).treenode);
|
||||||
#line 153 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 154 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -160,9 +161,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 3);
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 105 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 115 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 2).treenode;
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 2).treenode;
|
||||||
#line 166 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 167 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -173,9 +174,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 6);
|
yyinitdebug((void YYFAR**)yya, 6);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 106 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 116 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(IF_STMT,yyattribute(3 - 5).treenode,yyattribute(5 - 5).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(IF_STMT,yyattribute(3 - 5).treenode,yyattribute(5 - 5).treenode);
|
||||||
#line 179 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 180 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -186,9 +187,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 8);
|
yyinitdebug((void YYFAR**)yya, 8);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 107 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 117 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(IFELSE_STMT,yyattribute(3 - 7).treenode,yyattribute(5 - 7).treenode,yyattribute(7 - 7).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(IFELSE_STMT,yyattribute(3 - 7).treenode,yyattribute(5 - 7).treenode,yyattribute(7 - 7).treenode);
|
||||||
#line 192 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 193 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -199,22 +200,22 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 108 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 118 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,yyattribute(2 - 3).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,yyattribute(2 - 3).treenode);
|
||||||
#line 205 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 206 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
{
|
{
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
YYSTYPE YYFAR* yya[4];
|
YYSTYPE YYFAR* yya[3];
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 113 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 119 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(ASSIGN_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,yyattribute(1 - 2).treenode,new CTreeNode(POP_STMT));
|
||||||
#line 218 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 219 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -225,22 +226,22 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 118 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 124 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(2 - 3).treenode;
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(ASSIGN_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
||||||
#line 231 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 232 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
{
|
{
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
YYSTYPE YYFAR* yya[2];
|
YYSTYPE YYFAR* yya[4];
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 119 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 129 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 1).treenode;
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(2 - 3).treenode;
|
||||||
#line 244 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 245 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -251,22 +252,22 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 120 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 130 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 1).treenode;
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 1).treenode;
|
||||||
#line 257 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 258 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
{
|
{
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
YYSTYPE YYFAR* yya[4];
|
YYSTYPE YYFAR* yya[2];
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 124 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 131 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EQUAL_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 1).treenode;
|
||||||
#line 270 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 271 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -277,22 +278,22 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 128 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 135 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(NOTEQUAL_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(EQUAL_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
||||||
#line 283 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 284 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
{
|
{
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
YYSTYPE YYFAR* yya[2];
|
YYSTYPE YYFAR* yya[4];
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 133 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 139 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VARIABLE_EXPR,yyattribute(1 - 1).variableIdx);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(NOTEQUAL_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
||||||
#line 296 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 297 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -303,9 +304,9 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 137 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 144 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VALUE_EXPR,yyattribute(1 - 1).value);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VARIABLE_EXPR,yyattribute(1 - 1).variableIdx);
|
||||||
#line 309 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 310 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -316,22 +317,74 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
yyinitdebug((void YYFAR**)yya, 2);
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 138 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 148 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VARIABLE_EXPR,yyattribute(1 - 1).variableIdx);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VALUE_EXPR,yyattribute(1 - 1).value);
|
||||||
#line 322 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 323 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
{
|
{
|
||||||
|
#ifdef YYDEBUG
|
||||||
|
YYSTYPE YYFAR* yya[2];
|
||||||
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#line 149 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(VARIABLE_EXPR,yyattribute(1 - 1).variableIdx);
|
||||||
|
#line 336 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
{
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
YYSTYPE YYFAR* yya[4];
|
YYSTYPE YYFAR* yya[4];
|
||||||
yyinitdebug((void YYFAR**)yya, 4);
|
yyinitdebug((void YYFAR**)yya, 4);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#line 139 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 150 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PLUS_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(PLUS_EXPR,yyattribute(1 - 3).treenode,yyattribute(3 - 3).treenode);
|
||||||
#line 335 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 349 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
#ifdef YYDEBUG
|
||||||
|
YYSTYPE YYFAR* yya[2];
|
||||||
|
yyinitdebug((void YYFAR**)yya, 2);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#line 151 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=yyattribute(1 - 1).treenode;
|
||||||
|
#line 362 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
#ifdef YYDEBUG
|
||||||
|
YYSTYPE YYFAR* yya[3];
|
||||||
|
yyinitdebug((void YYFAR**)yya, 3);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#line 156 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
if(yyattribute(1 - 2).functionNumber!=-1){m_functionNumber=yyattribute(1 - 2).functionNumber;m_functionArgs=getFunctionArgs(yyattribute(1 - 2).functionNumber);}
|
||||||
|
#line 375 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
{
|
||||||
|
#ifdef YYDEBUG
|
||||||
|
YYSTYPE YYFAR* yya[5];
|
||||||
|
yyinitdebug((void YYFAR**)yya, 5);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#line 157 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
(*(YYSTYPE YYFAR*)yyvalptr).treenode=new CTreeNode(STMT_LIST,m_functionArgs,new CTreeNode(FUNCTION_EXPR,m_functionNumber));
|
||||||
|
#line 388 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -340,14 +393,14 @@ s_baseTreeNode=yyattribute(1 - 1).treenode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#line 144 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 162 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// programs section
|
// programs section
|
||||||
|
|
||||||
#line 351 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
#line 404 "C:\\spongebob\\Utils\\scripter\\parser.cpp"
|
||||||
void YYPARSENAME::yytables()
|
void YYPARSENAME::yytables()
|
||||||
{
|
{
|
||||||
yyattribute_size = sizeof(YYSTYPE);
|
yyattribute_size = sizeof(YYSTYPE);
|
||||||
|
@ -371,8 +424,9 @@ void YYPARSENAME::yytables()
|
||||||
{ "CLOSE_PAR", 268 },
|
{ "CLOSE_PAR", 268 },
|
||||||
{ "BEGIN_CS", 269 },
|
{ "BEGIN_CS", 269 },
|
||||||
{ "END_CS", 270 },
|
{ "END_CS", 270 },
|
||||||
{ "VARIABLE", 271 },
|
{ "VARIABLE", 272 },
|
||||||
{ "VALUE", 272 },
|
{ "VALUE", 273 },
|
||||||
|
{ "FUNCTION", 274 },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
yysymbol = symbol;
|
yysymbol = symbol;
|
||||||
|
@ -390,6 +444,7 @@ void YYPARSENAME::yytables()
|
||||||
"statement: IF OPEN_PAR expression CLOSE_PAR statement",
|
"statement: IF OPEN_PAR expression CLOSE_PAR statement",
|
||||||
"statement: IF OPEN_PAR expression CLOSE_PAR statement ELSE statement",
|
"statement: IF OPEN_PAR expression CLOSE_PAR statement ELSE statement",
|
||||||
"statement: BEGIN_CS statement_list END_CS",
|
"statement: BEGIN_CS statement_list END_CS",
|
||||||
|
"statement: function END_STMT",
|
||||||
"assign_expression: variable ASSIGN value",
|
"assign_expression: variable ASSIGN value",
|
||||||
"expression: OPEN_PAR expression CLOSE_PAR",
|
"expression: OPEN_PAR expression CLOSE_PAR",
|
||||||
"expression: equal_expression",
|
"expression: equal_expression",
|
||||||
|
@ -399,7 +454,10 @@ void YYPARSENAME::yytables()
|
||||||
"variable: VARIABLE",
|
"variable: VARIABLE",
|
||||||
"value: VALUE",
|
"value: VALUE",
|
||||||
"value: VARIABLE",
|
"value: VARIABLE",
|
||||||
"value: value PLUS value"
|
"value: value PLUS value",
|
||||||
|
"value: function",
|
||||||
|
"$$1:",
|
||||||
|
"function: FUNCTION OPEN_PAR $$1 CLOSE_PAR"
|
||||||
};
|
};
|
||||||
yyrule = rule;
|
yyrule = rule;
|
||||||
#endif
|
#endif
|
||||||
|
@ -417,155 +475,179 @@ void YYPARSENAME::yytables()
|
||||||
{ 3, 5, 8 },
|
{ 3, 5, 8 },
|
||||||
{ 3, 7, 9 },
|
{ 3, 7, 9 },
|
||||||
{ 3, 3, 10 },
|
{ 3, 3, 10 },
|
||||||
{ 4, 3, 11 },
|
{ 3, 2, 11 },
|
||||||
{ 5, 3, 12 },
|
{ 4, 3, 12 },
|
||||||
{ 5, 1, 13 },
|
{ 5, 3, 13 },
|
||||||
{ 5, 1, 14 },
|
{ 5, 1, 14 },
|
||||||
{ 6, 3, 15 },
|
{ 5, 1, 15 },
|
||||||
{ 7, 3, 16 },
|
{ 6, 3, 16 },
|
||||||
{ 8, 1, 17 },
|
{ 7, 3, 17 },
|
||||||
{ 9, 1, 18 },
|
{ 8, 1, 18 },
|
||||||
{ 9, 1, 19 },
|
{ 9, 1, 19 },
|
||||||
{ 9, 3, 20 }
|
{ 9, 1, 20 },
|
||||||
|
{ 9, 3, 21 },
|
||||||
|
{ 9, 1, 22 },
|
||||||
|
{ 11, 0, 23 },
|
||||||
|
{ 10, 4, 24 }
|
||||||
};
|
};
|
||||||
yyreduction = reduction;
|
yyreduction = reduction;
|
||||||
|
|
||||||
static const yytokenaction_t YYNEARFAR YYBASED_CODE tokenaction[] = {
|
static const yytokenaction_t YYNEARFAR YYBASED_CODE tokenaction[] = {
|
||||||
{ 42, YYAT_SHIFT, 3 },
|
{ 49, YYAT_SHIFT, 3 },
|
||||||
{ 42, YYAT_SHIFT, 4 },
|
{ 49, YYAT_SHIFT, 4 },
|
||||||
{ 27, YYAT_SHIFT, 34 },
|
{ 32, YYAT_SHIFT, 40 },
|
||||||
{ 42, YYAT_SHIFT, 5 },
|
{ 49, YYAT_SHIFT, 5 },
|
||||||
{ 42, YYAT_SHIFT, 6 },
|
{ 49, YYAT_SHIFT, 6 },
|
||||||
{ 27, YYAT_SHIFT, 35 },
|
{ 32, YYAT_SHIFT, 41 },
|
||||||
{ 40, YYAT_SHIFT, 34 },
|
{ 47, YYAT_SHIFT, 40 },
|
||||||
{ 2, YYAT_SHIFT, 3 },
|
{ 2, YYAT_SHIFT, 3 },
|
||||||
{ 2, YYAT_SHIFT, 4 },
|
{ 2, YYAT_SHIFT, 4 },
|
||||||
{ 42, YYAT_SHIFT, 7 },
|
{ 49, YYAT_SHIFT, 7 },
|
||||||
{ 2, YYAT_SHIFT, 5 },
|
{ 2, YYAT_SHIFT, 5 },
|
||||||
{ 2, YYAT_SHIFT, 6 },
|
{ 2, YYAT_SHIFT, 6 },
|
||||||
{ 42, YYAT_SHIFT, 8 },
|
{ 49, YYAT_SHIFT, 8 },
|
||||||
{ 39, YYAT_SHIFT, 34 },
|
{ 30, YYAT_SHIFT, 38 },
|
||||||
{ 42, YYAT_SHIFT, 9 },
|
{ 30, YYAT_SHIFT, 39 },
|
||||||
{ 38, YYAT_SHIFT, 34 },
|
{ 49, YYAT_SHIFT, 9 },
|
||||||
{ 2, YYAT_SHIFT, 7 },
|
{ 2, YYAT_SHIFT, 7 },
|
||||||
{ 26, YYAT_SHIFT, 32 },
|
{ 49, YYAT_SHIFT, 10 },
|
||||||
{ 26, YYAT_SHIFT, 33 },
|
{ 30, YYAT_ERROR, 0 },
|
||||||
{ 2, YYAT_SHIFT, 8 },
|
{ 2, YYAT_SHIFT, 8 },
|
||||||
{ 37, YYAT_SHIFT, 42 },
|
{ 46, YYAT_SHIFT, 40 },
|
||||||
|
{ 45, YYAT_SHIFT, 40 },
|
||||||
{ 2, YYAT_SHIFT, 9 },
|
{ 2, YYAT_SHIFT, 9 },
|
||||||
{ 26, YYAT_ERROR, 0 },
|
{ 44, YYAT_SHIFT, 49 },
|
||||||
{ 34, YYAT_SHIFT, 21 },
|
{ 2, YYAT_SHIFT, 10 },
|
||||||
{ 34, YYAT_SHIFT, 22 },
|
{ 40, YYAT_SHIFT, 25 },
|
||||||
{ 35, YYAT_SHIFT, 41 },
|
{ 40, YYAT_SHIFT, 26 },
|
||||||
{ 30, YYAT_SHIFT, 36 },
|
{ 40, YYAT_SHIFT, 10 },
|
||||||
{ 29, YYAT_SHIFT, 34 },
|
{ 41, YYAT_SHIFT, 48 },
|
||||||
{ 23, YYAT_SHIFT, 31 },
|
{ 36, YYAT_SHIFT, 43 },
|
||||||
{ 20, YYAT_SHIFT, 20 },
|
{ 35, YYAT_SHIFT, 40 },
|
||||||
{ 17, YYAT_SHIFT, 28 },
|
{ 34, YYAT_SHIFT, 42 },
|
||||||
{ 12, YYAT_SHIFT, 19 },
|
{ 27, YYAT_SHIFT, 37 },
|
||||||
{ 11, YYAT_SHIFT, 18 },
|
{ 24, YYAT_SHIFT, 24 },
|
||||||
{ 6, YYAT_SHIFT, 16 },
|
{ 19, YYAT_SHIFT, 33 },
|
||||||
{ 5, YYAT_SHIFT, 15 },
|
{ 14, YYAT_SHIFT, 23 },
|
||||||
{ 4, YYAT_SHIFT, 14 },
|
{ 13, YYAT_SHIFT, 22 },
|
||||||
{ 3, YYAT_SHIFT, 13 },
|
{ 12, YYAT_SHIFT, 21 },
|
||||||
|
{ 10, YYAT_SHIFT, 20 },
|
||||||
|
{ 6, YYAT_SHIFT, 18 },
|
||||||
|
{ 5, YYAT_SHIFT, 17 },
|
||||||
|
{ 4, YYAT_SHIFT, 16 },
|
||||||
|
{ 3, YYAT_SHIFT, 15 },
|
||||||
{ 1, YYAT_ACCEPT, 0 }
|
{ 1, YYAT_ACCEPT, 0 }
|
||||||
};
|
};
|
||||||
yytokenaction = tokenaction;
|
yytokenaction = tokenaction;
|
||||||
yytokenaction_size = 38;
|
yytokenaction_size = 44;
|
||||||
|
|
||||||
static const yystateaction_t YYNEARFAR YYBASED_CODE stateaction[] = {
|
static const yystateaction_t YYNEARFAR YYBASED_CODE stateaction[] = {
|
||||||
{ 0, 0, YYAT_REDUCE, 3 },
|
{ 0, 0, YYAT_REDUCE, 3 },
|
||||||
{ 37, 1, YYAT_ERROR, 0 },
|
{ 43, 1, YYAT_ERROR, 0 },
|
||||||
{ -250, 1, YYAT_REDUCE, 1 },
|
{ -250, 1, YYAT_REDUCE, 1 },
|
||||||
{ -230, 1, YYAT_DEFAULT, 35 },
|
{ -224, 1, YYAT_DEFAULT, 41 },
|
||||||
{ -232, 1, YYAT_DEFAULT, 6 },
|
{ -226, 1, YYAT_DEFAULT, 10 },
|
||||||
{ -232, 1, YYAT_DEFAULT, 35 },
|
{ -226, 1, YYAT_DEFAULT, 41 },
|
||||||
{ -234, 1, YYAT_ERROR, 0 },
|
{ -228, 1, YYAT_DEFAULT, 10 },
|
||||||
{ 0, 0, YYAT_REDUCE, 4 },
|
{ 0, 0, YYAT_REDUCE, 4 },
|
||||||
{ 0, 0, YYAT_REDUCE, 3 },
|
{ 0, 0, YYAT_REDUCE, 3 },
|
||||||
{ 0, 0, YYAT_REDUCE, 18 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 2 },
|
|
||||||
{ -234, 1, YYAT_DEFAULT, 35 },
|
|
||||||
{ -231, 1, YYAT_ERROR, 0 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 5 },
|
|
||||||
{ 0, 0, YYAT_DEFAULT, 20 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 6 },
|
|
||||||
{ 0, 0, YYAT_DEFAULT, 34 },
|
|
||||||
{ -240, 1, YYAT_DEFAULT, 42 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 8 },
|
|
||||||
{ 0, 0, YYAT_DEFAULT, 34 },
|
|
||||||
{ -238, 1, YYAT_DEFAULT, 34 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 20 },
|
|
||||||
{ 0, 0, YYAT_REDUCE, 19 },
|
{ 0, 0, YYAT_REDUCE, 19 },
|
||||||
{ -240, 1, YYAT_DEFAULT, 30 },
|
{ -229, 1, YYAT_ERROR, 0 },
|
||||||
{ 0, 0, YYAT_REDUCE, 14 },
|
{ 0, 0, YYAT_REDUCE, 2 },
|
||||||
|
{ -229, 1, YYAT_DEFAULT, 41 },
|
||||||
|
{ -226, 1, YYAT_ERROR, 0 },
|
||||||
|
{ -231, 1, YYAT_DEFAULT, 41 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 5 },
|
||||||
|
{ 0, 0, YYAT_DEFAULT, 24 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 6 },
|
||||||
|
{ 0, 0, YYAT_DEFAULT, 40 },
|
||||||
|
{ -236, 1, YYAT_DEFAULT, 49 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 24 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 8 },
|
||||||
|
{ 0, 0, YYAT_DEFAULT, 40 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 12 },
|
||||||
|
{ -234, 1, YYAT_DEFAULT, 40 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 21 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 20 },
|
||||||
|
{ -236, 1, YYAT_DEFAULT, 36 },
|
||||||
{ 0, 0, YYAT_REDUCE, 15 },
|
{ 0, 0, YYAT_REDUCE, 15 },
|
||||||
{ -246, 1, YYAT_DEFAULT, 27 },
|
{ 0, 0, YYAT_REDUCE, 16 },
|
||||||
{ -263, 1, YYAT_DEFAULT, 30 },
|
{ -250, 1, YYAT_DEFAULT, 32 },
|
||||||
|
{ 0, 0, YYAT_REDUCE, 23 },
|
||||||
|
{ -263, 1, YYAT_DEFAULT, 36 },
|
||||||
{ 0, 0, YYAT_REDUCE, 11 },
|
{ 0, 0, YYAT_REDUCE, 11 },
|
||||||
{ -238, 1, YYAT_REDUCE, 12 },
|
{ -237, 1, YYAT_DEFAULT, 36 },
|
||||||
{ -242, 1, YYAT_ERROR, 0 },
|
{ -235, 1, YYAT_REDUCE, 13 },
|
||||||
{ 0, 0, YYAT_DEFAULT, 42 },
|
{ -239, 1, YYAT_ERROR, 0 },
|
||||||
{ 0, 0, YYAT_DEFAULT, 34 },
|
{ 0, 0, YYAT_DEFAULT, 49 },
|
||||||
{ 0, 0, YYAT_DEFAULT, 34 },
|
{ 0, 0, YYAT_DEFAULT, 40 },
|
||||||
{ -248, 1, YYAT_ERROR, 0 },
|
{ 0, 0, YYAT_DEFAULT, 40 },
|
||||||
{ -241, 1, YYAT_ERROR, 0 },
|
{ -247, 1, YYAT_ERROR, 0 },
|
||||||
{ 0, 0, YYAT_REDUCE, 13 },
|
{ -238, 1, YYAT_ERROR, 0 },
|
||||||
{ -239, 1, YYAT_REDUCE, 9 },
|
{ 0, 0, YYAT_REDUCE, 25 },
|
||||||
{ -250, 1, YYAT_REDUCE, 16 },
|
{ 0, 0, YYAT_REDUCE, 14 },
|
||||||
{ -252, 1, YYAT_REDUCE, 17 },
|
{ -236, 1, YYAT_REDUCE, 9 },
|
||||||
{ -259, 1, YYAT_REDUCE, 21 },
|
{ -244, 1, YYAT_REDUCE, 17 },
|
||||||
|
{ -245, 1, YYAT_REDUCE, 18 },
|
||||||
|
{ -259, 1, YYAT_REDUCE, 22 },
|
||||||
{ 0, 0, YYAT_REDUCE, 7 },
|
{ 0, 0, YYAT_REDUCE, 7 },
|
||||||
{ -257, 1, YYAT_DEFAULT, 35 },
|
{ -257, 1, YYAT_DEFAULT, 41 },
|
||||||
{ 0, 0, YYAT_REDUCE, 10 }
|
{ 0, 0, YYAT_REDUCE, 10 }
|
||||||
};
|
};
|
||||||
yystateaction = stateaction;
|
yystateaction = stateaction;
|
||||||
|
|
||||||
static const yynontermgoto_t YYNEARFAR YYBASED_CODE nontermgoto[] = {
|
static const yynontermgoto_t YYNEARFAR YYBASED_CODE nontermgoto[] = {
|
||||||
{ 20, 30 },
|
{ 49, 50 },
|
||||||
{ 20, 24 },
|
{ 49, 12 },
|
||||||
{ 20, 25 },
|
{ 24, 36 },
|
||||||
{ 34, 40 },
|
{ 24, 28 },
|
||||||
{ 20, 26 },
|
{ 24, 29 },
|
||||||
{ 42, 43 },
|
{ 49, 13 },
|
||||||
{ 42, 11 },
|
{ 24, 30 },
|
||||||
|
{ 49, 14 },
|
||||||
|
{ 40, 47 },
|
||||||
|
{ 40, 31 },
|
||||||
{ 0, 1 },
|
{ 0, 1 },
|
||||||
{ 0, 2 },
|
{ 0, 2 },
|
||||||
{ 33, 39 },
|
{ 39, 46 },
|
||||||
{ 42, 12 },
|
{ 38, 45 },
|
||||||
{ 32, 38 },
|
{ 37, 44 },
|
||||||
{ 31, 37 },
|
{ 22, 35 },
|
||||||
{ 19, 29 },
|
{ 20, 34 },
|
||||||
{ 17, 10 },
|
{ 19, 11 },
|
||||||
|
{ 18, 32 },
|
||||||
{ 16, 27 },
|
{ 16, 27 },
|
||||||
{ 14, 23 },
|
{ 8, 19 }
|
||||||
{ 8, 17 }
|
|
||||||
};
|
};
|
||||||
yynontermgoto = nontermgoto;
|
yynontermgoto = nontermgoto;
|
||||||
yynontermgoto_size = 18;
|
yynontermgoto_size = 21;
|
||||||
|
|
||||||
static const yystategoto_t YYNEARFAR YYBASED_CODE stategoto[] = {
|
static const yystategoto_t YYNEARFAR YYBASED_CODE stategoto[] = {
|
||||||
{ 6, -1 },
|
{ 9, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, 17 },
|
{ 0, 19 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 15, -1 },
|
{ 18, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 11, 20 },
|
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 6, -1 },
|
|
||||||
{ 11, 42 },
|
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 4, -1 },
|
{ 14, 24 },
|
||||||
{ -5, -1 },
|
{ 0, -1 },
|
||||||
|
{ 9, 40 },
|
||||||
|
{ 14, 49 },
|
||||||
|
{ 5, -1 },
|
||||||
|
{ 0, -1 },
|
||||||
|
{ 6, 40 },
|
||||||
|
{ 0, -1 },
|
||||||
|
{ -3, 40 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
|
@ -576,10 +658,12 @@ void YYPARSENAME::yytables()
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 9, 42 },
|
|
||||||
{ 2, -1 },
|
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ -6, -1 },
|
{ 0, -1 },
|
||||||
|
{ 11, 49 },
|
||||||
|
{ 4, 40 },
|
||||||
|
{ 3, 40 },
|
||||||
|
{ -1, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
|
@ -587,7 +671,8 @@ void YYPARSENAME::yytables()
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 0, -1 },
|
{ 0, -1 },
|
||||||
{ 2, -1 },
|
{ 0, -1 },
|
||||||
|
{ -3, -1 },
|
||||||
{ 0, -1 }
|
{ 0, -1 }
|
||||||
};
|
};
|
||||||
yystategoto = stategoto;
|
yystategoto = stategoto;
|
||||||
|
|
|
@ -19,7 +19,7 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#line 22 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 23 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setCurrentLexer(class mylexer *_lexer);
|
void setCurrentLexer(class mylexer *_lexer);
|
||||||
|
@ -33,8 +33,12 @@ private:
|
||||||
class mylexer *m_currentLexer;
|
class mylexer *m_currentLexer;
|
||||||
class CTreeNode *m_baseNode;
|
class CTreeNode *m_baseNode;
|
||||||
|
|
||||||
|
// Ugh! (pkg)
|
||||||
|
class CTreeNode *m_functionArgs;
|
||||||
|
int m_functionNumber;
|
||||||
|
|
||||||
#line 38 "C:\\spongebob\\Utils\\scripter\\parser.h"
|
|
||||||
|
#line 42 "C:\\spongebob\\Utils\\scripter\\parser.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef YYPARSENAME
|
#ifndef YYPARSENAME
|
||||||
|
@ -43,13 +47,14 @@ private:
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
union tagYYSTYPE {
|
union tagYYSTYPE {
|
||||||
#line 49 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
#line 54 "C:\\spongebob\\Utils\\scripter\\parser.y"
|
||||||
|
|
||||||
int variableIdx;
|
int variableIdx;
|
||||||
signed short value;
|
signed short value;
|
||||||
class CTreeNode *treenode;
|
int functionNumber;
|
||||||
|
class CTreeNode *treenode;
|
||||||
|
|
||||||
#line 53 "C:\\spongebob\\Utils\\scripter\\parser.h"
|
#line 58 "C:\\spongebob\\Utils\\scripter\\parser.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define YYSTYPE union tagYYSTYPE
|
#define YYSTYPE union tagYYSTYPE
|
||||||
|
@ -69,6 +74,8 @@ union tagYYSTYPE {
|
||||||
#define CLOSE_PAR 268
|
#define CLOSE_PAR 268
|
||||||
#define BEGIN_CS 269
|
#define BEGIN_CS 269
|
||||||
#define END_CS 270
|
#define END_CS 270
|
||||||
#define VARIABLE 271
|
#define COMMA 271
|
||||||
#define VALUE 272
|
#define VARIABLE 272
|
||||||
|
#define VALUE 273
|
||||||
|
#define FUNCTION 274
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,22 +13,28 @@
|
||||||
9 | IF OPEN_PAR expression CLOSE_PAR statement
|
9 | IF OPEN_PAR expression CLOSE_PAR statement
|
||||||
10 | IF OPEN_PAR expression CLOSE_PAR statement ELSE statement
|
10 | IF OPEN_PAR expression CLOSE_PAR statement ELSE statement
|
||||||
11 | BEGIN_CS statement_list END_CS
|
11 | BEGIN_CS statement_list END_CS
|
||||||
|
12 | function END_STMT
|
||||||
|
|
||||||
12 assign_expression : variable ASSIGN value
|
13 assign_expression : variable ASSIGN value
|
||||||
|
|
||||||
13 expression : OPEN_PAR expression CLOSE_PAR
|
14 expression : OPEN_PAR expression CLOSE_PAR
|
||||||
14 | equal_expression
|
15 | equal_expression
|
||||||
15 | notequal_expression
|
16 | notequal_expression
|
||||||
|
|
||||||
16 equal_expression : value EQUAL value
|
17 equal_expression : value EQUAL value
|
||||||
|
|
||||||
17 notequal_expression : value NOTEQUAL value
|
18 notequal_expression : value NOTEQUAL value
|
||||||
|
|
||||||
18 variable : VARIABLE
|
19 variable : VARIABLE
|
||||||
|
|
||||||
19 value : VALUE
|
20 value : VALUE
|
||||||
20 | VARIABLE
|
21 | VARIABLE
|
||||||
21 | value PLUS value
|
22 | value PLUS value
|
||||||
|
23 | function
|
||||||
|
|
||||||
|
24 $$1 :
|
||||||
|
|
||||||
|
25 function : FUNCTION OPEN_PAR $$1 CLOSE_PAR
|
||||||
|
|
||||||
|
|
||||||
state 0
|
state 0
|
||||||
|
@ -58,36 +64,38 @@ state 2
|
||||||
END_STMT shift 7
|
END_STMT shift 7
|
||||||
BEGIN_CS shift 8
|
BEGIN_CS shift 8
|
||||||
VARIABLE shift 9
|
VARIABLE shift 9
|
||||||
|
FUNCTION shift 10
|
||||||
. reduce 1
|
. reduce 1
|
||||||
|
|
||||||
statement goto 10
|
statement goto 11
|
||||||
assign_expression goto 11
|
assign_expression goto 12
|
||||||
variable goto 12
|
variable goto 13
|
||||||
|
function goto 14
|
||||||
|
|
||||||
|
|
||||||
state 3
|
state 3
|
||||||
statement : STOP . END_STMT
|
statement : STOP . END_STMT
|
||||||
|
|
||||||
END_STMT shift 13
|
END_STMT shift 15
|
||||||
|
|
||||||
|
|
||||||
state 4
|
state 4
|
||||||
statement : IF . OPEN_PAR expression CLOSE_PAR statement
|
statement : IF . OPEN_PAR expression CLOSE_PAR statement
|
||||||
statement : IF . OPEN_PAR expression CLOSE_PAR statement ELSE statement
|
statement : IF . OPEN_PAR expression CLOSE_PAR statement ELSE statement
|
||||||
|
|
||||||
OPEN_PAR shift 14
|
OPEN_PAR shift 16
|
||||||
|
|
||||||
|
|
||||||
state 5
|
state 5
|
||||||
statement : PAUSE . END_STMT
|
statement : PAUSE . END_STMT
|
||||||
|
|
||||||
END_STMT shift 15
|
END_STMT shift 17
|
||||||
|
|
||||||
|
|
||||||
state 6
|
state 6
|
||||||
statement : PRINT . OPEN_PAR value CLOSE_PAR END_STMT
|
statement : PRINT . OPEN_PAR value CLOSE_PAR END_STMT
|
||||||
|
|
||||||
OPEN_PAR shift 16
|
OPEN_PAR shift 18
|
||||||
|
|
||||||
|
|
||||||
state 7
|
state 7
|
||||||
|
@ -102,69 +110,85 @@ state 8
|
||||||
|
|
||||||
. reduce 3
|
. reduce 3
|
||||||
|
|
||||||
statement_list goto 17
|
statement_list goto 19
|
||||||
|
|
||||||
|
|
||||||
state 9
|
state 9
|
||||||
variable : VARIABLE . (18)
|
variable : VARIABLE . (19)
|
||||||
|
|
||||||
. reduce 18
|
. reduce 19
|
||||||
|
|
||||||
|
|
||||||
state 10
|
state 10
|
||||||
|
function : FUNCTION . OPEN_PAR $$1 CLOSE_PAR
|
||||||
|
|
||||||
|
OPEN_PAR shift 20
|
||||||
|
|
||||||
|
|
||||||
|
state 11
|
||||||
statement_list : statement_list statement . (2)
|
statement_list : statement_list statement . (2)
|
||||||
|
|
||||||
. reduce 2
|
. reduce 2
|
||||||
|
|
||||||
|
|
||||||
state 11
|
state 12
|
||||||
statement : assign_expression . END_STMT
|
statement : assign_expression . END_STMT
|
||||||
|
|
||||||
END_STMT shift 18
|
END_STMT shift 21
|
||||||
|
|
||||||
|
|
||||||
state 12
|
|
||||||
assign_expression : variable . ASSIGN value
|
|
||||||
|
|
||||||
ASSIGN shift 19
|
|
||||||
|
|
||||||
|
|
||||||
state 13
|
state 13
|
||||||
|
assign_expression : variable . ASSIGN value
|
||||||
|
|
||||||
|
ASSIGN shift 22
|
||||||
|
|
||||||
|
|
||||||
|
state 14
|
||||||
|
statement : function . END_STMT
|
||||||
|
|
||||||
|
END_STMT shift 23
|
||||||
|
|
||||||
|
|
||||||
|
state 15
|
||||||
statement : STOP END_STMT . (5)
|
statement : STOP END_STMT . (5)
|
||||||
|
|
||||||
. reduce 5
|
. reduce 5
|
||||||
|
|
||||||
|
|
||||||
state 14
|
state 16
|
||||||
statement : IF OPEN_PAR . expression CLOSE_PAR statement
|
statement : IF OPEN_PAR . expression CLOSE_PAR statement
|
||||||
statement : IF OPEN_PAR . expression CLOSE_PAR statement ELSE statement
|
statement : IF OPEN_PAR . expression CLOSE_PAR statement ELSE statement
|
||||||
|
|
||||||
OPEN_PAR shift 20
|
OPEN_PAR shift 24
|
||||||
VARIABLE shift 21
|
VARIABLE shift 25
|
||||||
VALUE shift 22
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
expression goto 23
|
expression goto 27
|
||||||
equal_expression goto 24
|
equal_expression goto 28
|
||||||
notequal_expression goto 25
|
notequal_expression goto 29
|
||||||
value goto 26
|
value goto 30
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 15
|
state 17
|
||||||
statement : PAUSE END_STMT . (6)
|
statement : PAUSE END_STMT . (6)
|
||||||
|
|
||||||
. reduce 6
|
. reduce 6
|
||||||
|
|
||||||
|
|
||||||
state 16
|
state 18
|
||||||
statement : PRINT OPEN_PAR . value CLOSE_PAR END_STMT
|
statement : PRINT OPEN_PAR . value CLOSE_PAR END_STMT
|
||||||
|
|
||||||
VARIABLE shift 21
|
VARIABLE shift 25
|
||||||
VALUE shift 22
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
value goto 27
|
value goto 32
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 17
|
state 19
|
||||||
statement_list : statement_list . statement
|
statement_list : statement_list . statement
|
||||||
statement : BEGIN_CS statement_list . END_CS
|
statement : BEGIN_CS statement_list . END_CS
|
||||||
|
|
||||||
|
@ -174,112 +198,145 @@ state 17
|
||||||
PRINT shift 6
|
PRINT shift 6
|
||||||
END_STMT shift 7
|
END_STMT shift 7
|
||||||
BEGIN_CS shift 8
|
BEGIN_CS shift 8
|
||||||
END_CS shift 28
|
END_CS shift 33
|
||||||
VARIABLE shift 9
|
VARIABLE shift 9
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
statement goto 10
|
statement goto 11
|
||||||
assign_expression goto 11
|
assign_expression goto 12
|
||||||
variable goto 12
|
variable goto 13
|
||||||
|
function goto 14
|
||||||
|
|
||||||
|
|
||||||
state 18
|
state 20
|
||||||
|
function : FUNCTION OPEN_PAR . $$1 CLOSE_PAR
|
||||||
|
$$1 : . (24)
|
||||||
|
|
||||||
|
. reduce 24
|
||||||
|
|
||||||
|
$$1 goto 34
|
||||||
|
|
||||||
|
|
||||||
|
state 21
|
||||||
statement : assign_expression END_STMT . (8)
|
statement : assign_expression END_STMT . (8)
|
||||||
|
|
||||||
. reduce 8
|
. reduce 8
|
||||||
|
|
||||||
|
|
||||||
state 19
|
state 22
|
||||||
assign_expression : variable ASSIGN . value
|
assign_expression : variable ASSIGN . value
|
||||||
|
|
||||||
VARIABLE shift 21
|
VARIABLE shift 25
|
||||||
VALUE shift 22
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
value goto 29
|
value goto 35
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 20
|
state 23
|
||||||
|
statement : function END_STMT . (12)
|
||||||
|
|
||||||
|
. reduce 12
|
||||||
|
|
||||||
|
|
||||||
|
state 24
|
||||||
expression : OPEN_PAR . expression CLOSE_PAR
|
expression : OPEN_PAR . expression CLOSE_PAR
|
||||||
|
|
||||||
OPEN_PAR shift 20
|
OPEN_PAR shift 24
|
||||||
VARIABLE shift 21
|
VARIABLE shift 25
|
||||||
VALUE shift 22
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
expression goto 30
|
expression goto 36
|
||||||
equal_expression goto 24
|
equal_expression goto 28
|
||||||
notequal_expression goto 25
|
notequal_expression goto 29
|
||||||
value goto 26
|
value goto 30
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 21
|
state 25
|
||||||
value : VARIABLE . (20)
|
value : VARIABLE . (21)
|
||||||
|
|
||||||
|
. reduce 21
|
||||||
|
|
||||||
|
|
||||||
|
state 26
|
||||||
|
value : VALUE . (20)
|
||||||
|
|
||||||
. reduce 20
|
. reduce 20
|
||||||
|
|
||||||
|
|
||||||
state 22
|
state 27
|
||||||
value : VALUE . (19)
|
|
||||||
|
|
||||||
. reduce 19
|
|
||||||
|
|
||||||
|
|
||||||
state 23
|
|
||||||
statement : IF OPEN_PAR expression . CLOSE_PAR statement
|
statement : IF OPEN_PAR expression . CLOSE_PAR statement
|
||||||
statement : IF OPEN_PAR expression . CLOSE_PAR statement ELSE statement
|
statement : IF OPEN_PAR expression . CLOSE_PAR statement ELSE statement
|
||||||
|
|
||||||
CLOSE_PAR shift 31
|
CLOSE_PAR shift 37
|
||||||
|
|
||||||
|
|
||||||
state 24
|
state 28
|
||||||
expression : equal_expression . (14)
|
expression : equal_expression . (15)
|
||||||
|
|
||||||
. reduce 14
|
|
||||||
|
|
||||||
|
|
||||||
state 25
|
|
||||||
expression : notequal_expression . (15)
|
|
||||||
|
|
||||||
. reduce 15
|
. reduce 15
|
||||||
|
|
||||||
|
|
||||||
state 26
|
state 29
|
||||||
|
expression : notequal_expression . (16)
|
||||||
|
|
||||||
|
. reduce 16
|
||||||
|
|
||||||
|
|
||||||
|
state 30
|
||||||
equal_expression : value . EQUAL value
|
equal_expression : value . EQUAL value
|
||||||
notequal_expression : value . NOTEQUAL value
|
notequal_expression : value . NOTEQUAL value
|
||||||
value : value . PLUS value
|
value : value . PLUS value
|
||||||
|
|
||||||
EQUAL shift 32
|
EQUAL shift 38
|
||||||
NOTEQUAL shift 33
|
NOTEQUAL shift 39
|
||||||
PLUS shift 34
|
PLUS shift 40
|
||||||
|
|
||||||
|
|
||||||
state 27
|
state 31
|
||||||
|
value : function . (23)
|
||||||
|
|
||||||
|
. reduce 23
|
||||||
|
|
||||||
|
|
||||||
|
state 32
|
||||||
statement : PRINT OPEN_PAR value . CLOSE_PAR END_STMT
|
statement : PRINT OPEN_PAR value . CLOSE_PAR END_STMT
|
||||||
value : value . PLUS value
|
value : value . PLUS value
|
||||||
|
|
||||||
PLUS shift 34
|
PLUS shift 40
|
||||||
CLOSE_PAR shift 35
|
CLOSE_PAR shift 41
|
||||||
|
|
||||||
|
|
||||||
state 28
|
state 33
|
||||||
statement : BEGIN_CS statement_list END_CS . (11)
|
statement : BEGIN_CS statement_list END_CS . (11)
|
||||||
|
|
||||||
. reduce 11
|
. reduce 11
|
||||||
|
|
||||||
|
|
||||||
state 29
|
state 34
|
||||||
assign_expression : variable ASSIGN value . (12)
|
function : FUNCTION OPEN_PAR $$1 . CLOSE_PAR
|
||||||
|
|
||||||
|
CLOSE_PAR shift 42
|
||||||
|
|
||||||
|
|
||||||
|
state 35
|
||||||
|
assign_expression : variable ASSIGN value . (13)
|
||||||
value : value . PLUS value
|
value : value . PLUS value
|
||||||
|
|
||||||
PLUS shift 34
|
PLUS shift 40
|
||||||
. reduce 12
|
. reduce 13
|
||||||
|
|
||||||
|
|
||||||
state 30
|
state 36
|
||||||
expression : OPEN_PAR expression . CLOSE_PAR
|
expression : OPEN_PAR expression . CLOSE_PAR
|
||||||
|
|
||||||
CLOSE_PAR shift 36
|
CLOSE_PAR shift 43
|
||||||
|
|
||||||
|
|
||||||
state 31
|
state 37
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR . statement
|
statement : IF OPEN_PAR expression CLOSE_PAR . statement
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR . statement ELSE statement
|
statement : IF OPEN_PAR expression CLOSE_PAR . statement ELSE statement
|
||||||
|
|
||||||
|
@ -290,92 +347,106 @@ state 31
|
||||||
END_STMT shift 7
|
END_STMT shift 7
|
||||||
BEGIN_CS shift 8
|
BEGIN_CS shift 8
|
||||||
VARIABLE shift 9
|
VARIABLE shift 9
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
statement goto 37
|
statement goto 44
|
||||||
assign_expression goto 11
|
assign_expression goto 12
|
||||||
variable goto 12
|
variable goto 13
|
||||||
|
function goto 14
|
||||||
|
|
||||||
state 32
|
|
||||||
equal_expression : value EQUAL . value
|
|
||||||
|
|
||||||
VARIABLE shift 21
|
|
||||||
VALUE shift 22
|
|
||||||
|
|
||||||
value goto 38
|
|
||||||
|
|
||||||
|
|
||||||
state 33
|
|
||||||
notequal_expression : value NOTEQUAL . value
|
|
||||||
|
|
||||||
VARIABLE shift 21
|
|
||||||
VALUE shift 22
|
|
||||||
|
|
||||||
value goto 39
|
|
||||||
|
|
||||||
|
|
||||||
state 34
|
|
||||||
value : value PLUS . value
|
|
||||||
|
|
||||||
VARIABLE shift 21
|
|
||||||
VALUE shift 22
|
|
||||||
|
|
||||||
value goto 40
|
|
||||||
|
|
||||||
|
|
||||||
state 35
|
|
||||||
statement : PRINT OPEN_PAR value CLOSE_PAR . END_STMT
|
|
||||||
|
|
||||||
END_STMT shift 41
|
|
||||||
|
|
||||||
|
|
||||||
state 36
|
|
||||||
expression : OPEN_PAR expression CLOSE_PAR . (13)
|
|
||||||
|
|
||||||
. reduce 13
|
|
||||||
|
|
||||||
|
|
||||||
37: shift-reduce conflict (shift 42, reduce 9) on ELSE
|
|
||||||
state 37
|
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR statement . (9)
|
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR statement . ELSE statement
|
|
||||||
|
|
||||||
ELSE shift 42
|
|
||||||
. reduce 9
|
|
||||||
|
|
||||||
|
|
||||||
state 38
|
state 38
|
||||||
equal_expression : value EQUAL value . (16)
|
equal_expression : value EQUAL . value
|
||||||
value : value . PLUS value
|
|
||||||
|
|
||||||
PLUS shift 34
|
VARIABLE shift 25
|
||||||
. reduce 16
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
|
value goto 45
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 39
|
state 39
|
||||||
notequal_expression : value NOTEQUAL value . (17)
|
notequal_expression : value NOTEQUAL . value
|
||||||
value : value . PLUS value
|
|
||||||
|
|
||||||
PLUS shift 34
|
VARIABLE shift 25
|
||||||
. reduce 17
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
|
value goto 46
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
40: shift-reduce conflict (shift 34, reduce 21) on PLUS
|
|
||||||
state 40
|
state 40
|
||||||
value : value PLUS value . (21)
|
value : value PLUS . value
|
||||||
value : value . PLUS value
|
|
||||||
|
|
||||||
PLUS shift 34
|
VARIABLE shift 25
|
||||||
. reduce 21
|
VALUE shift 26
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
|
value goto 47
|
||||||
|
function goto 31
|
||||||
|
|
||||||
|
|
||||||
state 41
|
state 41
|
||||||
|
statement : PRINT OPEN_PAR value CLOSE_PAR . END_STMT
|
||||||
|
|
||||||
|
END_STMT shift 48
|
||||||
|
|
||||||
|
|
||||||
|
state 42
|
||||||
|
function : FUNCTION OPEN_PAR $$1 CLOSE_PAR . (25)
|
||||||
|
|
||||||
|
. reduce 25
|
||||||
|
|
||||||
|
|
||||||
|
state 43
|
||||||
|
expression : OPEN_PAR expression CLOSE_PAR . (14)
|
||||||
|
|
||||||
|
. reduce 14
|
||||||
|
|
||||||
|
|
||||||
|
44: shift-reduce conflict (shift 49, reduce 9) on ELSE
|
||||||
|
state 44
|
||||||
|
statement : IF OPEN_PAR expression CLOSE_PAR statement . (9)
|
||||||
|
statement : IF OPEN_PAR expression CLOSE_PAR statement . ELSE statement
|
||||||
|
|
||||||
|
ELSE shift 49
|
||||||
|
. reduce 9
|
||||||
|
|
||||||
|
|
||||||
|
state 45
|
||||||
|
equal_expression : value EQUAL value . (17)
|
||||||
|
value : value . PLUS value
|
||||||
|
|
||||||
|
PLUS shift 40
|
||||||
|
. reduce 17
|
||||||
|
|
||||||
|
|
||||||
|
state 46
|
||||||
|
notequal_expression : value NOTEQUAL value . (18)
|
||||||
|
value : value . PLUS value
|
||||||
|
|
||||||
|
PLUS shift 40
|
||||||
|
. reduce 18
|
||||||
|
|
||||||
|
|
||||||
|
47: shift-reduce conflict (shift 40, reduce 22) on PLUS
|
||||||
|
state 47
|
||||||
|
value : value PLUS value . (22)
|
||||||
|
value : value . PLUS value
|
||||||
|
|
||||||
|
PLUS shift 40
|
||||||
|
. reduce 22
|
||||||
|
|
||||||
|
|
||||||
|
state 48
|
||||||
statement : PRINT OPEN_PAR value CLOSE_PAR END_STMT . (7)
|
statement : PRINT OPEN_PAR value CLOSE_PAR END_STMT . (7)
|
||||||
|
|
||||||
. reduce 7
|
. reduce 7
|
||||||
|
|
||||||
|
|
||||||
state 42
|
state 49
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR statement ELSE . statement
|
statement : IF OPEN_PAR expression CLOSE_PAR statement ELSE . statement
|
||||||
|
|
||||||
STOP shift 3
|
STOP shift 3
|
||||||
|
@ -385,21 +456,23 @@ state 42
|
||||||
END_STMT shift 7
|
END_STMT shift 7
|
||||||
BEGIN_CS shift 8
|
BEGIN_CS shift 8
|
||||||
VARIABLE shift 9
|
VARIABLE shift 9
|
||||||
|
FUNCTION shift 10
|
||||||
|
|
||||||
statement goto 43
|
statement goto 50
|
||||||
assign_expression goto 11
|
assign_expression goto 12
|
||||||
variable goto 12
|
variable goto 13
|
||||||
|
function goto 14
|
||||||
|
|
||||||
|
|
||||||
state 43
|
state 50
|
||||||
statement : IF OPEN_PAR expression CLOSE_PAR statement ELSE statement . (10)
|
statement : IF OPEN_PAR expression CLOSE_PAR statement ELSE statement . (10)
|
||||||
|
|
||||||
. reduce 10
|
. reduce 10
|
||||||
|
|
||||||
|
|
||||||
State 37 contains 1 shift-reduce conflict
|
State 44 contains 1 shift-reduce conflict
|
||||||
State 40 contains 1 shift-reduce conflict
|
State 47 contains 1 shift-reduce conflict
|
||||||
|
|
||||||
|
|
||||||
18 tokens, 10 nonterminals
|
19 tokens, 12 nonterminals
|
||||||
22 grammar rules, 44 states
|
26 grammar rules, 51 states
|
||||||
|
|
|
@ -6,6 +6,7 @@ ParserWizard generated YACC file.
|
||||||
Date: 07 December 2000
|
Date: 07 December 2000
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "function.h"
|
||||||
#include "lexer.h"
|
#include "lexer.h"
|
||||||
#include "codegen.h"
|
#include "codegen.h"
|
||||||
|
|
||||||
|
@ -32,6 +33,10 @@ private:
|
||||||
class mylexer *m_currentLexer;
|
class mylexer *m_currentLexer;
|
||||||
class CTreeNode *m_baseNode;
|
class CTreeNode *m_baseNode;
|
||||||
|
|
||||||
|
// Ugh! (pkg)
|
||||||
|
class CTreeNode *m_functionArgs;
|
||||||
|
int m_functionNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -47,9 +52,10 @@ private:
|
||||||
//}
|
//}
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
int variableIdx;
|
int variableIdx;
|
||||||
signed short value;
|
signed short value;
|
||||||
class CTreeNode *treenode;
|
int functionNumber;
|
||||||
|
class CTreeNode *treenode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,14 +77,18 @@ private:
|
||||||
%token CLOSE_PAR
|
%token CLOSE_PAR
|
||||||
%token BEGIN_CS
|
%token BEGIN_CS
|
||||||
%token END_CS
|
%token END_CS
|
||||||
%token <variableIdx> VARIABLE
|
%token COMMA
|
||||||
%token <value> VALUE
|
%token <variableIdx> VARIABLE
|
||||||
|
%token <value> VALUE
|
||||||
|
%token <functionNumber> FUNCTION
|
||||||
|
|
||||||
|
|
||||||
%type <treenode> program statement_list statement
|
%type <treenode> program statement_list statement
|
||||||
%type <treenode> assign_expression
|
%type <treenode> assign_expression
|
||||||
%type <treenode> expression equal_expression notequal_expression
|
%type <treenode> expression equal_expression notequal_expression
|
||||||
%type <treenode> variable
|
%type <treenode> variable
|
||||||
%type <treenode> value
|
%type <treenode> value
|
||||||
|
%type <treenode> function
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
@ -106,6 +116,7 @@ statement
|
||||||
|IF OPEN_PAR expression CLOSE_PAR statement {$$=new CTreeNode(IF_STMT,$3,$5);}
|
|IF OPEN_PAR expression CLOSE_PAR statement {$$=new CTreeNode(IF_STMT,$3,$5);}
|
||||||
|IF OPEN_PAR expression CLOSE_PAR statement ELSE statement {$$=new CTreeNode(IFELSE_STMT,$3,$5,$7);}
|
|IF OPEN_PAR expression CLOSE_PAR statement ELSE statement {$$=new CTreeNode(IFELSE_STMT,$3,$5,$7);}
|
||||||
|BEGIN_CS statement_list END_CS {$$=new CTreeNode(STMT_LIST,$2);}
|
|BEGIN_CS statement_list END_CS {$$=new CTreeNode(STMT_LIST,$2);}
|
||||||
|
|function END_STMT {$$=new CTreeNode(STMT_LIST,$1,new CTreeNode(POP_STMT));}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,9 +148,16 @@ value
|
||||||
:VALUE {$$=new CTreeNode(VALUE_EXPR,$1);}
|
:VALUE {$$=new CTreeNode(VALUE_EXPR,$1);}
|
||||||
|VARIABLE {$$=new CTreeNode(VARIABLE_EXPR,$1);} // variable value
|
|VARIABLE {$$=new CTreeNode(VARIABLE_EXPR,$1);} // variable value
|
||||||
|value PLUS value {$$=new CTreeNode(PLUS_EXPR,$1,$3);}
|
|value PLUS value {$$=new CTreeNode(PLUS_EXPR,$1,$3);}
|
||||||
|
|function {$$=$1;}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
function
|
||||||
|
:FUNCTION OPEN_PAR {if($1!=-1){m_functionNumber=$1;m_functionArgs=getFunctionArgs($1);}}
|
||||||
|
CLOSE_PAR {$$=new CTreeNode(STMT_LIST,m_functionArgs,new CTreeNode(FUNCTION_EXPR,m_functionNumber));}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,14 @@ SOURCE=.\codegen.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\function.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\function.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\main.cpp
|
SOURCE=.\main.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -1,37 +1,10 @@
|
||||||
// Crappy test program
|
|
||||||
// Prints a number based upon another one ( eh? )
|
|
||||||
|
|
||||||
//#print something..
|
|
||||||
#include data/scripts/defs.scr
|
#include data/scripts/defs.scr
|
||||||
|
|
||||||
|
|
||||||
|
//$tmp1=11;
|
||||||
// No switch statements here..
|
//$tmp2=22;
|
||||||
if($tmp1==ONE)
|
//$tmp3=_setCharacterExpression(1,2);
|
||||||
{
|
//$tmp3=_setCharacterExpression($tmp1,$tmp2);
|
||||||
$tmp2=11;
|
print($tmp3);
|
||||||
}
|
$tmp3=_setText(123);
|
||||||
else if($tmp1==TWO)
|
stop;
|
||||||
{
|
|
||||||
$tmp2=22;
|
|
||||||
}
|
|
||||||
else if($tmp1==THREE)
|
|
||||||
{
|
|
||||||
$tmp2=30+3;
|
|
||||||
}
|
|
||||||
else if($tmp1==FOUR)
|
|
||||||
{
|
|
||||||
// Stop here!
|
|
||||||
stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Have a rest..
|
|
||||||
pause;
|
|
||||||
|
|
||||||
// Show result and stop
|
|
||||||
if($tmp2!=0)
|
|
||||||
print($tmp2);
|
|
||||||
else
|
|
||||||
print(5432);
|
|
||||||
stop;
|
|
||||||
|
|
|
@ -97,7 +97,8 @@ pad_src := pads
|
||||||
|
|
||||||
paul_src := paul
|
paul_src := paul
|
||||||
|
|
||||||
script_src := script
|
script_src := script \
|
||||||
|
function
|
||||||
|
|
||||||
sound_src := sound \
|
sound_src := sound \
|
||||||
spu \
|
spu \
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
signed short (*m_func)(signed short *_args);
|
signed short (*m_func)(unsigned short *_args);
|
||||||
int m_argCount;
|
int m_argCount;
|
||||||
} FunctionDef;
|
} FunctionDef;
|
||||||
|
|
||||||
|
@ -48,14 +48,20 @@ typedef struct
|
||||||
Function Prototypes
|
Function Prototypes
|
||||||
------------------- */
|
------------------- */
|
||||||
|
|
||||||
|
static signed short func_setCharacterExpression(unsigned short *_args);
|
||||||
|
static signed short func_setText(unsigned short *_args);
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Vars
|
Vars
|
||||||
---- */
|
---- */
|
||||||
|
|
||||||
static FunctionDef s_functionDefs[]=
|
static FunctionDef s_functionDefs[]=
|
||||||
{
|
{
|
||||||
|
{ func_setCharacterExpression, 2 }, // character, expression
|
||||||
|
{ func_setText, 1 }, // textId
|
||||||
};
|
};
|
||||||
static int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef);
|
static const int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef);
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
@ -64,6 +70,42 @@ static int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef);
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
signed short callFunction(int _functionNumber,int _argCount,unsigned short *_args)
|
||||||
|
{
|
||||||
|
FunctionDef *fd;
|
||||||
|
|
||||||
|
ASSERT(_functionNumber<s_numFunctionDefs);
|
||||||
|
fd=&s_functionDefs[_functionNumber];
|
||||||
|
ASSERT(_argCount==fd->m_argCount);
|
||||||
|
return fd->m_func(_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
static signed short func_setCharacterExpression(unsigned short *_args)
|
||||||
|
{
|
||||||
|
return _args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
static signed short func_setText(unsigned short *_args)
|
||||||
|
{
|
||||||
|
return _args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
end */
|
end */
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
Functions
|
Functions
|
||||||
--------- */
|
--------- */
|
||||||
|
|
||||||
|
signed short callFunction(int _functionNumber,int _argCount,unsigned short *_args);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------- */
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
||||||
#endif /* __SCRIPT_FUNCTION_H__ */
|
#endif /* __SCRIPT_FUNCTION_H__ */
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
#include "script\script.h"
|
#include "script\script.h"
|
||||||
|
|
||||||
|
#ifndef __SCRIPT_FUNCTION_H__
|
||||||
|
#include "script\function.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __SYSTEM_DBG_H__
|
#ifndef __SYSTEM_DBG_H__
|
||||||
#include "system\dbg.h"
|
#include "system\dbg.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,6 +63,10 @@ signed short CScript::s_globalVars[NUM_GLOBAL_VARS]=
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Buffer for passing arguments to functions
|
||||||
|
unsigned short CScript::s_argBuffer[MAX_FUNCTION_ARGS];
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -149,6 +157,7 @@ void CScript::executeNextInstruction()
|
||||||
{
|
{
|
||||||
unsigned short instruction;
|
unsigned short instruction;
|
||||||
signed short val1,val2,val3;
|
signed short val1,val2,val3;
|
||||||
|
int i;
|
||||||
|
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
|
@ -199,7 +208,14 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
push(val2);
|
push(val2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_JMP: // jump
|
case OP_POP: // value
|
||||||
|
val1=pop();
|
||||||
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
PAUL_DBGMSG("POP %d",val1);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OP_JMP: // jump
|
||||||
val1=pop();
|
val1=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
PAUL_DBGMSG("JMP %d",val1);
|
PAUL_DBGMSG("JMP %d",val1);
|
||||||
|
@ -207,7 +223,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
jump(val1);
|
jump(val1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_JMPF: // jump, value
|
case OP_JMPF: // jump, value
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -216,7 +232,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
if(val2==0)jump(val1);
|
if(val2==0)jump(val1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_JMPT: // jump, value
|
case OP_JMPT: // jump, value
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -225,7 +241,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
if(val2!=0)jump(val1);
|
if(val2!=0)jump(val1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_IS_EQUAL_VALUE: // value, value pushes result ( 0 or 1 ) to stack
|
case OP_IS_EQUAL_VALUE: // value, value pushes result ( 0 or 1 ) to stack
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -234,7 +250,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
push(val1==val2);
|
push(val1==val2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_IS_NOTEQUAL_VALUE: // value, value pushes result ( 0 or 1 ) to stack
|
case OP_IS_NOTEQUAL_VALUE: // value, value pushes result ( 0 or 1 ) to stack
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -243,7 +259,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
push(val1!=val2);
|
push(val1!=val2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_ASSIGN: // varidx, value
|
case OP_ASSIGN: // varidx, value
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -252,7 +268,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
setVar(val1,val2);
|
setVar(val1,val2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_ADD: // value, value pushes result to stack
|
case OP_ADD: // value, value pushes result to stack
|
||||||
val1=pop();
|
val1=pop();
|
||||||
val2=pop();
|
val2=pop();
|
||||||
#ifdef FULL_CODE_OUTPUT
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
@ -261,11 +277,29 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
||||||
push(val1+val2);
|
push(val1+val2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_PRINT: // value
|
case OP_PRINT: // value
|
||||||
val1=pop();
|
val1=pop();
|
||||||
PAUL_DBGMSG("PRINT %d",val1);
|
PAUL_DBGMSG("PRINT %d",val1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OP_CALL_FUNCTION: // functionnumber, argcount args pushes return value to stack
|
||||||
|
val1=readNextInstruction();
|
||||||
|
val2=readNextInstruction();
|
||||||
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
PAUL_DBGMSG("CALL_FUNCTION %d ( %d args )",val1,val2);
|
||||||
|
#endif
|
||||||
|
ASSERT(val2<MAX_FUNCTION_ARGS); // Too many args.. just increase the #define to fix this
|
||||||
|
for(i=0;i<val2;i++)
|
||||||
|
{
|
||||||
|
s_argBuffer[i]=pop();
|
||||||
|
}
|
||||||
|
val3=callFunction(val1,val2,s_argBuffer);
|
||||||
|
#ifdef FULL_CODE_OUTPUT
|
||||||
|
PAUL_DBGMSG("( return value is %d )",val3);
|
||||||
|
#endif
|
||||||
|
push(val3);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PAUL_DBGMSG("ILLEGAL OPCODE@%d ( %d )",m_pc,instruction);
|
PAUL_DBGMSG("ILLEGAL OPCODE@%d ( %d )",m_pc,instruction);
|
||||||
m_state=CRASHED_ILLEGAL_OPCODE;
|
m_state=CRASHED_ILLEGAL_OPCODE;
|
||||||
|
|
|
@ -75,25 +75,28 @@ private:
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
STACK_SIZE=20,
|
STACK_SIZE=10,
|
||||||
|
MAX_FUNCTION_ARGS=5,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// args stack data result
|
// args stack data result
|
||||||
OP_NOP=0x1100, //
|
OP_NOP=0x1100, //
|
||||||
OP_STOP, //
|
OP_STOP, //
|
||||||
OP_PAUSE,
|
OP_PAUSE,
|
||||||
OP_PUSHVALUE, // value
|
OP_PUSHVALUE, // value
|
||||||
OP_PUSHVARVALUE, // varidx
|
OP_PUSHVARVALUE, // varidx
|
||||||
OP_JMP, // jump
|
OP_POP, // value
|
||||||
OP_JMPF, // jump, value
|
OP_JMP, // jump
|
||||||
OP_JMPT, // jump, value
|
OP_JMPF, // jump, value
|
||||||
OP_IS_EQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
OP_JMPT, // jump, value
|
||||||
OP_IS_NOTEQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
OP_IS_EQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||||
OP_ASSIGN, // varidx, value
|
OP_IS_NOTEQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||||
OP_ADD, // value, value pushes result to stack
|
OP_ASSIGN, // varidx, value
|
||||||
OP_PRINT, // value
|
OP_ADD, // value, value pushes result to stack
|
||||||
|
OP_PRINT, // value
|
||||||
|
OP_CALL_FUNCTION, // functionnumber, argcount args pushes return value to stack
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +118,8 @@ private:
|
||||||
static signed short s_globalVars[NUM_GLOBAL_VARS];
|
static signed short s_globalVars[NUM_GLOBAL_VARS];
|
||||||
signed short m_localVars[NUM_LOCAL_VARS];
|
signed short m_localVars[NUM_LOCAL_VARS];
|
||||||
|
|
||||||
|
static unsigned short s_argBuffer[MAX_FUNCTION_ARGS];
|
||||||
|
|
||||||
ScriptState m_state;
|
ScriptState m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -385,6 +385,14 @@ SOURCE=..\..\..\source\PsxBoot\PSXBOOT.H
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\script\function.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\script\function.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\script\script.cpp
|
SOURCE=..\..\..\source\script\script.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Reference in a new issue