wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

regcomp.h (1994B)


      1 /*
      2  *  substitution list
      3  */
      4 
      5 #define NSUBEXP 32
      6 typedef struct Resublist	Resublist;
      7 struct	Resublist
      8 {
      9 	Resub	m[NSUBEXP];
     10 };
     11 
     12 /* max character classes per program */
     13 extern Reprog	RePrOg;
     14 #define	NCLASS	(sizeof(RePrOg.class)/sizeof(Reclass))
     15 
     16 /* max rune ranges per character class */
     17 #define NCCRUNE	(sizeof(Reclass)/sizeof(Rune))
     18 
     19 /*
     20  * Actions and Tokens (Reinst types)
     21  *
     22  *	02xx are operators, value == precedence
     23  *	03xx are tokens, i.e. operands for operators
     24  */
     25 #define RUNE		0177
     26 #define	OPERATOR	0200	/* Bitmask of all operators */
     27 #define	START		0200	/* Start, used for marker on stack */
     28 #define	RBRA		0201	/* Right bracket, ) */
     29 #define	LBRA		0202	/* Left bracket, ( */
     30 #define	OR		0203	/* Alternation, | */
     31 #define	CAT		0204	/* Concatentation, implicit operator */
     32 #define	STAR		0205	/* Closure, * */
     33 #define	PLUS		0206	/* a+ == aa* */
     34 #define	QUEST		0207	/* a? == a|nothing, i.e. 0 or 1 a's */
     35 #define	ANY		0300	/* Any character except newline, . */
     36 #define	ANYNL		0301	/* Any character including newline, . */
     37 #define	NOP		0302	/* No operation, internal use only */
     38 #define	BOL		0303	/* Beginning of line, ^ */
     39 #define	EOL		0304	/* End of line, $ */
     40 #define	CCLASS		0305	/* Character class, [] */
     41 #define	NCCLASS		0306	/* Negated character class, [] */
     42 #define	END		0377	/* Terminate: match found */
     43 
     44 /*
     45  *  regexec execution lists
     46  */
     47 #define LISTSIZE	10
     48 #define BIGLISTSIZE	(10*LISTSIZE)
     49 typedef struct Relist	Relist;
     50 struct Relist
     51 {
     52 	Reinst*		inst;		/* Reinstruction of the thread */
     53 	Resublist	se;		/* matched subexpressions in this thread */
     54 };
     55 typedef struct Reljunk	Reljunk;
     56 struct	Reljunk
     57 {
     58 	Relist*	relist[2];
     59 	Relist*	reliste[2];
     60 	int	starttype;
     61 	Rune	startchar;
     62 	char*	starts;
     63 	char*	eol;
     64 	Rune*	rstarts;
     65 	Rune*	reol;
     66 };
     67 
     68 extern Relist*	_renewthread(Relist*, Reinst*, int, Resublist*);
     69 extern void	_renewmatch(Resub*, int, Resublist*);
     70 extern Relist*	_renewemptythread(Relist*, Reinst*, int, char*);
     71 extern Relist*	_rrenewemptythread(Relist*, Reinst*, int, Rune*);