More Expression.cpp work.
This commit is contained in:
parent
03fe14d075
commit
3ba81a7d0a
@ -1,5 +1,6 @@
|
|||||||
#include "Expression.h"
|
#include "Expression.h"
|
||||||
#include "Operand.h"
|
#include "Operand.h"
|
||||||
|
#include "Exception.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace jet {
|
namespace jet {
|
||||||
@ -12,6 +13,21 @@ namespace jet {
|
|||||||
boolean = op1.boolean;
|
boolean = op1.boolean;
|
||||||
string = op1.string;
|
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 << "Leaving expression string: " << string << std::endl;
|
||||||
std::cout << "Unparsed: [" << in.unparsed() << "]" << std::endl;
|
std::cout << "Unparsed: [" << in.unparsed() << "]" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ namespace jet {
|
|||||||
coreutils::ZString getStringResult();
|
coreutils::ZString getStringResult();
|
||||||
bool boolean;
|
bool boolean;
|
||||||
coreutils::ZString string;
|
coreutils::ZString string;
|
||||||
|
char *operation;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user