Tokenizer.h 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_LITERAL,
  29. T_PRINT,
  30. T_IF,
  31. T_FUNCTION,
  32. T_RETURN,
  33. T_COMMA,
  34. T_SEMICOLON,
  35. T_OPEN_BRACKET,
  36. T_CLOSE_BRACKET,
  37. T_OPEN_CURVED_BRACKET,
  38. T_CLOSE_CURVED_BRACKET,
  39. T_END
  40. } Token;
  41. typedef int16_t int16;
  42. bool tTokenize(const char* path);
  43. const char* tGetError();
  44. void tResetReader();
  45. Token tPeekToken();
  46. Token tReadToken();
  47. bool tReadInt(int* i);
  48. bool tReadInt16(int16* i);
  49. bool tReadFloat(float* f);
  50. const char* tReadString();
  51. int tGetMarker();
  52. void tResetToMarker(int marker);
  53. const char* tGetTokenName(Token token);
  54. void tPrint();
  55. #endif