Go to the documentation of this file. 1 #ifndef INCLUDE_EXPRESSION_H_
2 #define INCLUDE_EXPRESSION_H_
6 #include <unordered_map>
7 #include <unordered_set>
32 explicit Atomic(
AtomicType _type = AtomicType::INTEGER,
bool _negative =
false);
100 std::ostream& operator<<(std::ostream& out, Operation operation);
111 explicit Expression(
const std::string& expression,
const std::string& lineSymbol =
"");
152 inline const std::unordered_set<std::string>
depends()
const {
return _depends; }
154 inline const std::vector<Atomic>
atomics()
const {
return _atomics; }
156 inline const std::vector<Operation>
operations()
const {
return _operations; }
166 void parse(
const std::string& expression,
const std::string& lineSymbol);
173 bool evaluate(
const std::unordered_map<std::string, AtomicValue>& constants);
182 void replaceSymbol(
const std::unordered_map<std::string, std::string>& mapping);
196 bool _literalConstant;
198 std::unordered_set<std::string> _depends;
199 std::vector<Atomic> _atomics;
200 std::vector<Operation> _operations;
206 #endif // INCLUDE_EXPRESSION_H_
bool operator==(const Expression &expression)
void replaceSymbol(const std::unordered_map< std::string, std::string > &mapping)
AtomicValue & operator=(const AtomicValue &atomicValue)
static bool isValidFirst(char ch)
friend std::ostream & operator<<(std::ostream &out, const Expression &expression)
bool operator!=(const Atomic &atomic)
static Expression getConstOffsetExpression(const std::string &symbol, int32_t offset)
static bool isValidChar(char ch)
Atomic(AtomicType _type=AtomicType::INTEGER, bool _negative=false)
The definition of some errors.
void parse(const std::string &expression, const std::string &lineSymbol)
bool evaluate(const std::unordered_map< std::string, AtomicValue > &constants)
const std::vector< Atomic > atomics() const
static Expression getConstExpression(const AtomicValue &value)
const std::unordered_set< std::string > depends() const
void replaceSymbol(const std::string &symbol)
bool literalConstant() const
bool operator!=(const Expression &expression)
bool isLocalSymbol() const
const AtomicValue & result() const
const std::vector< Operation > operations() const
bool operator==(const Atomic &atomic)
friend std::ostream & operator<<(std::ostream &out, const Atomic &atomic)