Tokenizer.h 1009 B

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