polserver/pol-core/bscript/compiler/analyzer/Constants.h
Eric Swanson 6ce9c38de3
Add support for const declarations (#264)
Adds:
- analyzer/Constants: holds constant name -> value for lookup
- ast/ConstDeclaration: AST node for a const declaration
- optimizer/ConstValidator: validates that an optimized expression is valid to use as a constant.

the Optimizer converts Identifiers that refer to a constant to the optimized constant value.
2020-09-01 00:54:24 -07:00

29 lines
496 B
C++

#ifndef POLSERVER_CONSTANTS_H
#define POLSERVER_CONSTANTS_H
#include <map>
#include <memory>
#include <string>
namespace Pol::Bscript::Compiler
{
class ConstDeclaration;
class Report;
class Constants
{
public:
explicit Constants( Report& );
ConstDeclaration* find( const std::string& name );
void create( ConstDeclaration& );
private:
std::map<std::string, ConstDeclaration*> constants;
Report& report;
};
} // namespace Pol::Bscript::Compiler
#endif // POLSERVER_CONSTANTS_H