Tokenizer.h 740 B

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