]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/stc/scintilla/include/PosRegExp.h
added missing return on error
[wxWidgets.git] / src / stc / scintilla / include / PosRegExp.h
... / ...
CommitLineData
1#ifndef POSREGEXP_H
2#define POSREGEXP_H
3
4#define MatchesNum 0x10
5
6enum EOps
7{
8 ReBlockOps = 0x1000,
9 ReMul, // *
10 RePlus, // +
11 ReQuest, // ?
12 ReNGMul, // *?
13 ReNGPlus, // +?
14 ReNGQuest, // ??
15 ReRangeN, // {n,}
16 ReRangeNM, // {n,m}
17 ReNGRangeN, // {n,}?
18 ReNGRangeNM, // {n,m}?
19 ReOr, // |
20 ReBehind = 0x1100, // ?#n
21 ReNBehind = 0x1200, // ?~n
22 ReAhead = 0x1300, // ?=
23 ReNAhead = 0x1400, // ?!
24
25 ReSymbolOps = 0x2000,
26 ReEmpty,
27 ReSymb, // a b \W \s ...
28 ReEnum, // []
29 ReNEnum, // [^]
30 ReBrackets, // (...)
31 ReBkTrace = 0x2100, // \yN
32 ReBkBrack = 0x2200 // \N
33};
34
35enum ESymbols
36{
37 ReAnyChr = 0x4000, // .
38 ReSoL, // ^
39 ReEoL, // $
40 ReDigit, // \d
41 ReNDigit, // \D
42 ReWordSymb, // \w
43 ReNWordSymb, // \W
44 ReWSpace, // \s
45 ReNWSpace, // \S
46 ReUCase, // \u
47 ReNUCase , // \l
48 ReWBound, // \b
49 ReNWBound, // \B
50 RePreNW, // \c
51 ReStart, // \m
52 ReEnd, // \M
53
54 ReChr = 0x0 // Char in Lower Byte
55};
56enum ETempSymb
57{
58 ReTemp = 0x7000,
59 ReLBrack, ReRBrack,
60 ReEnumS, ReEnumE, ReNEnumS,
61 ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
62};
63
64#define BackSlash '\\'
65
66typedef union SCharData
67{
68 int IArr[8];
69 char CArr[32];
70 void SetBit(unsigned char Bit);
71 void ClearBit(unsigned char Bit);
72 bool GetBit(unsigned char Bit);
73} *PCharData;
74
75typedef struct SRegInfo
76{
77 SRegInfo();
78 ~SRegInfo();
79
80 EOps Op;
81 union{
82 SRegInfo *Param;
83 int Symb;
84 PCharData ChrClass;
85 }un;
86 int s,e;
87 SRegInfo *Parent;
88 SRegInfo *Next;
89} *PRegInfo;
90
91typedef struct SMatches
92{
93 int s[MatchesNum];
94 int e[MatchesNum];
95 int CurMatch;
96} *PMatches;
97
98typedef class PosRegExp
99{
100 PRegInfo Info;
101 PMatches BkTrace;
102 bool NoCase,Extend,NoMoves;
103 bool Error;
104 int *Exprn;
105 int posParse;
106 int posEnd,posStart;
107 int posBkStr;
108 int FirstChar;
109
110 bool SetExprLow(const char *Expr);
111 bool SetStructs(PRegInfo &Info,int st,int end);
112 void Optimize();
113 bool CheckSymb(int Symb,bool Inc);
114 bool LowParse(PRegInfo Re);
115 bool LowParseRe(PRegInfo &Next);
116 bool LowCheckNext(PRegInfo Re);
117 bool ParseRe(int posStr);
118 bool QuickCheck();
119public:
120 PMatches Matches;
121 int Ok, CurMatch;
122
123 void *param;
124 char (*CharAt)(int pos, void *param);
125
126 PosRegExp();
127 ~PosRegExp();
128
129 bool isok();
130 bool SetNoMoves(bool Moves);
131 bool SetBkTrace(int posStr,PMatches Trace);
132 bool SetExpr(const char *Expr);
133 bool Parse(int posStr, int posStop, PMatches Mtch);
134 bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
135 bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
136} *PPosRegExp;
137
138#endif /* POSREGEXP_H */