from dataclasses import dataclass from enum import auto, Enum from typing import Any class Datatype(Enum): NONE = auto() NULL = auto() STRING = auto() INTEGER = auto() FLOAT = auto() @dataclass class Variable: name: str type: Datatype value: Any NONE_TYPE = Variable(None, Datatype.NONE, None) VAR_MATCH = { r"null": Datatype.NULL, r"\".+\"": Datatype.STRING, r"\d+\.\d{0,}": Datatype.FLOAT, r"\d+": Datatype.INTEGER, r".+": Datatype.NONE, }