More work on binder, implements basic literal expressions

This commit is contained in:
2019-05-21 20:59:26 +02:00
parent 2fe6f570ec
commit 80998eab14
7 changed files with 251 additions and 3 deletions

40
src/ScriptType.hpp Normal file
View File

@@ -0,0 +1,40 @@
#ifndef PORYGONLANG_SCRIPTTYPE_HPP
#define PORYGONLANG_SCRIPTTYPE_HPP
enum class TypeClass{
Error,
Nil,
Number,
Bool,
String,
Function,
UserData,
Table,
};
class ScriptType{
TypeClass _class;
public:
explicit ScriptType(TypeClass c){
_class = c;
}
explicit virtual operator TypeClass(){
return _class;
}
};
class NumericScriptType : public ScriptType{
// Are we aware of whether this is a float or not?
bool _awareOfFloat;
// Is this value a float?
bool _isFloat;
public:
explicit NumericScriptType(bool floatAware, bool isFloat) : ScriptType(TypeClass::Number){
_awareOfFloat = floatAware;
_isFloat = isFloat;
}
};
#endif //PORYGONLANG_SCRIPTTYPE_HPP