typedef enum {
  T_UNKNOWN, T_KEYWORD, T_IDENTIFIER, T_NUMBER,
  T_OPENBRACE, T_CLOSEBRACE, T_EOF
} tokentype_t;

typedef enum {
  E_NOERROR, E_EOF, E_ILLEGALCHAR
} tokenerror_t;


/*
 * internal representation of a token
 *
 * this doesn't get used to build parse trees or anything fancy, it is simply
 * necessary to bundle information such as the line number so that it's cleanly
 * visible to everyone that needs it
 */
typedef struct {
  long long int lineno;
  tokentype_t type;
  tokenerror_t error;
  char *value;
} token_t;


const char *token_err2str (tokenerror_t code);
int token_str2err (char *str, tokenerror_t *te);

