More Expression.cpp work.

This commit is contained in:
Brad Arant 2024-08-08 16:34:20 -07:00
parent 03fe14d075
commit 3ba81a7d0a
2 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#include "Expression.h"
#include "Operand.h"
#include "Exception.h"
#include <iostream>
namespace jet {
@ -12,6 +13,21 @@ namespace jet {
boolean = op1.boolean;
string = op1.string;
if(in.unparsed().getLength() > 0) {
std::cout << "1)" << in.unparsed() << std::endl;
if(in.ifNext("+"))
operation = (char *)"+";
else if(in.ifNext("-"))
operation = (char *)"-";
else
throw coreutils::Exception("Expecting operator.");
in.skipWhitespace();
if(in.unparsed().getLength() == 0)
throw coreutils::Exception("Expecting operand.");
Operand op2(in);
std::cout << op1.string << ":" << operation << ":" << op2.string << std::endl;
}
std::cout << "Leaving expression string: " << string << std::endl;
std::cout << "Unparsed: [" << in.unparsed() << "]" << std::endl;
}

View File

@ -16,6 +16,7 @@ namespace jet {
coreutils::ZString getStringResult();
bool boolean;
coreutils::ZString string;
char *operation;
};
}