diff options
Diffstat (limited to 'LuaSL/src/LuaSL_LSL_tree.h')
-rw-r--r-- | LuaSL/src/LuaSL_LSL_tree.h | 38 |
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 | */ |
20 | typedef struct tagSExpression | 20 | typedef 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 | */ |
34 | SExpression* createNumber(int value); | 34 | SExpression* 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 | */ |
43 | SExpression* createOperation( | 43 | SExpression* 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 | */ |
52 | void deleteExpression(SExpression *b); | 49 | void deleteExpression(SExpression *b); |
53 | 50 | ||
51 | SExpression *getAST(const char *expr); | ||
52 | |||
53 | int evaluate(SExpression *e); | ||
54 | |||
55 | int yyerror(const char *msg); | ||
56 | int yyparse(void *param); | ||
57 | |||
54 | #endif // __EXPRESSION_H__ | 58 | #endif // __EXPRESSION_H__ |
55 | 59 | ||