lexical.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 LexFileBack{
  8. bool is_back;
  9. signed char p;
  10. } back;
  11. int count;
  12. } LexFile;
  13. typedef struct LexMather{
  14. int len;
  15. signed char string_type;
  16. char *str;
  17. char *second_str;
  18. enum LexMatherStatus{
  19. LEXMATHER_START=1,
  20. LEXMATHER_ING,
  21. LEXMATHER_INGPOINT,
  22. LEXMATHER_INGSECOND,
  23. LEXMATHER_INGPASS,
  24. LEXMATHER_END,
  25. LEXMATHER_END_SECOND,
  26. LEXMATHER_MISTAKE,
  27. } status;
  28. } LexMather;
  29. typedef struct LexMathers{
  30. int size;
  31. struct LexMather **mathers;
  32. } LexMathers;
  33. signed char readChar(LexFile *file);
  34. void backChar(LexFile *file);
  35. LexFile *makeLexFile(char *dir);
  36. void freeLexFile(LexFile *file, bool self);
  37. void setupMather(LexMather *mather);
  38. LexMather *makeMather();
  39. void freeMather(LexMather *mather, bool self);
  40. LexMathers *makeMathers(int size);
  41. void freeMathers(LexMathers *mathers, bool self);
  42. void setupMathers(LexMathers *mathers);
  43. int checkoutMather(LexMathers *mathers, int max, FILE *debug);
  44. #endif //VIRTUALMATH_LEXICAL_H