aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-16 07:08:07 +1000
committerDavid Walter Seikel2014-05-16 07:08:07 +1000
commit7cf594df4ddb4f76ef4230c78e100044cda8fb21 (patch)
tree916803f8ff918b197172d8bd439c7b8d3d5a7619 /src/LuaSL
parentActually typecast to list / table. (diff)
downloadSledjHamr-7cf594df4ddb4f76ef4230c78e100044cda8fb21.zip
SledjHamr-7cf594df4ddb4f76ef4230c78e100044cda8fb21.tar.gz
SledjHamr-7cf594df4ddb4f76ef4230c78e100044cda8fb21.tar.bz2
SledjHamr-7cf594df4ddb4f76ef4230c78e100044cda8fb21.tar.xz
Fix up the various list concatenations, and mark one as not being tested yet.
Diffstat (limited to 'src/LuaSL')
-rw-r--r--src/LuaSL/LuaSL_compile.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c
index fb9a5be..c1b119e 100644
--- a/src/LuaSL/LuaSL_compile.c
+++ b/src/LuaSL/LuaSL_compile.c
@@ -478,25 +478,41 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
478 break; 478 break;
479 479
480 case ST_ADD : 480 case ST_ADD :
481 // someList = (list) notAList + someList -> someList = _LSL.listAddList( _LSL.listTypecast(notAList), someList)
482 // someList = aList + bList -> someList = _LSL.listAddList(aList, bList)
481 if (OT_listList == lval->basicType) 483 if (OT_listList == lval->basicType)
482 { 484 {
483 lval->basicType = OT_list; 485 lval->basicType = OT_list;
484 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken]; 486 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken];
485 } 487 }
486 else if (OT_list == lType) 488 // This one is not turning up in my test code, so not tested.
489 // someList = notAList + someList -> someList = _LSL.listAddList( notAList, someList)
490 // someList = someList + notAList -> someList = _LSL.listAddList( someList, notAList)
491 else if ((OT_list == lType) || (OT_list == rType))
487 { 492 {
493
494if ((left) && (right))
495 printf("LA LINE %d - %s %s %s\n", lval->line, left->toKen->toKen, lval->toKen->toKen, right->toKen->toKen);
496else if (left)
497 printf("LA LINE %d - %s %s NORIGHT\n", lval->line, left->toKen->toKen, lval->toKen->toKen);
498else if (right)
499 printf("LA LINE %d - NOLEFT %s %s\n", lval->line, lval->toKen->toKen, right->toKen->toKen);
500else
501 printf("LA LINE %d - NOLEFT %s NORIGHT\n", lval->line, lval->toKen->toKen);
502
488 lval->basicType = OT_list; 503 lval->basicType = OT_list;
489 lval->toKen = tokens[LSL_LIST_ADD - lowestToken]; 504 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken];
490 } 505 }
491 break; 506 break;
492 507
493 case ST_CONCATENATION : 508 case ST_CONCATENATION :
494 // This is if the right side has been cast to a list. 509 // someList += (list) notAList -> someList = _LSL.listAddList(someList, _LSL.listTypecast(notAList))
495 if ((LSL_ASSIGNMENT_PLAIN != lval->toKen->type) && (OT_listList == lval->basicType)) 510 if ((LSL_ASSIGNMENT_PLAIN != lval->toKen->type) && (OT_listList == lval->basicType))
496 { 511 {
497 lval->basicType = OT_list; 512 lval->basicType = OT_list;
498 lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken]; 513 lval->toKen = tokens[LSL_LIST_ADD - lowestToken];
499 } 514 }
515 // someList += notAList -> someList = _LSL.listConcat(someList, notAList)
500 else if ((OT_list == lType) && (OT_list != rType)) 516 else if ((OT_list == lType) && (OT_list != rType))
501 { 517 {
502 lval->basicType = OT_list; 518 lval->basicType = OT_list;
@@ -1382,7 +1398,7 @@ static void outputLeaf(FILE *file, outputMode mode, LSL_Leaf *leaf)
1382{ 1398{
1383 if (leaf) 1399 if (leaf)
1384 { 1400 {
1385 if ((OM_LUA == mode) && (ST_BITWISE != leaf->toKen->subType) && (LSL_LIST_ADD != leaf->toKen->type) && (LSL_LIST_ADD_LIST != leaf->toKen->type)) 1401 if ((OM_LUA == mode) && (ST_BITWISE != leaf->toKen->subType) /*&& (LSL_LIST_ADD != leaf->toKen->type)*/ && (LSL_LIST_ADD_LIST != leaf->toKen->type))
1386 outputLeaf(file, mode, leaf->left); 1402 outputLeaf(file, mode, leaf->left);
1387#if LUASL_DIFF_CHECK 1403#if LUASL_DIFF_CHECK
1388 if ((!(LSL_NOIGNORE & leaf->toKen->flags)) && (leaf->ignorable)) 1404 if ((!(LSL_NOIGNORE & leaf->toKen->flags)) && (leaf->ignorable))
@@ -1439,7 +1455,7 @@ else
1439 fprintf(file, " ~= "); 1455 fprintf(file, " ~= ");
1440 else if (LSL_LIST_ADD == leaf->toKen->type) 1456 else if (LSL_LIST_ADD == leaf->toKen->type)
1441 { 1457 {
1442 fprintf(file, " _LSL.listAdd("); 1458 fprintf(file, " = _LSL.listAdd(");
1443 outputLeaf(file, mode, leaf->left); 1459 outputLeaf(file, mode, leaf->left);
1444 fprintf(file, ", "); 1460 fprintf(file, ", ");
1445 outputLeaf(file, mode, leaf->right); 1461 outputLeaf(file, mode, leaf->right);
@@ -1447,7 +1463,7 @@ else
1447 } 1463 }
1448 else if (LSL_LIST_ADD_LIST == leaf->toKen->type) 1464 else if (LSL_LIST_ADD_LIST == leaf->toKen->type)
1449 { 1465 {
1450 fprintf(file, " _LSL.listAddList("); 1466 fprintf(file, " _LSL.listAdd(");
1451 outputLeaf(file, mode, leaf->left); 1467 outputLeaf(file, mode, leaf->left);
1452 fprintf(file, ", "); 1468 fprintf(file, ", ");
1453 outputLeaf(file, mode, leaf->right); 1469 outputLeaf(file, mode, leaf->right);