def _token_from_name(token_string:str, table:SymbolTable, line_number:int=None) -> Token: """Returns the correct token from the name """ if table.is_keyword(token_string): token_id = "keyword" elif table.is_operator(token_string): token_id = "operator" elif table.is_constant(token_string): token_id = "constant" elif token_string[0].lower() == "r": token_id = "identifier" else: token_id = "label" return Token(token_id, token_string, line_number=line_number)