aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-05 09:03:42 +1000
committerDavid Walter Seikel2012-01-05 09:03:42 +1000
commit0384c411107672aeb4bd1134d101b5dc62cc41bb (patch)
treeaf576a45a18787d04f727a01f17ec32f9c0f40fc /LuaSL/src/LuaSL_LSL_tree.h
parentRemove most of the constants, we can put them in Lua globals later. Make the... (diff)
downloadSledjHamr-0384c411107672aeb4bd1134d101b5dc62cc41bb.zip
SledjHamr-0384c411107672aeb4bd1134d101b5dc62cc41bb.tar.gz
SledjHamr-0384c411107672aeb4bd1134d101b5dc62cc41bb.tar.bz2
SledjHamr-0384c411107672aeb4bd1134d101b5dc62cc41bb.tar.xz
Clean up the parser.
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 6d89672..71d372e 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -3,7 +3,7 @@
3 */ 3 */
4#ifndef __EXPRESSION_H__ 4#ifndef __EXPRESSION_H__
5#define __EXPRESSION_H__ 5#define __EXPRESSION_H__
6 6
7/** 7/**
8 * @brief The operation type 8 * @brief The operation type
9 */ 9 */
@@ -12,27 +12,27 @@ typedef enum tagEOperationType
12 eVALUE, 12 eVALUE,
13 eMULTIPLY, 13 eMULTIPLY,
14 ePLUS 14 ePLUS
15}EOperationType; 15} EOperationType;
16 16
17/** 17/**
18 * @brief The expression structure 18 * @brief The expression structure
19 */ 19 */
20typedef struct tagSExpression 20typedef struct tagSExpression
21{ 21{
22 EOperationType type;///< type of operation 22 EOperationType type;///< type of operation
23 23
24 int value;///< valid only when type is eVALUE 24 int value;///< valid only when type is eVALUE
25 struct tagSExpression* left; ///< left side of the tree 25 struct tagSExpression* left; ///< left side of the tree
26 struct tagSExpression* right;///< right side of the tree 26 struct tagSExpression* right;///< right side of the tree
27}SExpression; 27} SExpression;
28 28
29/** 29/**
30 * @brief It creates an identifier 30 * @brief It creates an identifier
31 * @param value The number value 31 * @param value The number value
32 * @return The expression or NULL in case of no memory 32 * @return The expression or NULL in case of no memory
33 */ 33 */
34SExpression* createNumber(int value); 34SExpression* createNumber(int value);
35 35
36/** 36/**
37 * @brief It creates an operation 37 * @brief It creates an operation
38 * @param type The operation type 38 * @param type The operation type
@@ -40,16 +40,20 @@ SExpression* createNumber(int value);
40 * @param right The right operand 40 * @param right The right operand
41 * @return The expression or NULL in case of no memory 41 * @return The expression or NULL in case of no memory
42 */ 42 */
43SExpression* createOperation( 43SExpression* createOperation(EOperationType type, SExpression *left, SExpression *right);
44 EOperationType type, 44
45 SExpression *left,
46 SExpression *right);
47
48/** 45/**
49 * @brief Deletes a expression 46 * @brief Deletes a expression
50 * @param b The expression 47 * @param b The expression
51 */ 48 */
52void deleteExpression(SExpression *b); 49void deleteExpression(SExpression *b);
53 50
51SExpression *getAST(const char *expr);
52
53int evaluate(SExpression *e);
54
55int yyerror(const char *msg);
56int yyparse(void *param);
57
54#endif // __EXPRESSION_H__ 58#endif // __EXPRESSION_H__
55 59