You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
654B

  1. #ifndef REGEX_H
  2. #define REGEX_H
  3. #include <stdbool.h>
  4. #include "vector.h"
  5. extern bool is_case_on;
  6. typedef struct {
  7. int accepting_state;
  8. char * str;
  9. vector_t delta_table; // <delta_t>
  10. vector_t catch_table; // <offshoot_t>
  11. } regex_t;
  12. typedef struct {
  13. int position;
  14. int width;
  15. } match_t;
  16. extern regex_t * regex_compile(const char * const pattern);
  17. extern int regex_free(regex_t * const regex);
  18. extern bool regex_search(const regex_t * const regex, const char * const string);
  19. extern match_t * regex_match(const regex_t * const regex, const char * const string, const bool start_of_string);
  20. extern bool is_magic(const char c);
  21. #endif