lexical.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef VIRTUALMATH_LEXICAL_H
  2. #define VIRTUALMATH_LEXICAL_H
  3. #include "__macro.h"
  4. #include "stdio.h"
  5. typedef struct LexFile{
  6. FILE *file;
  7. struct {
  8. bool is_back;
  9. char p;
  10. } back;
  11. } LexFile;
  12. typedef struct LexMather{
  13. int len;
  14. int string_type;
  15. char *str;
  16. char *second_str;
  17. enum {
  18. LEXMATHER_START=1,
  19. LEXMATHER_ING,
  20. LEXMATHER_INGPOINT,
  21. LEXMATHER_INGSECOND,
  22. LEXMATHER_PASS,
  23. LEXMATHER_END,
  24. LEXMATHER_END_SECOND,
  25. LEXMATHER_MISTAKE,
  26. } status;
  27. } LexMather;
  28. typedef struct LexMathers{
  29. int size;
  30. struct LexMather **mathers;
  31. } LexMathers;
  32. char readChar(LexFile *file);
  33. void backChar(LexFile *file);
  34. LexFile *makeLexFile(char *dir);
  35. void freeLexFile(LexFile *file, bool self);
  36. void setupMather(LexMather *mather);
  37. LexMather *makeMather();
  38. void freeMather(LexMather *mather, bool self);
  39. LexMathers *makeMathers(int size);
  40. void freeMathers(LexMathers *mathers, bool self);
  41. void setupMathers(LexMathers *mathers);
  42. int checkoutMather(LexMathers *mathers, int max);
  43. #endif //VIRTUALMATH_LEXICAL_H