Tokenizer.h 649 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef TOKENIZER_H
  2. #define TOKENIZER_H
  3. #include <stdbool.h>
  4. typedef enum Token {
  5. T_INT,
  6. T_FLOAT,
  7. T_NULL,
  8. T_TRUE,
  9. T_FALSE,
  10. T_ADD,
  11. T_MUL,
  12. T_SET,
  13. T_LITERAL,
  14. T_PRINT,
  15. T_SEMICOLON,
  16. T_OPEN_BRACKET,
  17. T_CLOSE_BRACKET,
  18. T_END
  19. } Token;
  20. typedef int16_t int16;
  21. bool tTokenize(const char* path);
  22. const char* tGetError();
  23. void tResetReader();
  24. Token tPeekToken();
  25. Token tReadToken();
  26. bool tReadInt(int* i);
  27. bool tReadInt16(int16* i);
  28. bool tReadFloat(float* f);
  29. const char* tReadString();
  30. int tGetMarker();
  31. void tResetToMarker(int marker);
  32. const char* tGetTokenName(Token token);
  33. void tPrint();
  34. #endif