Skip to content

Commit

Permalink
Update source.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
letter-aa authored Nov 19, 2023
1 parent 745e409 commit 06c7eb2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions source.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//fix interpreter only removing one part of boolean comparison string
#include <iostream>
#include <Windows.h>
#include <string>
Expand Down Expand Up @@ -731,13 +732,17 @@ void compile(string input, string data) {
vector<string> b;
stringX::splitString(data, b, "(");
stringX::replace(b[1], ")", "", NULL);
if (b[1].find_first_not_of("") == string::npos || b[1].find_first_not_of(" ") == string::npos) {
cout << "";
return;
}
boolcomp(input, data, b);
if (str(b, input, data) == DOUBLE) {
int form = format(b, DOUBLE);
if (form == 1 || form == -1) {
return;
}
}
}
else if (str(b, input, data) == SINGLE) {
int form = format(b, SINGLE);
if (form == 1 || form == -1) {
Expand All @@ -759,6 +764,10 @@ void compile(string input, string data) {
vector<string> b;
stringX::splitString(data, b, "(");
stringX::replace(b[1], ")", "", NULL);
if (b[1].find_first_not_of("") == string::npos || b[1].find_first_not_of(" ") == string::npos) {
error("function parameter 1 is empty!", input, data, "=", false);
return;
}
if (str(b, input, data) == DOUBLE) {
int form = format(b, DOUBLE);
if (form == 1 || form == -1) {
Expand Down Expand Up @@ -788,6 +797,10 @@ void compile(string input, string data) {
vector<string> b;
stringX::splitString(data, b, "(");
stringX::replace(b[1], ")", "", NULL);
if (b[1].find_first_not_of("") == string::npos || b[1].find_first_not_of(" ") == string::npos) {
error("function parameter 1 is empty!", input, data, "=", false);
return;
}
b.push_back(input);
if (str(b, input, data) == DOUBLE) {
int form = format(b, DOUBLE);
Expand Down Expand Up @@ -822,8 +835,6 @@ void compile(string input, string data) {
vector<string> var;
var.push_back(data.substr(0, data.find("=")));
var.push_back(data.substr(data.find("=") + 1));
rs(var);
boolcomp(input,data,var);
//-----------
if ((var[0].find_first_not_of("") == string::npos || var[0].find_first_not_of(" ") == string::npos) && (var[1].find_first_not_of("") == string::npos || var[1].find_first_not_of(" ") == string::npos)) {
error("missing variable name and value!", input, data, "", false);
Expand All @@ -834,10 +845,12 @@ void compile(string input, string data) {
return;
}
if (var[1].find_first_not_of("") == string::npos || var[1].find_first_not_of(" ") == string::npos) {
error("variable value is empty!", input, data, var[1], false);
error("variable value is empty!", input, data, "=", false);
return;
}
//-----------
rs(var);
boolcomp(input,data,var);
if (str(var, input, data) == DOUBLE) {
int form = format(var, DOUBLE);
if (form == 1 || form == -1) {
Expand Down

0 comments on commit 06c7eb2

Please sign in to comment.