|
5 | 5 | // | TODO: comment and format this file properly |
|
6 | 6 | // +---------------------------------------------+
|
7 | 7 |
|
| 8 | +#include "../ldpl.h" |
| 9 | + |
8 | 10 | // Given a full variable (with accesses and everything, like foo:0:'hi there' or
|
9 | 11 | // bar) returns the C++ representation of said variable in order to be accessed.
|
10 | 12 | string get_c_variable(compiler_state &state, string &variable)
|
@@ -103,9 +105,12 @@ string get_c_condition(compiler_state &state, vector<string> tokens,
|
103 | 105 | string second_value;
|
104 | 106 | string rel_op;
|
105 | 107 | ct++; // We validate the token after we get the second value
|
106 |
| - if (tokens[ct] == "IS") |
| 108 | + if (tokens[ct] == "IS" || tokens[ct] == "=" || tokens[ct] == "<>" || tokens[ct] == "<" || tokens[ct] == ">" || tokens[ct] == "<=" || tokens[ct] == ">=") |
107 | 109 | {
|
108 |
| - MATCH("IS"); |
| 110 | + if (tokens[ct] == "IS") |
| 111 | + { |
| 112 | + MATCH("IS"); |
| 113 | + } |
109 | 114 | if (tokens[ct] == "EQUAL")
|
110 | 115 | {
|
111 | 116 | MATCH("EQUAL");
|
@@ -155,6 +160,36 @@ string get_c_condition(compiler_state &state, vector<string> tokens,
|
155 | 160 | rel_op = "LESS THAN";
|
156 | 161 | }
|
157 | 162 | }
|
| 163 | + else if (tokens[ct] == "<") |
| 164 | + { |
| 165 | + MATCH("<"); |
| 166 | + rel_op = "LESS THAN"; |
| 167 | + } |
| 168 | + else if (tokens[ct] == "<=") |
| 169 | + { |
| 170 | + MATCH("<="); |
| 171 | + rel_op = "LESS THAN OR EQUAL TO"; |
| 172 | + } |
| 173 | + else if (tokens[ct] == ">") |
| 174 | + { |
| 175 | + MATCH(">"); |
| 176 | + rel_op = "GREATER THAN"; |
| 177 | + } |
| 178 | + else if (tokens[ct] == ">=") |
| 179 | + { |
| 180 | + MATCH(">="); |
| 181 | + rel_op = "GREATER THAN OR EQUAL TO"; |
| 182 | + } |
| 183 | + else if (tokens[ct] == "=") |
| 184 | + { |
| 185 | + MATCH("="); |
| 186 | + rel_op = "EQUAL TO"; |
| 187 | + } |
| 188 | + else if (tokens[ct] == "<>") |
| 189 | + { |
| 190 | + MATCH("<>"); |
| 191 | + rel_op = "NOT EQUAL TO"; |
| 192 | + } |
158 | 193 | else
|
159 | 194 | {
|
160 | 195 | return "[ERROR]";
|
|
0 commit comments