Tokenizer.h 753 B

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