diff options
author | David Walter Seikel | 2012-02-02 12:59:47 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-02 12:59:47 +1000 |
commit | 21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed (patch) | |
tree | d124acf1b2b0ad32cda3a677316fd82df58b1269 /LuaSL/src/LuaSL_compile.c | |
parent | Get the right type for identifier subs. (diff) | |
download | SledjHamr-21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed.zip SledjHamr-21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed.tar.gz SledjHamr-21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed.tar.bz2 SledjHamr-21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed.tar.xz |
Partially implement parsing/outputting rotations and vectors.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 2d5878f..cf9d767 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -104,9 +104,9 @@ LSL_Token LSL_Tokens[] = | |||
104 | {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, evaluateIntegerToken}, | 104 | {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, evaluateIntegerToken}, |
105 | {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken, NULL}, | 105 | {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken, NULL}, |
106 | {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken, NULL}, | 106 | {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken, NULL}, |
107 | {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, NULL, NULL}, | 107 | {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken, NULL}, |
108 | {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken, NULL}, | 108 | {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken, NULL}, |
109 | {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, NULL, NULL}, | 109 | {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken, NULL}, |
110 | 110 | ||
111 | // Types names. | 111 | // Types names. |
112 | {LSL_TYPE_FLOAT, ST_NONE, "float", LSL_NONE, NULL, NULL}, | 112 | {LSL_TYPE_FLOAT, ST_NONE, "float", LSL_NONE, NULL, NULL}, |
@@ -724,6 +724,18 @@ LSL_Leaf *addList(LSL_Leaf *left, LSL_Leaf *list, LSL_Leaf *right) | |||
724 | return left; | 724 | return left; |
725 | } | 725 | } |
726 | 726 | ||
727 | LSL_Leaf *addRotVec(LSL_Leaf *left, LSL_Leaf *list, LSL_Leaf *right) | ||
728 | { | ||
729 | LSL_Type type = LSL_ROTATION; | ||
730 | opType otype = OT_rotation; | ||
731 | |||
732 | // TODO - count the members of list to see if it's a vector. | ||
733 | left = addParenthesis(left, list, type, right); | ||
734 | left->toKen = tokens[type - lowestToken]; | ||
735 | left->basicType = otype; | ||
736 | return left; | ||
737 | } | ||
738 | |||
727 | LSL_Leaf *addNumby(LSL_Leaf *numby) | 739 | LSL_Leaf *addNumby(LSL_Leaf *numby) |
728 | { | 740 | { |
729 | LSL_Numby *num = calloc(1, sizeof(LSL_Numby)); | 741 | LSL_Numby *num = calloc(1, sizeof(LSL_Numby)); |
@@ -1820,18 +1832,30 @@ static void outputListToken(FILE *file, outputMode mode, LSL_Leaf *content) | |||
1820 | { | 1832 | { |
1821 | LSL_FunctionCall *call = parens->contents->value.functionCallValue; | 1833 | LSL_FunctionCall *call = parens->contents->value.functionCallValue; |
1822 | LSL_Leaf *param = NULL; | 1834 | LSL_Leaf *param = NULL; |
1835 | const char *ig = ""; | ||
1823 | 1836 | ||
1824 | // TODO - should output it's own ignorable here. | 1837 | // TODO - should output it's own ignorable here. |
1825 | fprintf(file, "["); | 1838 | switch (parens->type) |
1839 | { | ||
1840 | case LSL_LIST : fprintf(file, "["); break; | ||
1841 | case LSL_ROTATION : | ||
1842 | case LSL_VECTOR : fprintf(file, "<"); | ||
1843 | default : break; | ||
1844 | } | ||
1826 | EINA_INARRAY_FOREACH((&(call->params)), param) | 1845 | EINA_INARRAY_FOREACH((&(call->params)), param) |
1827 | { | 1846 | { |
1828 | outputLeaf(file, mode, param); | 1847 | outputLeaf(file, mode, param); |
1829 | } | 1848 | } |
1830 | #if LUASL_DIFF_CHECK | 1849 | #if LUASL_DIFF_CHECK |
1831 | fprintf(file, "%s]", eina_strbuf_string_get(parens->rightIgnorable)); | 1850 | ig = eina_strbuf_string_get(parens->rightIgnorable); |
1832 | #else | ||
1833 | fprintf(file, "]"); | ||
1834 | #endif | 1851 | #endif |
1852 | switch (parens->type) | ||
1853 | { | ||
1854 | case LSL_LIST : fprintf(file, "%s]", ig); break; | ||
1855 | case LSL_ROTATION : | ||
1856 | case LSL_VECTOR : fprintf(file, "%s>", ig); | ||
1857 | default : break; | ||
1858 | } | ||
1835 | } | 1859 | } |
1836 | } | 1860 | } |
1837 | } | 1861 | } |