aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL/src')
-rw-r--r--LuaSL/src/LuaSL_compile.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index e9a22c1..8194947 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -1,5 +1,40 @@
1#include "LuaSL.h" 1#include "LuaSL.h"
2 2
3/* TODO -
4
5Assignments in the middle of expressions is legal in LSL, but not in Lua.
6The big complication is that they often happen in the conditionals of flow control statements. That's a big bitch.
7
8So things like -
9
10 while ((x = doSomething()) == foo)
11 {
12 buggerAround();
13 }
14
15Turns into -
16
17 x = doSomething();
18 while (x == foo)
19 {
20 buggerAround();
21 x = doSomething();
22 }
23
24http://lua-users.org/wiki/StatementsInExpressions might be helpful. Which suggests something like this -
25
26 while ( (function() x = doSomething(); return x; end)() == foo)
27 {
28 buggerAround();
29 }
30
31The remaining problem is when to recognise the need to do that.
32Note that assignments are really low precedence.
33 While adding operations
34 Flag the assignment expressions
35 If there is an assignment expression (not operation) on the RHS of an operation, we need to do this?
36*/
37
3 38
4static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); 39static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right);
5static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); 40static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right);