diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 35 |
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 | |||
5 | Assignments in the middle of expressions is legal in LSL, but not in Lua. | ||
6 | The big complication is that they often happen in the conditionals of flow control statements. That's a big bitch. | ||
7 | |||
8 | So things like - | ||
9 | |||
10 | while ((x = doSomething()) == foo) | ||
11 | { | ||
12 | buggerAround(); | ||
13 | } | ||
14 | |||
15 | Turns into - | ||
16 | |||
17 | x = doSomething(); | ||
18 | while (x == foo) | ||
19 | { | ||
20 | buggerAround(); | ||
21 | x = doSomething(); | ||
22 | } | ||
23 | |||
24 | http://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 | |||
31 | The remaining problem is when to recognise the need to do that. | ||
32 | Note 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 | ||
4 | static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); | 39 | static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); |
5 | static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); | 40 | static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); |