#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

typedef enum { TRUE=1, FALSE=0 } bool;

/**
 * See the lex.c comments for JSON strings.
 * Numbers are may begin with a digit, period or minus sign.  You may use
 *   strtod() to validate your numbers.  Numbers may include digits, periods (at
 *   most 1), an e or E optionally followed by + or - and then more digits.  To
 *   handle numbers easily, just accumulate characters into the word buffer
 *   until word ender is reached.  If the word starts with a digit, period or
 *   dash, use strtod() on it to see if it is a number.  Otherwise it check if
 *   it is "true","false" or "null".
 *   [] = T_OBRAC / T_CBRAC
 *   {} = T_OCBRACE / T_CCBRACE
 *   ,  = T_COMMA
 *   :  = T_COLON
 */

typedef enum {
  T_STRING, T_NUMBER, T_OBRAC, T_CBRAC, T_OCBRACE, T_CCBRACE, T_COMMA, T_COLON,
  T_TRUE, T_FALSE, T_NULL,
  T_EOI, T_UNKNOWN
} token_t;

void startlex(char *s);
token_t lex(char *word);
