lexical.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. long int count;
  11. long int line;
  12. };
  13. 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. };
  29. struct LexMathers{
  30. int size;
  31. struct LexMather **mathers;
  32. };
  33. typedef struct LexFile LexFile;
  34. typedef struct LexMather LexMather;
  35. typedef struct LexMathers LexMathers;
  36. signed char readChar(LexFile *file);
  37. void backChar(LexFile *file);
  38. LexFile *makeLexFile(char *dir);
  39. void freeLexFile(LexFile *file, bool self);
  40. void setupMather(LexMather *mather);
  41. LexMather *makeMather();
  42. void freeMather(LexMather *mather, bool self);
  43. LexMathers *makeMathers(int size);
  44. void freeMathers(LexMathers *mathers, bool self);
  45. void setupMathers(LexMathers *mathers);
  46. int checkoutMather(LexMathers *mathers, int max, FILE *debug);
  47. #endif //VIRTUALMATH_LEXICAL_H