Tokenizer.h 906 B

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