mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
This also includes the necessary setup work for using "position" and "direction" in action expressions.
39 lines
802 B
C++
39 lines
802 B
C++
#pragma once
|
|
|
|
#include "actions/expression/ParseContext.h"
|
|
#include "actions/expression/Value.h"
|
|
|
|
#include <Parser.h>
|
|
#include <Token.h>
|
|
|
|
namespace actions {
|
|
namespace expression {
|
|
namespace nodes {
|
|
|
|
class AbstractExpression {
|
|
public:
|
|
AbstractExpression(antlr4::Token* token);
|
|
virtual ~AbstractExpression();
|
|
|
|
virtual Value execute(const ProgramVariables& variables) const = 0;
|
|
|
|
virtual bool validate(antlr4::Parser* parser, const ParseContext& context) = 0;
|
|
|
|
virtual void validationDone();
|
|
|
|
ValueType getExpressionType() const;
|
|
|
|
antlr4::Token* getToken() const;
|
|
|
|
protected:
|
|
virtual ValueType determineReturnType() const = 0;
|
|
|
|
antlr4::Token* m_token = nullptr;
|
|
|
|
mutable ValueType m_cachedType = ValueType::Invalid;
|
|
};
|
|
|
|
} // namespace nodes
|
|
} // namespace expression
|
|
} // namespace actions
|