Skip to content

Commit 5bb9d51

Browse files
committed
Add % to in ... solve and < / > / <> / >= / <= / = ops
1 parent 440c961 commit 5bb9d51

File tree

3 files changed

+262
-133
lines changed

3 files changed

+262
-133
lines changed

src/aux/aux_c_format.cpp

+37-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// | TODO: comment and format this file properly |
66
// +---------------------------------------------+
77

8+
#include "../ldpl.h"
9+
810
// Given a full variable (with accesses and everything, like foo:0:'hi there' or
911
// bar) returns the C++ representation of said variable in order to be accessed.
1012
string get_c_variable(compiler_state &state, string &variable)
@@ -103,9 +105,12 @@ string get_c_condition(compiler_state &state, vector<string> tokens,
103105
string second_value;
104106
string rel_op;
105107
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] == ">=")
107109
{
108-
MATCH("IS");
110+
if (tokens[ct] == "IS")
111+
{
112+
MATCH("IS");
113+
}
109114
if (tokens[ct] == "EQUAL")
110115
{
111116
MATCH("EQUAL");
@@ -155,6 +160,36 @@ string get_c_condition(compiler_state &state, vector<string> tokens,
155160
rel_op = "LESS THAN";
156161
}
157162
}
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+
}
158193
else
159194
{
160195
return "[ERROR]";

0 commit comments

Comments
 (0)