constructor.
constructor.
constructor.
constructor.
enum defining all data types. These are all lowercase of what they're written here
identifies the data type from the actual data. Only works for base types, and with only 1 token. So arrays dont work. keep in mind, this won't be able to identify if the data type is a reference or not
reads DataType from a string, works for base types and custom types
Just calls fromString()
stores if it's an array. If type is int, it will be 0, if int[] it will be 1, if int[][], then 2 ...
stores length in case of Type.Custom
stores if it's a reference to a type
the actual data type
st{ assert(DataType("int") == DataType(DataType.Type.Int, 0)); assert(DataType("char[][]") == DataType(DataType.Type.Char, 2)); assert(DataType("double[][]") == DataType(DataType.Type.Double, 2)); assert(DataType("void") == DataType(DataType.Type.Void, 0)); // unittests for `fromData` DataType dType; dType.fromData(Token("\"bla bla\"")); assert(dType == DataType("char[]")); dType.fromData(Token("20")); assert(dType == DataType("int"), dType.name); dType.fromData(Token("2.5")); assert(dType == DataType("double")); // unittests for `.name()` assert(DataType("potatoType[][]").name == "potatoType[][]"); assert(DataType("double[]").name == "double[]")
used to store data types for data at compile time