lexical.h 1.2 KB

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