From 7d9c4da112a2c97f32c734393256498c023a0ebb Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 17 Jan 2012 13:39:35 +1000 Subject: Change that butt ugly name. --- LuaSL/src/LuaSL_LSL_tree.h | 20 ++++---- LuaSL/src/LuaSL_compile.c | 111 ++++++++++++++++++++--------------------- LuaSL/src/LuaSL_lemon_yaccer.y | 66 ++++++++++++------------ LuaSL/src/LuaSL_lexer.l | 30 +++++------ 4 files changed, 113 insertions(+), 114 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 4b6e3c4..b73d3ac 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -1,6 +1,6 @@ -#ifndef __LSL_TREE_H__ -#define __LSL_TREE_H__ +#ifndef __LUASL_TREE_H__ +#define __LUASL_TREE_H__ //#define LUASL_DEBUG @@ -289,7 +289,7 @@ typedef struct LSL_Leaf *lval; int column, line; LSL_Block *currentBlock; -} LuaSL_yyparseParam; +} LuaSL_compiler; #ifndef excludeLexer @@ -299,23 +299,23 @@ typedef struct void burnLeaf(LSL_Leaf *leaf); LSL_Leaf *addFunction(LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *open, LSL_Leaf *params, LSL_Leaf *close, LSL_Leaf *block); -LSL_Leaf *addOperation(LuaSL_yyparseParam *param, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); +LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); LSL_Leaf *addParameter(LSL_Leaf *type, LSL_Leaf *newParam); LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf *rval); -LSL_Leaf *addState(LuaSL_yyparseParam *param, LSL_Leaf *identifier, LSL_Leaf *block); +LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *block); LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr); LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf *expr); -LSL_Leaf *addVariable(LuaSL_yyparseParam *param, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr); +LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr); -void beginBlock(LuaSL_yyparseParam *param, LSL_Leaf *block); +void beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block); LSL_Leaf *collectParameters(LSL_Leaf *list, LSL_Leaf *comma, LSL_Leaf *newParam); -void endBlock(LuaSL_yyparseParam *param, LSL_Leaf *block); +void endBlock(LuaSL_compiler *compiler, LSL_Leaf *block); void *ParseAlloc(void *(*mallocProc)(size_t)); void ParseTrace(FILE *TraceFILE, char *zTracePrompt); -void Parse(void *yyp, int yymajor, LSL_Leaf *yyminor, LuaSL_yyparseParam *param); +void Parse(void *yyp, int yymajor, LSL_Leaf *yyminor, LuaSL_compiler *compiler); void ParseFree(void *p, void (*freeProc)(void*)); -#endif // __LSL_TREE_H__ +#endif // __LUASL_LSL_TREE_H__ diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 030f140..583f940 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -209,9 +209,9 @@ void burnLeaf(LSL_Leaf *leaf) } } -LSL_Leaf *addOperation(LuaSL_yyparseParam *param, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) +LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right) { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; if (lval) { @@ -372,7 +372,7 @@ LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf return lval; } -LSL_Leaf *addState(LuaSL_yyparseParam *param, LSL_Leaf *identifier, LSL_Leaf *block) +LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *block) { LSL_State *result = calloc(1, sizeof(LSL_State)); @@ -381,9 +381,9 @@ LSL_Leaf *addState(LuaSL_yyparseParam *param, LSL_Leaf *identifier, LSL_Leaf *bl result->name = identifier->value.stringValue; result->block = block; identifier->value.stateValue = result; - param->script.scount++; - param->script.states = realloc(param->script.states, param->script.scount * sizeof(LSL_State *)); - param->script.states[param->script.scount - 1] = result; + compiler->script.scount++; + compiler->script.states = realloc(compiler->script.states, compiler->script.scount * sizeof(LSL_State *)); + compiler->script.states[compiler->script.scount - 1] = result; } return identifier; @@ -429,7 +429,7 @@ LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf * return lval; } -LSL_Leaf *addVariable(LuaSL_yyparseParam *param, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr) +LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identifier, LSL_Leaf *assignment, LSL_Leaf *expr) { LSL_Identifier *result = calloc(1, sizeof(LSL_Identifier)); @@ -446,38 +446,38 @@ LSL_Leaf *addVariable(LuaSL_yyparseParam *param, LSL_Leaf *type, LSL_Leaf *ident identifier->basicType = type->basicType; result->value.basicType = type->basicType; } - if (param->currentBlock) + if (compiler->currentBlock) { - param->currentBlock->vcount++; - param->currentBlock->variables = realloc(param->currentBlock->variables, param->currentBlock->vcount * sizeof(LSL_Identifier *)); - param->currentBlock->variables[param->currentBlock->vcount - 1] = result; + compiler->currentBlock->vcount++; + compiler->currentBlock->variables = realloc(compiler->currentBlock->variables, compiler->currentBlock->vcount * sizeof(LSL_Identifier *)); + compiler->currentBlock->variables[compiler->currentBlock->vcount - 1] = result; } else { - param->script.vcount++; - param->script.variables = realloc(param->script.variables, param->script.vcount * sizeof(LSL_Identifier *)); - param->script.variables[param->script.vcount - 1] = result; + compiler->script.vcount++; + compiler->script.variables = realloc(compiler->script.variables, compiler->script.vcount * sizeof(LSL_Identifier *)); + compiler->script.variables[compiler->script.vcount - 1] = result; } } return identifier; } -void beginBlock(LuaSL_yyparseParam *param, LSL_Leaf *block) +void beginBlock(LuaSL_compiler *compiler, LSL_Leaf *block) { LSL_Block *blok = malloc(sizeof(LSL_Block)); if (blok) { block->value.blockValue = blok; - blok->outerBlock = param->currentBlock; - param->currentBlock = blok; + blok->outerBlock = compiler->currentBlock; + compiler->currentBlock = blok; } } -void endBlock(LuaSL_yyparseParam *param, LSL_Leaf *block) +void endBlock(LuaSL_compiler *compiler, LSL_Leaf *block) { - param->currentBlock = param->currentBlock->outerBlock; + compiler->currentBlock = compiler->currentBlock->outerBlock; } static LSL_Leaf *evaluateLeaf(LSL_Leaf *leaf, LSL_Leaf *left, LSL_Leaf *right) @@ -869,33 +869,33 @@ static void outputVariableToken(FILE *file, outputMode mode, LSL_Leaf *content) fprintf(file, "%s", content->value.variableValue->name); } -static void doneParsing(LuaSL_yyparseParam *param) +static void doneParsing(LuaSL_compiler *compiler) { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; - if (param->ast) + if (compiler->ast) { FILE *out; char buffer[PATH_MAX]; char outName[PATH_MAX]; char luaName[PATH_MAX]; - outputLeaf(stdout, OM_LSL, param->ast); + outputLeaf(stdout, OM_LSL, compiler->ast); printf("\n"); - evaluateLeaf(param->ast, NULL, NULL); + evaluateLeaf(compiler->ast, NULL, NULL); printf("\n"); - strcpy(outName, param->fileName); + strcpy(outName, compiler->fileName); strcat(outName, "2"); - strcpy(luaName, param->fileName); + strcpy(luaName, compiler->fileName); strcat(luaName, ".lua"); out = fopen(outName, "w"); if (out) { // int count; - outputLeaf(out, OM_LSL, param->ast); + outputLeaf(out, OM_LSL, compiler->ast); fclose(out); - sprintf(buffer, "diff %s %s", param->fileName, outName); + sprintf(buffer, "diff %s %s", compiler->fileName, outName); // count = system(buffer); // PI("Return value of %s is %d", buffer, count); // if (0 != count) @@ -906,7 +906,7 @@ static void doneParsing(LuaSL_yyparseParam *param) out = fopen(luaName, "w"); if (out) { - outputLeaf(out, OM_LUA, param->ast); + outputLeaf(out, OM_LUA, compiler->ast); fclose(out); } else @@ -945,57 +945,56 @@ Eina_Bool compilerSetup(gameGlobals *game) Eina_Bool compileLSL(gameGlobals *game, char *script) { Eina_Bool result = EINA_FALSE; - LuaSL_yyparseParam param; + LuaSL_compiler compiler; void *pParser = ParseAlloc(malloc); int yv; // Parse the LSL script, validating it and reporting errors. // Just pass all constants and function names through to Lua, assume they are globals there. - memset(¶m, 0, sizeof(LuaSL_yyparseParam)); - param.game = game; + memset(&compiler, 0, sizeof(LuaSL_compiler)); + compiler.game = game; - - strncpy(param.fileName, script, PATH_MAX - 1); - param.fileName[PATH_MAX - 1] = '\0'; - param.file = fopen(param.fileName, "r"); - if (NULL == param.file) + strncpy(compiler.fileName, script, PATH_MAX - 1); + compiler.fileName[PATH_MAX - 1] = '\0'; + compiler.file = fopen(compiler.fileName, "r"); + if (NULL == compiler.file) { - PE("Error opening file %s.", param.fileName); + PE("Error opening file %s.", compiler.fileName); return FALSE; } - PI("Opened %s.", param.fileName); - param.ast = NULL; - param.lval = calloc(1, sizeof(LSL_Leaf)); + PI("Opened %s.", compiler.fileName); + compiler.ast = NULL; + compiler.lval = calloc(1, sizeof(LSL_Leaf)); // Text editors usually start counting at 1, even programmers editors. - param.column = 1; - param.line = 1; + compiler.column = 1; + compiler.line = 1; #ifdef LUASL_DEBUG // yydebug= 5; #endif - if (yylex_init_extra(¶m, &(param.scanner))) + if (yylex_init_extra(&compiler, &(compiler.scanner))) return result; #ifdef LUASL_DEBUG - yyset_debug(1, param.scanner); + yyset_debug(1, compiler.scanner); #endif - yyset_in(param.file, param.scanner); + yyset_in(compiler.file, compiler.scanner); #ifdef LUASL_DEBUG ParseTrace(stdout, "LSL_lemon "); #endif // on EOF yylex will return 0 - while((yv = yylex(param.lval, param.scanner)) != 0) + while((yv = yylex(compiler.lval, compiler.scanner)) != 0) { - Parse(pParser, yv, param.lval, ¶m); + Parse(pParser, yv, compiler.lval, &compiler); if (LSL_SCRIPT == yv) break; - param.lval = calloc(1, sizeof(LSL_Leaf)); + compiler.lval = calloc(1, sizeof(LSL_Leaf)); } - yylex_destroy(param.scanner); - Parse (pParser, 0, param.lval, ¶m); + yylex_destroy(compiler.scanner); + Parse (pParser, 0, compiler.lval, &compiler); ParseFree(pParser, free); - doneParsing(¶m); + doneParsing(&compiler); // Take the result of the parse, and convert it into Lua source. // Each LSL script becomes a Lua state. @@ -1004,12 +1003,12 @@ Eina_Bool compileLSL(gameGlobals *game, char *script) // Compile the Lua source by the Lua compiler. - if (NULL != param.file) + if (NULL != compiler.file) { - fclose(param.file); - param.file = NULL; + fclose(compiler.file); + compiler.file = NULL; } - burnLeaf(param.ast); + burnLeaf(compiler.ast); return result; } diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index 3df7def..e62776b 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y @@ -2,7 +2,7 @@ #include "LuaSL.h" } -%extra_argument {LuaSL_yyparseParam *param} +%extra_argument {LuaSL_compiler *compiler} %stack_size 1024 @@ -14,7 +14,7 @@ // The start symbol, just coz we need one. // Lemon does not like the start symbol to be on the RHS, so give it a dummy start symbol. -program ::= script LSL_SCRIPT(A). { if (NULL != A) A->left = param->ast; param->ast = A; } +program ::= script LSL_SCRIPT(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } // Various forms of "space". The lexer takes care of them for us. @@ -23,16 +23,16 @@ program ::= script LSL_SCRIPT(A). { if (NULL != A) A->left = param->ast; p // Basic script structure. %nonassoc LSL_SCRIPT. -script ::= script state(A). { if (NULL != A) A->left = param->ast; param->ast = A; } -script ::= script function(A). { if (NULL != A) A->left = param->ast; param->ast = A; } -script ::= script statement(A). { if (NULL != A) A->left = param->ast; param->ast = A; } +script ::= script state(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } +script ::= script function(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } +script ::= script statement(A). { if (NULL != A) A->left = compiler->ast; compiler->ast = A; } script ::= . // State definitions. %nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE LSL_STATE. stateBlock ::= LSL_BLOCK_OPEN functionList LSL_BLOCK_CLOSE. -state(S) ::= LSL_IDENTIFIER(I) stateBlock(B). { S = addState(param, I, B); } +state(S) ::= LSL_IDENTIFIER(I) stateBlock(B). { S = addState(compiler, I, B); } // Function definitions. @@ -89,40 +89,40 @@ exprList ::= expr. exprList ::= . %right LSL_BOOL_AND. -expr(A) ::= expr(B) LSL_BOOL_AND(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_BOOL_AND(C) expr(D). { A = addOperation(compiler, B, C, D); } %right LSL_BOOL_OR. -expr(A) ::= expr(B) LSL_BOOL_OR(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_BOOL_OR(C) expr(D). { A = addOperation(compiler, B, C, D); } %left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR. -expr(A) ::= expr(B) LSL_BIT_OR(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_BIT_XOR(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_BIT_AND(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_BIT_OR(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_BIT_XOR(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_BIT_AND(C) expr(D). { A = addOperation(compiler, B, C, D); } %right LSL_EQUAL LSL_NOT_EQUAL. -expr(A) ::= expr(B) LSL_NOT_EQUAL(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_EQUAL(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_NOT_EQUAL(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_EQUAL(C) expr(D). { A = addOperation(compiler, B, C, D); } %right LSL_LESS_THAN LSL_GREATER_THAN LSL_LESS_EQUAL LSL_GREATER_EQUAL. -expr(A) ::= expr(B) LSL_GREATER_EQUAL(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_LESS_EQUAL(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_GREATER_THAN(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_LESS_THAN(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_GREATER_EQUAL(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_LESS_EQUAL(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_GREATER_THAN(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_LESS_THAN(C) expr(D). { A = addOperation(compiler, B, C, D); } %left LSL_LEFT_SHIFT LSL_RIGHT_SHIFT. -expr(A) ::= expr(B) LSL_RIGHT_SHIFT(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_LEFT_SHIFT(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_RIGHT_SHIFT(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_LEFT_SHIFT(C) expr(D). { A = addOperation(compiler, B, C, D); } %left LSL_SUBTRACT LSL_ADD LSL_CONCATENATE. -expr(A) ::= expr(B) LSL_ADD(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_SUBTRACT(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_ADD(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_SUBTRACT(C) expr(D). { A = addOperation(compiler, B, C, D); } %left LSL_DIVIDE LSL_MODULO LSL_MULTIPLY LSL_DOT_PRODUCT LSL_CROSS_PRODUCT. -expr(A) ::= expr(B) LSL_MULTIPLY(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_MODULO(C) expr(D). { A = addOperation(param, B, C, D); } -expr(A) ::= expr(B) LSL_DIVIDE(C) expr(D). { A = addOperation(param, B, C, D); } +expr(A) ::= expr(B) LSL_MULTIPLY(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_MODULO(C) expr(D). { A = addOperation(compiler, B, C, D); } +expr(A) ::= expr(B) LSL_DIVIDE(C) expr(D). { A = addOperation(compiler, B, C, D); } %right LSL_BIT_NOT LSL_BOOL_NOT LSL_NEGATION. -expr(A) ::= LSL_BIT_NOT(B) expr(C). { A = addOperation(param, NULL, B, C); } -expr(A) ::= LSL_BOOL_NOT(B) expr(C). { A = addOperation(param, NULL, B, C); } -expr(A) ::= LSL_SUBTRACT(B) expr(C). [LSL_NEGATION] { A = addOperation(param, NULL, B, C); } +expr(A) ::= LSL_BIT_NOT(B) expr(C). { A = addOperation(compiler, NULL, B, C); } +expr(A) ::= LSL_BOOL_NOT(B) expr(C). { A = addOperation(compiler, NULL, B, C); } +expr(A) ::= LSL_SUBTRACT(B) expr(C). [LSL_NEGATION] { A = addOperation(compiler, NULL, B, C); } // Types, typecasts, and expression reordering. @@ -162,8 +162,8 @@ expr ::= identifier LSL_ASSIGNMENT_DIVIDE expr. expr ::= identifier LSL_ASSIGNMENT_PLAIN expr. // Hmm think this can have commas seperating the assignment parts. -statement(A) ::= type(B) identifier(C) LSL_ASSIGNMENT_PLAIN(D) expr(E) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(param, B, C, D, E)); } -statement(A) ::= type(B) identifier(C) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(param, B, C, NULL, NULL)); } +statement(A) ::= type(B) identifier(C) LSL_ASSIGNMENT_PLAIN(D) expr(E) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, D, E)); } +statement(A) ::= type(B) identifier(C) LSL_STATEMENT(F). { A = addStatement(F, LSL_IDENTIFIER, addVariable(compiler, B, C, NULL, NULL)); } %right LSL_DOT LSL_IDENTIFIER. identifier ::= identifier LSL_DOT LSL_IDENTIFIER. @@ -200,28 +200,28 @@ expr ::= LSL_ANGLE_OPEN expr LSL_COMMA expr LSL_COMMA expr LSL_ANGLE_CLOSE. [L %parse_accept { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; PI("Parsing complete."); } %parse_failure { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; PE("Giving up. Parser is hopelessly lost!"); } %stack_overflow { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; PE("Giving up. Parser stack overflow @ line %04d column %04d.", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. } %syntax_error { - gameGlobals *game = param->game; + gameGlobals *game = compiler->game; PE("Syntax error @ line %04d column %04d.", yyminor.yy0->line, yyminor.yy0->column); } diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l index 8a5e8ad..591dfdc 100644 --- a/LuaSL/src/LuaSL_lexer.l +++ b/LuaSL/src/LuaSL_lexer.l @@ -3,7 +3,7 @@ #define excludeLexer #include "LuaSL.h" -int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIgnorable, int type); +int common(YYSTYPE *lval, char *text, LuaSL_compiler *compiler, boolean checkIgnorable, int type); %} @@ -12,7 +12,7 @@ int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIg %option noreject noyymore %option backup debug perf-report perf-report verbose warn %option align full -%option extra-type="LuaSL_yyparseParam *" +%option extra-type="LuaSL_compiler *" HEX [[:xdigit:]] DECIMAL [[:digit:]] @@ -113,7 +113,7 @@ STRING \"(\\.|[^\\"\n])*\" %% -int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIgnorable, int type) +int common(YYSTYPE *lval, char *text, LuaSL_compiler *compiler, boolean checkIgnorable, int type) { char *p; @@ -121,33 +121,33 @@ int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIg { if ('\n' == *p) { - param->line++; - param->column = 1; + compiler->line++; + compiler->column = 1; } else - param->column++; + compiler->column++; } lval->token = tokens[type - lowestToken]; - lval->line = param->line; - lval->column = param->column; + lval->line = compiler->line; + lval->column = compiler->column; if (checkIgnorable) { - lval->ignorableText = param->ignorableText; - param->ignorableText = NULL; + lval->ignorableText = compiler->ignorableText; + compiler->ignorableText = NULL; } else { - if (param->ignorableText) + if (compiler->ignorableText) { - int lenI = strlen(param->ignorableText); + int lenI = strlen(compiler->ignorableText); int lenT = strlen(text); - param->ignorableText = realloc(param->ignorableText, lenI + lenT + 1); - sprintf(&(param->ignorableText[lenI]), "%s", text); + compiler->ignorableText = realloc(compiler->ignorableText, lenI + lenT + 1); + sprintf(&(compiler->ignorableText[lenI]), "%s", text); } else - param->ignorableText = strdup(text); + compiler->ignorableText = strdup(text); } return type; -- cgit v1.1