Tokenizer.h 895 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_LESS_EQUAL,
  16. T_GREATER,
  17. T_GREATER_EQUAL,
  18. T_EQUAL,
  19. T_NOT_EQUAL,
  20. T_NOT,
  21. T_SET,
  22. T_LITERAL,
  23. T_PRINT,
  24. T_IF,
  25. T_FUNCTION,
  26. T_RETURN,
  27. T_COMMA,
  28. T_SEMICOLON,
  29. T_OPEN_BRACKET,
  30. T_CLOSE_BRACKET,
  31. T_OPEN_CURVED_BRACKET,
  32. T_CLOSE_CURVED_BRACKET,
  33. T_END
  34. } Token;
  35. typedef int16_t int16;
  36. bool tTokenize(const char* path);
  37. const char* tGetError();
  38. void tResetReader();
  39. Token tPeekToken();
  40. Token tReadToken();
  41. bool tReadInt(int* i);
  42. bool tReadInt16(int16* i);
  43. bool tReadFloat(float* f);
  44. const char* tReadString();
  45. int tGetMarker();
  46. void tResetToMarker(int marker);
  47. const char* tGetTokenName(Token token);
  48. void tPrint();
  49. #endif