Tokenizer.h 767 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_MUL,
  13. T_SET,
  14. T_LITERAL,
  15. T_PRINT,
  16. T_FUNCTION,
  17. T_RETURN,
  18. T_COMMA,
  19. T_SEMICOLON,
  20. T_OPEN_BRACKET,
  21. T_CLOSE_BRACKET,
  22. T_OPEN_CURVED_BRACKET,
  23. T_CLOSE_CURVED_BRACKET,
  24. T_END
  25. } Token;
  26. typedef int16_t int16;
  27. bool tTokenize(const char* path);
  28. const char* tGetError();
  29. void tResetReader();
  30. Token tPeekToken();
  31. Token tReadToken();
  32. bool tReadInt(int* i);
  33. bool tReadInt16(int16* i);
  34. bool tReadFloat(float* f);
  35. const char* tReadString();
  36. int tGetMarker();
  37. void tResetToMarker(int marker);
  38. const char* tGetTokenName(Token token);
  39. void tPrint();
  40. #endif