mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
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.
29 lines
496 B
C++
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
|