vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

text-regex.h

(721B)


      1 #ifndef TEXT_REGEX_H
      2 #define TEXT_REGEX_H
      3 
      4 /* make the REG_* constants available */
      5 #if CONFIG_TRE
      6 #include <tre/tre.h>
      7 #else
      8 #include <regex.h>
      9 #endif
     10 #include "text.h"
     11 
     12 #define MAX_REGEX_SUB 10
     13 
     14 typedef struct Regex Regex;
     15 typedef Filerange RegexMatch;
     16 
     17 Regex *text_regex_new(void);
     18 int text_regex_compile(Regex*, const char *pattern, int cflags);
     19 size_t text_regex_nsub(Regex*);
     20 void text_regex_free(Regex*);
     21 int text_regex_match(Regex*, const char *data, int eflags);
     22 int text_search_range_forward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags);
     23 int text_search_range_backward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags);
     24 
     25 #endif