Tokenizer.h 800 B

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