File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java | |||
Method name: int matchString(Context, Op, int, int, int)
|
Method name: int matchCharacterIterator(Context, Op, int, int, int)
|
|||
Number of AST nodes: 315 | Number of AST nodes: 315 | |||
1 | String target = con.strTarget;↵ | 1 | CharacterIterator target = con.ciTarget;↵ | |
2 | while (true) {↵ | 2 | while (true) {↵ | |
3 | if (op == null)↵ | 3 | if (op == null)↵ | |
4 | return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;↵ | 4 | return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;↵ | |
5 | if (offset > con.limit || offset < con.start)↵ | 5 | if (offset > con.limit || offset < con.start)↵ | |
6 | return -1;↵ | 6 | return -1;↵ | |
7 | switch (op.type) {↵ | 7 | switch (op.type) {↵ | |
8 | case Op.CHAR:↵ | 8 | case Op.CHAR:↵ | |
9 | if (isSet(opts, IGNORE_CASE)) {↵ | 9 | if (isSet(opts, IGNORE_CASE)) {↵ | |
10 | int ch = op.getData();↵ | 10 | int ch = op.getData();↵ | |
11 | if (dx > 0) {↵ | 11 | if (dx > 0) {↵ | |
12 | if (offset >= con.limit || !matchIgnoreCase(ch, target .charAt( offset ) ))↵ | 12 | if (offset >= con.limit || !matchIgnoreCase(ch, target .setIndex( offset ) ))↵ | |
13 | return -1;↵ | 13 | return -1;↵ | |
14 | offset ++;↵ | 14 | offset ++;↵ | |
15 | } else {↵ | 15 | } else {↵ | |
16 | int o1 = offset-1;↵ | 16 | int o1 = offset-1;↵ | |
17 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .charAt( o1 ) ))↵ | 17 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .setIndex( o1 ) ))↵ | |
18 | return -1;↵ | 18 | return -1;↵ | |
19 | offset = o1;↵ | 19 | offset = o1;↵ | |
20 | }↵ | 20 | }↵ | |
21 | } else {↵ | 21 | } else {↵ | |
22 | int ch = op.getData();↵ | 22 | int ch = op.getData();↵ | |
23 | if (dx > 0) {↵ | 23 | if (dx > 0) {↵ | |
24 | if (offset >= con.limit || ch != target .charAt( offset ) )↵ | 24 | if (offset >= con.limit || ch != target .setIndex( offset ) )↵ | |
25 | return -1;↵ | 25 | return -1;↵ | |
26 | offset ++;↵ | 26 | offset ++;↵ | |
27 | } else {↵ | 27 | } else {↵ | |
28 | int o1 = offset-1;↵ | 28 | int o1 = offset-1;↵ | |
29 | if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) )↵ | 29 | if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) )↵ | |
30 | return -1;↵ | 30 | return -1;↵ | |
31 | offset = o1;↵ | 31 | offset = o1;↵ | |
32 | }↵ | 32 | }↵ | |
33 | }↵ | 33 | }↵ | |
34 | op = op.next;↵ | 34 | op = op.next;↵ | |
35 | break;↵ | 35 | break;↵ | |
36 | case Op.DOT:↵ | 36 | case Op.DOT:↵ | |
37 | if (dx > 0) {↵ | 37 | if (dx > 0) {↵ | |
38 | if (offset >= con.limit)↵ | 38 | if (offset >= con.limit)↵ | |
39 | return -1;↵ | 39 | return -1;↵ | |
40 | int ch = target .charAt( offset ) ;↵ | 40 | int ch = target .setIndex( offset ) ;↵ | |
41 | if (isSet(opts, SINGLE_LINE)) {↵ | 41 | if (isSet(opts, SINGLE_LINE)) {↵ | |
42 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | 42 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | |
43 | offset ++;↵ | 43 | offset ++;↵ | |
44 | } else {↵ | 44 | } else {↵ | |
45 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | 45 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | |
46 | ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) );↵ | 46 | ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) );↵ | |
47 | if (isEOLChar(ch))↵ | 47 | if (isEOLChar(ch))↵ | |
48 | return -1;↵ | 48 | return -1;↵ | |
49 | }↵ | 49 | }↵ | |
50 | offset ++;↵ | 50 | offset ++;↵ | |
51 | } else {↵ | 51 | } else {↵ | |
52 | int o1 = offset-1;↵ | 52 | int o1 = offset-1;↵ | |
53 | if (o1 >= con.limit || o1 < 0)↵ | 53 | if (o1 >= con.limit || o1 < 0)↵ | |
54 | return -1;↵ | 54 | return -1;↵ | |
55 | int ch = target .charAt( o1 ) ;↵ | 55 | int ch = target .setIndex( o1 ) ;↵ | |
56 | if (isSet(opts, SINGLE_LINE)) {↵ | 56 | if (isSet(opts, SINGLE_LINE)) {↵ | |
57 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | 57 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | |
58 | o1 --;↵ | 58 | o1 --;↵ | |
59 | } else {↵ | 59 | } else {↵ | |
60 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | 60 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | |
61 | ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch);↵ | 61 | ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch);↵ | |
62 | if (!isEOLChar(ch))↵ | 62 | if (!isEOLChar(ch))↵ | |
63 | return -1;↵ | 63 | return -1;↵ | |
64 | }↵ | 64 | }↵ | |
65 | offset = o1;↵ | 65 | offset = o1;↵ | |
66 | }↵ | 66 | }↵ | |
67 | op = op.next;↵ | 67 | op = op.next;↵ | |
68 | break;↵ | 68 | break;↵ | |
69 | case Op.RANGE:↵ | 69 | case Op.RANGE:↵ | |
70 | case Op.NRANGE:↵ | 70 | case Op.NRANGE:↵ | |
71 | if (dx > 0) {↵ | 71 | if (dx > 0) {↵ | |
72 | if (offset >= con.limit)↵ | 72 | if (offset >= con.limit)↵ | |
73 | return -1;↵ | 73 | return -1;↵ | |
74 | int ch = target .charAt( offset ) ;↵ | 74 | int ch = target .setIndex( offset ) ;↵ | |
75 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | 75 | if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)↵ | |
76 | ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) );↵ | 76 | ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) );↵ | |
77 | RangeToken tok = op.getToken();↵ | 77 | RangeToken tok = op.getToken();↵ | |
78 | if (isSet(opts, IGNORE_CASE)) {↵ | 78 | if (isSet(opts, IGNORE_CASE)) {↵ | |
79 | tok = tok.getCaseInsensitiveToken();↵ | 79 | tok = tok.getCaseInsensitiveToken();↵ | |
80 | if (!tok.match(ch)) {↵ | 80 | if (!tok.match(ch)) {↵ | |
81 | if (ch >= 0x10000) return -1;↵ | 81 | if (ch >= 0x10000) return -1;↵ | |
82 | char uch;↵ | 82 | char uch;↵ | |
83 | if (!tok.match(uch = Character.toUpperCase((char)ch))↵ | 83 | if (!tok.match(uch = Character.toUpperCase((char)ch))↵ | |
84 | && !tok.match(Character.toLowerCase(uch)))↵ | 84 | && !tok.match(Character.toLowerCase(uch)))↵ | |
85 | return -1;↵ | 85 | return -1;↵ | |
86 | }↵ | 86 | }↵ | |
87 | } else {↵ | 87 | } else {↵ | |
88 | if (!tok.match(ch)) return -1;↵ | 88 | if (!tok.match(ch)) return -1;↵ | |
89 | }↵ | 89 | }↵ | |
90 | offset ++;↵ | 90 | offset ++;↵ | |
91 | } else {↵ | 91 | } else {↵ | |
92 | int o1 = offset-1;↵ | 92 | int o1 = offset-1;↵ | |
93 | if (o1 >= con.limit || o1 < 0)↵ | 93 | if (o1 >= con.limit || o1 < 0)↵ | |
94 | return -1;↵ | 94 | return -1;↵ | |
95 | int ch = target .charAt( o1 ) ;↵ | 95 | int ch = target .setIndex( o1 ) ;↵ | |
96 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | 96 | if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)↵ | |
97 | ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch);↵ | 97 | ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch);↵ | |
98 | RangeToken tok = op.getToken();↵ | 98 | RangeToken tok = op.getToken();↵ | |
99 | if (isSet(opts, IGNORE_CASE)) {↵ | 99 | if (isSet(opts, IGNORE_CASE)) {↵ | |
100 | tok = tok.getCaseInsensitiveToken();↵ | 100 | tok = tok.getCaseInsensitiveToken();↵ | |
101 | if (!tok.match(ch)) {↵ | 101 | if (!tok.match(ch)) {↵ | |
102 | if (ch >= 0x10000) return -1;↵ | 102 | if (ch >= 0x10000) return -1;↵ | |
103 | char uch;↵ | 103 | char uch;↵ | |
104 | if (!tok.match(uch = Character.toUpperCase((char)ch))↵ | 104 | if (!tok.match(uch = Character.toUpperCase((char)ch))↵ | |
105 | && !tok.match(Character.toLowerCase(uch)))↵ | 105 | && !tok.match(Character.toLowerCase(uch)))↵ | |
106 | return -1;↵ | 106 | return -1;↵ | |
107 | }↵ | 107 | }↵ | |
108 | } else {↵ | 108 | } else {↵ | |
109 | if (!tok.match(ch)) return -1;↵ | 109 | if (!tok.match(ch)) return -1;↵ | |
110 | }↵ | 110 | }↵ | |
111 | offset = o1;↵ | 111 | offset = o1;↵ | |
112 | }↵ | 112 | }↵ | |
113 | op = op.next;↵ | 113 | op = op.next;↵ | |
114 | break;↵ | 114 | break;↵ | |
115 | case Op.ANCHOR:↵ | 115 | case Op.ANCHOR:↵ | |
116 | boolean go = false;↵ | 116 | boolean go = false;↵ | |
117 | switch (op.getData()) {↵ | 117 | switch (op.getData()) {↵ | |
118 | case '^':↵ | 118 | case '^':↵ | |
119 | if (isSet(opts, MULTIPLE_LINES)) {↵ | 119 | if (isSet(opts, MULTIPLE_LINES)) {↵ | |
120 | if (!(offset == con.start↵ | 120 | if (!(offset == con.start↵ | |
121 | || offset > con.start && isEOLChar( target .charAt( offset-1 ) )))↵ | 121 | || offset > con.start && isEOLChar( target .setIndex( offset-1 ) )))↵ | |
122 | return -1;↵ | 122 | return -1;↵ | |
123 | } else {↵ | 123 | } else {↵ | |
124 | if (offset != con.start)↵ | 124 | if (offset != con.start)↵ | |
125 | return -1;↵ | 125 | return -1;↵ | |
126 | }↵ | 126 | }↵ | |
127 | break;↵ | 127 | break;↵ | |
128 | case '@': // Internal use only.↵ | 128 | case '@': // Internal use only.↵ | |
129 | // The @ always matches line beginnings.↵ | 129 | // The @ always matches line beginnings.↵ | |
130 | if (!(offset == con.start↵ | 130 | if (!(offset == con.start↵ | |
131 | || offset > con.start && isEOLChar( target .charAt( offset-1 ) )))↵ | 131 | || offset > con.start && isEOLChar( target .setIndex( offset-1 ) )))↵ | |
132 | return -1;↵ | 132 | return -1;↵ | |
133 | break;↵ | 133 | break;↵ | |
134 | case '$':↵ | 134 | case '$':↵ | |
135 | if (isSet(opts, MULTIPLE_LINES)) {↵ | 135 | if (isSet(opts, MULTIPLE_LINES)) {↵ | |
136 | if (!(offset == con.limit↵ | 136 | if (!(offset == con.limit↵ | |
137 | || offset < con.limit && isEOLChar( target .charAt( offset ) )))↵ | 137 | || offset < con.limit && isEOLChar( target .setIndex( offset ) )))↵ | |
138 | return -1;↵ | 138 | return -1;↵ | |
139 | } else {↵ | 139 | } else {↵ | |
140 | if (!(offset == con.limit↵ | 140 | if (!(offset == con.limit↵ | |
141 | || offset+1 == con.limit && isEOLChar( target .charAt( offset ) )↵ | 141 | || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) )↵ | |
142 | || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN↵ | 142 | || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN↵ | |
143 | && target .charAt( offset+1 ) == LINE_FEED))↵ | 143 | && target .setIndex( offset+1 ) == LINE_FEED))↵ | |
144 | return -1;↵ | 144 | return -1;↵ | |
145 | }↵ | 145 | }↵ | |
146 | break;↵ | 146 | break;↵ | |
147 | case 'A':↵ | 147 | case 'A':↵ | |
148 | if (offset != con.start) return -1;↵ | 148 | if (offset != con.start) return -1;↵ | |
149 | break;↵ | 149 | break;↵ | |
150 | case 'Z':↵ | 150 | case 'Z':↵ | |
151 | if (!(offset == con.limit↵ | 151 | if (!(offset == con.limit↵ | |
152 | || offset+1 == con.limit && isEOLChar( target .charAt( offset ) )↵ | 152 | || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) )↵ | |
153 | || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN↵ | 153 | || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN↵ | |
154 | && target .charAt( offset+1 ) == LINE_FEED))↵ | 154 | && target .setIndex( offset+1 ) == LINE_FEED))↵ | |
155 | return -1;↵ | 155 | return -1;↵ | |
156 | break;↵ | 156 | break;↵ | |
157 | case 'z':↵ | 157 | case 'z':↵ | |
158 | if (offset != con.limit) return -1;↵ | 158 | if (offset != con.limit) return -1;↵ | |
159 | break;↵ | 159 | break;↵ | |
160 | case 'b':↵ | 160 | case 'b':↵ | |
161 | if (con.length == 0) return -1;↵ | 161 | if (con.length == 0) return -1;↵ | |
162 | {↵ | 162 | {↵ | |
163 | int after = getWordType(target, con.start, con.limit, offset, opts);↵ | 163 | int after = getWordType(target, con.start, con.limit, offset, opts);↵ | |
164 | if (after == WT_IGNORE) return -1;↵ | 164 | if (after == WT_IGNORE) return -1;↵ | |
165 | int before = getPreviousWordType(target, con.start, con.limit, offset, opts);↵ | 165 | int before = getPreviousWordType(target, con.start, con.limit, offset, opts);↵ | |
166 | if (after == before) return -1;↵ | 166 | if (after == before) return -1;↵ | |
167 | }↵ | 167 | }↵ | |
168 | break;↵ | 168 | break;↵ | |
169 | case 'B':↵ | 169 | case 'B':↵ | |
170 | if (con.length == 0)↵ | 170 | if (con.length == 0)↵ | |
171 | go = true;↵ | 171 | go = true;↵ | |
172 | else {↵ | 172 | else {↵ | |
173 | int after = getWordType(target, con.start, con.limit, offset, opts);↵ | 173 | int after = getWordType(target, con.start, con.limit, offset, opts);↵ | |
174 | go = after == WT_IGNORE↵ | 174 | go = after == WT_IGNORE↵ | |
175 | || after == getPreviousWordType(target, con.start, con.limit, offset, opts);↵ | 175 | || after == getPreviousWordType(target, con.start, con.limit, offset, opts);↵ | |
176 | }↵ | 176 | }↵ | |
177 | if (!go) return -1;↵ | 177 | if (!go) return -1;↵ | |
178 | break;↵ | 178 | break;↵ | |
179 | case '<':↵ | 179 | case '<':↵ | |
180 | if (con.length == 0 || offset == con.limit) return -1;↵ | 180 | if (con.length == 0 || offset == con.limit) return -1;↵ | |
181 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER↵ | 181 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER↵ | |
182 | || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)↵ | 182 | || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)↵ | |
183 | return -1;↵ | 183 | return -1;↵ | |
184 | break;↵ | 184 | break;↵ | |
185 | case '>':↵ | 185 | case '>':↵ | |
186 | if (con.length == 0 || offset == con.start) return -1;↵ | 186 | if (con.length == 0 || offset == con.start) return -1;↵ | |
187 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER↵ | 187 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER↵ | |
188 | || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)↵ | 188 | || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)↵ | |
189 | return -1;↵ | 189 | return -1;↵ | |
190 | break;↵ | 190 | break;↵ | |
191 | } // switch anchor type↵ | 191 | } // switch anchor type↵ | |
192 | op = op.next;↵ | 192 | op = op.next;↵ | |
193 | break;↵ | 193 | break;↵ | |
194 | case Op.BACKREFERENCE:↵ | 194 | case Op.BACKREFERENCE:↵ | |
195 | {↵ | 195 | {↵ | |
196 | int refno = op.getData();↵ | 196 | int refno = op.getData();↵ | |
197 | if (refno <= 0 || refno >= this.nofparen)↵ | 197 | if (refno <= 0 || refno >= this.nofparen)↵ | |
198 | throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);↵ | 198 | throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);↵ | |
199 | if (con.match.getBeginning(refno) < 0↵ | 199 | if (con.match.getBeginning(refno) < 0↵ | |
200 | || con.match.getEnd(refno) < 0)↵ | 200 | || con.match.getEnd(refno) < 0)↵ | |
201 | return -1; // ********↵ | 201 | return -1; // ********↵ | |
202 | int o2 = con.match.getBeginning(refno);↵ | 202 | int o2 = con.match.getBeginning(refno);↵ | |
203 | int literallen = con.match.getEnd(refno)-o2;↵ | 203 | int literallen = con.match.getEnd(refno)-o2;↵ | |
204 | if (!isSet(opts, IGNORE_CASE)) {↵ | 204 | if (!isSet(opts, IGNORE_CASE)) {↵ | |
205 | if (dx > 0) {↵ | 205 | if (dx > 0) {↵ | |
206 | if (!regionMatches(target, offset, con.limit, o2, literallen))↵ | 206 | if (!regionMatches(target, offset, con.limit, o2, literallen))↵ | |
207 | return -1;↵ | 207 | return -1;↵ | |
208 | offset += literallen;↵ | 208 | offset += literallen;↵ | |
209 | } else {↵ | 209 | } else {↵ | |
210 | if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))↵ | 210 | if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))↵ | |
211 | return -1;↵ | 211 | return -1;↵ | |
212 | offset -= literallen;↵ | 212 | offset -= literallen;↵ | |
213 | }↵ | 213 | }↵ | |
214 | } else {↵ | 214 | } else {↵ | |
215 | if (dx > 0) {↵ | 215 | if (dx > 0) {↵ | |
216 | if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))↵ | 216 | if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))↵ | |
217 | return -1;↵ | 217 | return -1;↵ | |
218 | offset += literallen;↵ | 218 | offset += literallen;↵ | |
219 | } else {↵ | 219 | } else {↵ | |
220 | if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,↵ | 220 | if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,↵ | |
221 | o2, literallen))↵ | 221 | o2, literallen))↵ | |
222 | return -1;↵ | 222 | return -1;↵ | |
223 | offset -= literallen;↵ | 223 | offset -= literallen;↵ | |
224 | }↵ | 224 | }↵ | |
225 | }↵ | 225 | }↵ | |
226 | }↵ | 226 | }↵ | |
227 | op = op.next;↵ | 227 | op = op.next;↵ | |
228 | break;↵ | 228 | break;↵ | |
229 | case Op.STRING:↵ | 229 | case Op.STRING:↵ | |
230 | {↵ | 230 | {↵ | |
231 | String literal = op.getString();↵ | 231 | String literal = op.getString();↵ | |
232 | int literallen = literal.length();↵ | 232 | int literallen = literal.length();↵ | |
233 | if (!isSet(opts, IGNORE_CASE)) {↵ | 233 | if (!isSet(opts, IGNORE_CASE)) {↵ | |
234 | if (dx > 0) {↵ | 234 | if (dx > 0) {↵ | |
235 | if (!regionMatches(target, offset, con.limit, literal, literallen))↵ | 235 | if (!regionMatches(target, offset, con.limit, literal, literallen))↵ | |
236 | return -1;↵ | 236 | return -1;↵ | |
237 | offset += literallen;↵ | 237 | offset += literallen;↵ | |
238 | } else {↵ | 238 | } else {↵ | |
239 | if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))↵ | 239 | if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))↵ | |
240 | return -1;↵ | 240 | return -1;↵ | |
241 | offset -= literallen;↵ | 241 | offset -= literallen;↵ | |
242 | }↵ | 242 | }↵ | |
243 | } else {↵ | 243 | } else {↵ | |
244 | if (dx > 0) {↵ | 244 | if (dx > 0) {↵ | |
245 | if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))↵ | 245 | if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))↵ | |
246 | return -1;↵ | 246 | return -1;↵ | |
247 | offset += literallen;↵ | 247 | offset += literallen;↵ | |
248 | } else {↵ | 248 | } else {↵ | |
249 | if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,↵ | 249 | if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,↵ | |
250 | literal, literallen))↵ | 250 | literal, literallen))↵ | |
251 | return -1;↵ | 251 | return -1;↵ | |
252 | offset -= literallen;↵ | 252 | offset -= literallen;↵ | |
253 | }↵ | 253 | }↵ | |
254 | }↵ | 254 | }↵ | |
255 | }↵ | 255 | }↵ | |
256 | op = op.next;↵ | 256 | op = op.next;↵ | |
257 | break;↵ | 257 | break;↵ | |
258 | case Op.CLOSURE:↵ | 258 | case Op.CLOSURE:↵ | |
259 | {↵ | 259 | {↵ | |
260 | /*↵ | 260 | /*↵ | |
261 | * Saves current position to avoid↵ | 261 | * Saves current position to avoid↵ | |
262 | * zero-width repeats.↵ | 262 | * zero-width repeats.↵ | |
263 | */↵ | 263 | */↵ | |
264 | int id = op.getData();↵ | 264 | int id = op.getData();↵ | |
265 | if (id >= 0) {↵ | 265 | if (id >= 0) {↵ | |
266 | int previousOffset = con.offsets[id];↵ | 266 | int previousOffset = con.offsets[id];↵ | |
267 | if (previousOffset < 0 || previousOffset != offset) {↵ | 267 | if (previousOffset < 0 || previousOffset != offset) {↵ | |
268 | con.offsets[id] = offset;↵ | 268 | con.offsets[id] = offset;↵ | |
269 | } else {↵ | 269 | } else {↵ | |
270 | con.offsets[id] = -1;↵ | 270 | con.offsets[id] = -1;↵ | |
271 | op = op.next;↵ | 271 | op = op.next;↵ | |
272 | break;↵ | 272 | break;↵ | |
273 | }↵ | 273 | }↵ | |
274 | }↵ | 274 | }↵ | |
275 | ↵ | |||
275 | int ret = this. matchString (con, op.getChild(), offset, dx, opts);↵ | 276 | int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);↵ | |
276 | if (id >= 0) con.offsets[id] = -1;↵ | 277 | if (id >= 0) con.offsets[id] = -1;↵ | |
277 | if (ret >= 0) return ret;↵ | 278 | if (ret >= 0) return ret;↵ | |
278 | op = op.next;↵ | 279 | op = op.next;↵ | |
279 | }↵ | 280 | }↵ | |
280 | break;↵ | 281 | break;↵ | |
281 | case Op.QUESTION:↵ | 282 | case Op.QUESTION:↵ | |
282 | {↵ | 283 | {↵ | |
283 | int ret = this. matchString (con, op.getChild(), offset, dx, opts);↵ | 284 | int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);↵ | |
284 | if (ret >= 0) return ret;↵ | 285 | if (ret >= 0) return ret;↵ | |
285 | op = op.next;↵ | 286 | op = op.next;↵ | |
286 | }↵ | 287 | }↵ | |
287 | break;↵ | 288 | break;↵ | |
288 | case Op.NONGREEDYCLOSURE:↵ | 289 | case Op.NONGREEDYCLOSURE:↵ | |
289 | case Op.NONGREEDYQUESTION:↵ | 290 | case Op.NONGREEDYQUESTION:↵ | |
290 | {↵ | 291 | {↵ | |
291 | int ret = this. matchString (con, op.next, offset, dx, opts);↵ | 292 | int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);↵ | |
292 | if (ret >= 0) return ret;↵ | 293 | if (ret >= 0) return ret;↵ | |
293 | op = op.getChild();↵ | 294 | op = op.getChild();↵ | |
294 | }↵ | 295 | }↵ | |
295 | break;↵ | 296 | break;↵ | |
296 | case Op.UNION:↵ | 297 | case Op.UNION:↵ | |
297 | for (int i = 0; i < op.size(); i ++) {↵ | 298 | for (int i = 0; i < op.size(); i ++) {↵ | |
298 | int ret = this. matchString (con, op.elementAt(i), offset, dx, opts);↵ | 299 | int ret = this. matchCharacterIterator (con, op.elementAt(i), offset, dx, opts);↵ | |
299 | if (DEBUG) {↵ | 300 | if (DEBUG) {↵ | |
300 | System.err.println("UNION: "+i+", ret="+ret);↵ | 301 | System.err.println("UNION: "+i+", ret="+ret);↵ | |
301 | }↵ | 302 | }↵ | |
302 | if (ret >= 0) return ret;↵ | 303 | if (ret >= 0) return ret;↵ | |
303 | }↵ | 304 | }↵ | |
304 | return -1;↵ | 305 | return -1;↵ | |
305 | case Op.CAPTURE:↵ | 306 | case Op.CAPTURE:↵ | |
306 | int refno = op.getData();↵ | 307 | int refno = op.getData();↵ | |
307 | if (con.match != null && refno > 0) {↵ | 308 | if (con.match != null && refno > 0) {↵ | |
308 | int save = con.match.getBeginning(refno);↵ | 309 | int save = con.match.getBeginning(refno);↵ | |
309 | con.match.setBeginning(refno, offset);↵ | 310 | con.match.setBeginning(refno, offset);↵ | |
310 | int ret = this. matchString (con, op.next, offset, dx, opts);↵ | 311 | int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);↵ | |
311 | if (ret < 0) con.match.setBeginning(refno, save);↵ | 312 | if (ret < 0) con.match.setBeginning(refno, save);↵ | |
312 | return ret;↵ | 313 | return ret;↵ | |
313 | } else if (con.match != null && refno < 0) {↵ | 314 | } else if (con.match != null && refno < 0) {↵ | |
314 | int index = -refno;↵ | 315 | int index = -refno;↵ | |
315 | int save = con.match.getEnd(index);↵ | 316 | int save = con.match.getEnd(index);↵ | |
316 | con.match.setEnd(index, offset);↵ | 317 | con.match.setEnd(index, offset);↵ | |
317 | int ret = this. matchString (con, op.next, offset, dx, opts);↵ | 318 | int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);↵ | |
318 | if (ret < 0) con.match.setEnd(index, save);↵ | 319 | if (ret < 0) con.match.setEnd(index, save);↵ | |
319 | return ret;↵ | 320 | return ret;↵ | |
320 | }↵ | 321 | }↵ | |
321 | op = op.next;↵ | 322 | op = op.next;↵ | |
322 | break;↵ | 323 | break;↵ | |
323 | case Op.LOOKAHEAD:↵ | 324 | case Op.LOOKAHEAD:↵ | |
324 | if (0 > this. matchString (con, op.getChild(), offset, 1, opts)) return -1;↵ | 325 | if (0 > this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1;↵ | |
325 | op = op.next;↵ | 326 | op = op.next;↵ | |
326 | break;↵ | 327 | break;↵ | |
327 | case Op.NEGATIVELOOKAHEAD:↵ | 328 | case Op.NEGATIVELOOKAHEAD:↵ | |
328 | if (0 <= this. matchString (con, op.getChild(), offset, 1, opts)) return -1;↵ | 329 | if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1;↵ | |
329 | op = op.next;↵ | 330 | op = op.next;↵ | |
330 | break;↵ | 331 | break;↵ | |
331 | case Op.LOOKBEHIND:↵ | 332 | case Op.LOOKBEHIND:↵ | |
332 | if (0 > this. matchString (con, op.getChild(), offset, -1, opts)) return -1;↵ | 333 | if (0 > this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1;↵ | |
333 | op = op.next;↵ | 334 | op = op.next;↵ | |
334 | break;↵ | 335 | break;↵ | |
335 | case Op.NEGATIVELOOKBEHIND:↵ | 336 | case Op.NEGATIVELOOKBEHIND:↵ | |
336 | if (0 <= this. matchString (con, op.getChild(), offset, -1, opts)) return -1;↵ | 337 | if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1;↵ | |
337 | op = op.next;↵ | 338 | op = op.next;↵ | |
338 | break;↵ | 339 | break;↵ | |
339 | case Op.INDEPENDENT:↵ | 340 | case Op.INDEPENDENT:↵ | |
340 | {↵ | 341 | {↵ | |
341 | int ret = this. matchString (con, op.getChild(), offset, dx, opts);↵ | 342 | int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);↵ | |
342 | if (ret < 0) return ret;↵ | 343 | if (ret < 0) return ret;↵ | |
343 | offset = ret;↵ | 344 | offset = ret;↵ | |
344 | op = op.next;↵ | 345 | op = op.next;↵ | |
345 | }↵ | 346 | }↵ | |
346 | break;↵ | 347 | break;↵ | |
347 | case Op.MODIFIER:↵ | 348 | case Op.MODIFIER:↵ | |
348 | {↵ | 349 | {↵ | |
349 | int localopts = opts;↵ | 350 | int localopts = opts;↵ | |
350 | localopts |= op.getData();↵ | 351 | localopts |= op.getData();↵ | |
351 | localopts &= ~op.getData2();↵ | 352 | localopts &= ~op.getData2();↵ | |
352 | //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16));↵ | 353 | //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16));↵ | |
353 | int ret = this. matchString (con, op.getChild(), offset, dx, localopts);↵ | 354 | int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, localopts);↵ | |
354 | if (ret < 0) return ret;↵ | 355 | if (ret < 0) return ret;↵ | |
355 | offset = ret;↵ | 356 | offset = ret;↵ | |
356 | op = op.next;↵ | 357 | op = op.next;↵ | |
357 | }↵ | 358 | }↵ | |
358 | break;↵ | 359 | break;↵ | |
359 | case Op.CONDITION:↵ | 360 | case Op.CONDITION:↵ | |
360 | {↵ | 361 | {↵ | |
361 | Op.ConditionOp cop = (Op.ConditionOp)op;↵ | 362 | Op.ConditionOp cop = (Op.ConditionOp)op;↵ | |
362 | boolean matchp = false;↵ | 363 | boolean matchp = false;↵ | |
363 | if (cop.refNumber > 0) {↵ | 364 | if (cop.refNumber > 0) {↵ | |
364 | if (cop.refNumber >= this.nofparen)↵ | 365 | if (cop.refNumber >= this.nofparen)↵ | |
365 | throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);↵ | 366 | throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);↵ | |
366 | matchp = con.match.getBeginning(cop.refNumber) >= 0↵ | 367 | matchp = con.match.getBeginning(cop.refNumber) >= 0↵ | |
367 | && con.match.getEnd(cop.refNumber) >= 0;↵ | 368 | && con.match.getEnd(cop.refNumber) >= 0;↵ | |
368 | } else {↵ | 369 | } else {↵ | |
369 | matchp = 0 <= this. matchString (con, cop.condition, offset, dx, opts);↵ | 370 | matchp = 0 <= this. matchCharacterIterator (con, cop.condition, offset, dx, opts);↵ | |
370 | }↵ | 371 | }↵ | |
371 | if (matchp) {↵ | 372 | if (matchp) {↵ | |
372 | op = cop.yes;↵ | 373 | op = cop.yes;↵ | |
373 | } else if (cop.no != null) {↵ | 374 | } else if (cop.no != null) {↵ | |
374 | op = cop.no;↵ | 375 | op = cop.no;↵ | |
375 | } else {↵ | 376 | } else {↵ | |
376 | op = cop.next;↵ | 377 | op = cop.next;↵ | |
377 | }↵ | 378 | }↵ | |
378 | }↵ | 379 | }↵ | |
379 | break;↵ | 380 | break;↵ | |
380 | default:↵ | 381 | default:↵ | |
381 | throw new RuntimeException("Unknown operation type: "+op.type);↵ | 382 | throw new RuntimeException("Unknown operation type: "+op.type);↵ | |
382 | } // switch (op.type)↵ | 383 | } // switch (op.type)↵ | |
383 | } | 384 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 283.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 7257 |
Number of mapped statements | 314 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 4864.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | CharacterIterator target = con.ciTarget; | ||||||||||||||||||||||||||||||||||||
1 | String target = con.strTarget; | | ||||||||||||||||||||||||||||||||||||
2 | while (true) | 2 | while (true) | |||||||||||||||||||||||||||||||||||
3 | if (op == null) | 3 | if (op == null) | |||||||||||||||||||||||||||||||||||
4 | return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset; | 4 | return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset; | |||||||||||||||||||||||||||||||||||
5 | if (offset > con.limit || offset < con.start) | 5 | if (offset > con.limit || offset < con.start) | |||||||||||||||||||||||||||||||||||
6 | return -1; | 6 | return -1; | |||||||||||||||||||||||||||||||||||
7 | switch (op.type) | 7 | switch (op.type) | |||||||||||||||||||||||||||||||||||
8 | case Op.CHAR: | 8 | case Op.CHAR: | |||||||||||||||||||||||||||||||||||
9 | if (isSet(opts, IGNORE_CASE)) | 9 | if (isSet(opts, IGNORE_CASE)) | |||||||||||||||||||||||||||||||||||
10 | int ch = op.getData(); | 10 | int ch = op.getData(); | |||||||||||||||||||||||||||||||||||
11 | if (dx > 0) | 11 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
12 | if (offset >= con.limit || !matchIgnoreCase(ch, target.charAt(offset))) |
| 12 | if (offset >= con.limit || !matchIgnoreCase(ch, target.setIndex(offset))) | ||||||||||||||||||||||||||||||||||
13 | return -1; | 13 | return -1; | |||||||||||||||||||||||||||||||||||
14 | offset++; | 14 | offset++; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
15 | int o1 = offset - 1; | 15 | int o1 = offset - 1; | |||||||||||||||||||||||||||||||||||
16 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.charAt(o1))) |
| 16 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.setIndex(o1))) | ||||||||||||||||||||||||||||||||||
17 | return -1; | 17 | return -1; | |||||||||||||||||||||||||||||||||||
18 | offset = o1; | 18 | offset = o1; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
19 | int ch = op.getData(); | 19 | int ch = op.getData(); | |||||||||||||||||||||||||||||||||||
20 | if (dx > 0) | 20 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
21 | if (offset >= con.limit || ch != target.charAt(offset)) |
| 21 | if (offset >= con.limit || ch != target.setIndex(offset)) | ||||||||||||||||||||||||||||||||||
22 | return -1; | 22 | return -1; | |||||||||||||||||||||||||||||||||||
23 | offset++; | 23 | offset++; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
24 | int o1 = offset - 1; | 24 | int o1 = offset - 1; | |||||||||||||||||||||||||||||||||||
25 | if (o1 >= con.limit || o1 < 0 || ch != target.charAt(o1)) |
| 25 | if (o1 >= con.limit || o1 < 0 || ch != target.setIndex(o1)) | ||||||||||||||||||||||||||||||||||
26 | return -1; | 26 | return -1; | |||||||||||||||||||||||||||||||||||
27 | offset = o1; | 27 | offset = o1; | |||||||||||||||||||||||||||||||||||
28 | op = op.next; | 28 | op = op.next; | |||||||||||||||||||||||||||||||||||
29 | break; | 29 | break; | |||||||||||||||||||||||||||||||||||
30 | case Op.DOT: | 30 | case Op.DOT: | |||||||||||||||||||||||||||||||||||
31 | if (dx > 0) | 31 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
32 | if (offset >= con.limit) | 32 | if (offset >= con.limit) | |||||||||||||||||||||||||||||||||||
33 | return -1; | 33 | return -1; | |||||||||||||||||||||||||||||||||||
34 | int ch = target.charAt(offset); |
| 34 | int ch = target.setIndex(offset); | ||||||||||||||||||||||||||||||||||
35 | if (isSet(opts, SINGLE_LINE)) | 35 | if (isSet(opts, SINGLE_LINE)) | |||||||||||||||||||||||||||||||||||
36 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | 36 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | |||||||||||||||||||||||||||||||||||
37 | offset++; | 37 | offset++; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
38 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | 38 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | |||||||||||||||||||||||||||||||||||
39 | ch = REUtil.composeFromSurrogates(ch, target.charAt(++offset)); |
| 39 | ch = REUtil.composeFromSurrogates(ch, target.setIndex(++offset)); | ||||||||||||||||||||||||||||||||||
40 | if (isEOLChar(ch)) | 40 | if (isEOLChar(ch)) | |||||||||||||||||||||||||||||||||||
41 | return -1; | 41 | return -1; | |||||||||||||||||||||||||||||||||||
42 | offset++; | 42 | offset++; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
43 | int o1 = offset - 1; | 43 | int o1 = offset - 1; | |||||||||||||||||||||||||||||||||||
44 | if (o1 >= con.limit || o1 < 0) | 44 | if (o1 >= con.limit || o1 < 0) | |||||||||||||||||||||||||||||||||||
45 | return -1; | 45 | return -1; | |||||||||||||||||||||||||||||||||||
46 | int ch = target.charAt(o1); |
| 46 | int ch = target.setIndex(o1); | ||||||||||||||||||||||||||||||||||
47 | if (isSet(opts, SINGLE_LINE)) | 47 | if (isSet(opts, SINGLE_LINE)) | |||||||||||||||||||||||||||||||||||
48 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | 48 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | |||||||||||||||||||||||||||||||||||
49 | o1--; | 49 | o1--; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
50 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | 50 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | |||||||||||||||||||||||||||||||||||
51 | ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch); |
| 51 | ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch); | ||||||||||||||||||||||||||||||||||
52 | if (!isEOLChar(ch)) | 52 | if (!isEOLChar(ch)) | |||||||||||||||||||||||||||||||||||
53 | return -1; | 53 | return -1; | |||||||||||||||||||||||||||||||||||
54 | offset = o1; | 54 | offset = o1; | |||||||||||||||||||||||||||||||||||
55 | op = op.next; | 55 | op = op.next; | |||||||||||||||||||||||||||||||||||
56 | break; | 56 | break; | |||||||||||||||||||||||||||||||||||
57 | case Op.RANGE: | 57 | case Op.RANGE: | |||||||||||||||||||||||||||||||||||
58 | case Op.NRANGE: | 58 | case Op.NRANGE: | |||||||||||||||||||||||||||||||||||
59 | if (dx > 0) | 59 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
60 | if (offset >= con.limit) | 60 | if (offset >= con.limit) | |||||||||||||||||||||||||||||||||||
61 | return -1; | 61 | return -1; | |||||||||||||||||||||||||||||||||||
62 | int ch = target.charAt(offset); |
| 62 | int ch = target.setIndex(offset); | ||||||||||||||||||||||||||||||||||
63 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | 63 | if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) | |||||||||||||||||||||||||||||||||||
64 | ch = REUtil.composeFromSurrogates(ch, target.charAt(++offset)); |
| 64 | ch = REUtil.composeFromSurrogates(ch, target.setIndex(++offset)); | ||||||||||||||||||||||||||||||||||
65 | RangeToken tok = op.getToken(); | 65 | RangeToken tok = op.getToken(); | |||||||||||||||||||||||||||||||||||
66 | if (isSet(opts, IGNORE_CASE)) | 66 | if (isSet(opts, IGNORE_CASE)) | |||||||||||||||||||||||||||||||||||
67 | tok = tok.getCaseInsensitiveToken(); | 67 | tok = tok.getCaseInsensitiveToken(); | |||||||||||||||||||||||||||||||||||
68 | if (!tok.match(ch)) | 68 | if (!tok.match(ch)) | |||||||||||||||||||||||||||||||||||
69 | if (ch >= 0x10000) | 69 | if (ch >= 0x10000) | |||||||||||||||||||||||||||||||||||
70 | return -1; | 70 | return -1; | |||||||||||||||||||||||||||||||||||
71 | char uch; | 71 | char uch; | |||||||||||||||||||||||||||||||||||
72 | if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) | 72 | if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) | |||||||||||||||||||||||||||||||||||
73 | return -1; | 73 | return -1; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
74 | if (!tok.match(ch)) | 74 | if (!tok.match(ch)) | |||||||||||||||||||||||||||||||||||
75 | return -1; | 75 | return -1; | |||||||||||||||||||||||||||||||||||
76 | offset++; | 76 | offset++; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
77 | int o1 = offset - 1; | 77 | int o1 = offset - 1; | |||||||||||||||||||||||||||||||||||
78 | if (o1 >= con.limit || o1 < 0) | 78 | if (o1 >= con.limit || o1 < 0) | |||||||||||||||||||||||||||||||||||
79 | return -1; | 79 | return -1; | |||||||||||||||||||||||||||||||||||
80 | int ch = target.charAt(o1); |
| 80 | int ch = target.setIndex(o1); | ||||||||||||||||||||||||||||||||||
81 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | 81 | if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) | |||||||||||||||||||||||||||||||||||
82 | ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch); |
| 82 | ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch); | ||||||||||||||||||||||||||||||||||
83 | RangeToken tok = op.getToken(); | 83 | RangeToken tok = op.getToken(); | |||||||||||||||||||||||||||||||||||
84 | if (isSet(opts, IGNORE_CASE)) | 84 | if (isSet(opts, IGNORE_CASE)) | |||||||||||||||||||||||||||||||||||
85 | tok = tok.getCaseInsensitiveToken(); | 85 | tok = tok.getCaseInsensitiveToken(); | |||||||||||||||||||||||||||||||||||
86 | if (!tok.match(ch)) | 86 | if (!tok.match(ch)) | |||||||||||||||||||||||||||||||||||
87 | if (ch >= 0x10000) | 87 | if (ch >= 0x10000) | |||||||||||||||||||||||||||||||||||
88 | return -1; | 88 | return -1; | |||||||||||||||||||||||||||||||||||
89 | char uch; | 89 | char uch; | |||||||||||||||||||||||||||||||||||
90 | if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) | 90 | if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) | |||||||||||||||||||||||||||||||||||
91 | return -1; | 91 | return -1; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
92 | if (!tok.match(ch)) | 92 | if (!tok.match(ch)) | |||||||||||||||||||||||||||||||||||
93 | return -1; | 93 | return -1; | |||||||||||||||||||||||||||||||||||
94 | offset = o1; | 94 | offset = o1; | |||||||||||||||||||||||||||||||||||
95 | op = op.next; | 95 | op = op.next; | |||||||||||||||||||||||||||||||||||
96 | break; | 96 | break; | |||||||||||||||||||||||||||||||||||
97 | case Op.ANCHOR: | 97 | case Op.ANCHOR: | |||||||||||||||||||||||||||||||||||
98 | boolean go = false; | 98 | boolean go = false; | |||||||||||||||||||||||||||||||||||
99 | switch (op.getData()) | 99 | switch (op.getData()) | |||||||||||||||||||||||||||||||||||
100 | case '^': | 100 | case '^': | |||||||||||||||||||||||||||||||||||
101 | if (isSet(opts, MULTIPLE_LINES)) | 101 | if (isSet(opts, MULTIPLE_LINES)) | |||||||||||||||||||||||||||||||||||
102 | if (!(offset == con.start || offset > con.start && isEOLChar(target.charAt(offset - 1)))) |
| 102 | if (!(offset == con.start || offset > con.start && isEOLChar(target.setIndex(offset - 1)))) | ||||||||||||||||||||||||||||||||||
103 | return -1; | 103 | return -1; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
104 | if (offset != con.start) | 104 | if (offset != con.start) | |||||||||||||||||||||||||||||||||||
105 | return -1; | 105 | return -1; | |||||||||||||||||||||||||||||||||||
106 | break; | 106 | break; | |||||||||||||||||||||||||||||||||||
107 | case '@': | 107 | case '@': | |||||||||||||||||||||||||||||||||||
108 | if (!(offset == con.start || offset > con.start && isEOLChar(target.charAt(offset - 1)))) |
| 108 | if (!(offset == con.start || offset > con.start && isEOLChar(target.setIndex(offset - 1)))) | ||||||||||||||||||||||||||||||||||
109 | return -1; | 109 | return -1; | |||||||||||||||||||||||||||||||||||
110 | break; | 110 | break; | |||||||||||||||||||||||||||||||||||
111 | case '$': | 111 | case '$': | |||||||||||||||||||||||||||||||||||
112 | if (isSet(opts, MULTIPLE_LINES)) | 112 | if (isSet(opts, MULTIPLE_LINES)) | |||||||||||||||||||||||||||||||||||
113 | if (!(offset == con.limit || offset < con.limit && isEOLChar(target.charAt(offset)))) |
| 113 | if (!(offset == con.limit || offset < con.limit && isEOLChar(target.setIndex(offset)))) | ||||||||||||||||||||||||||||||||||
114 | return -1; | 114 | return -1; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
115 | if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.charAt(offset)) || offset + 2 == con.limit && target.charAt(offset) == CARRIAGE_RETURN && target.charAt(offset + 1) == LINE_FEED)) |
| 115 | if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.setIndex(offset)) || offset + 2 == con.limit && target.setIndex(offset) == CARRIAGE_RETURN && target.setIndex(offset + 1) == LINE_FEED)) | ||||||||||||||||||||||||||||||||||
116 | return -1; | 116 | return -1; | |||||||||||||||||||||||||||||||||||
117 | break; | 117 | break; | |||||||||||||||||||||||||||||||||||
118 | case 'A': | 118 | case 'A': | |||||||||||||||||||||||||||||||||||
119 | if (offset != con.start) | 119 | if (offset != con.start) | |||||||||||||||||||||||||||||||||||
120 | return -1; | 120 | return -1; | |||||||||||||||||||||||||||||||||||
121 | break; | 121 | break; | |||||||||||||||||||||||||||||||||||
122 | case 'Z': | 122 | case 'Z': | |||||||||||||||||||||||||||||||||||
123 | if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.charAt(offset)) || offset + 2 == con.limit && target.charAt(offset) == CARRIAGE_RETURN && target.charAt(offset + 1) == LINE_FEED)) |
| 123 | if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.setIndex(offset)) || offset + 2 == con.limit && target.setIndex(offset) == CARRIAGE_RETURN && target.setIndex(offset + 1) == LINE_FEED)) | ||||||||||||||||||||||||||||||||||
124 | return -1; | 124 | return -1; | |||||||||||||||||||||||||||||||||||
125 | break; | 125 | break; | |||||||||||||||||||||||||||||||||||
126 | case 'z': | 126 | case 'z': | |||||||||||||||||||||||||||||||||||
127 | if (offset != con.limit) | 127 | if (offset != con.limit) | |||||||||||||||||||||||||||||||||||
128 | return -1; | 128 | return -1; | |||||||||||||||||||||||||||||||||||
129 | break; | 129 | break; | |||||||||||||||||||||||||||||||||||
130 | case 'b': | 130 | case 'b': | |||||||||||||||||||||||||||||||||||
131 | if (con.length == 0) | 131 | if (con.length == 0) | |||||||||||||||||||||||||||||||||||
132 | return -1; | 132 | return -1; | |||||||||||||||||||||||||||||||||||
133 | int after = getWordType(target, con.start, con.limit, offset, opts); |
| 133 | int after = getWordType(target, con.start, con.limit, offset, opts); | ||||||||||||||||||||||||||||||||||
134 | if (after == WT_IGNORE) | 134 | if (after == WT_IGNORE) | |||||||||||||||||||||||||||||||||||
135 | return -1; | 135 | return -1; | |||||||||||||||||||||||||||||||||||
136 | int before = getPreviousWordType(target, con.start, con.limit, offset, opts); |
| 136 | int before = getPreviousWordType(target, con.start, con.limit, offset, opts); | ||||||||||||||||||||||||||||||||||
137 | if (after == before) | 137 | if (after == before) | |||||||||||||||||||||||||||||||||||
138 | return -1; | 138 | return -1; | |||||||||||||||||||||||||||||||||||
139 | break; | 139 | break; | |||||||||||||||||||||||||||||||||||
140 | case 'B': | 140 | case 'B': | |||||||||||||||||||||||||||||||||||
141 | if (con.length == 0) | 141 | if (con.length == 0) | |||||||||||||||||||||||||||||||||||
142 | go = true; | 142 | go = true; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
143 | int after = getWordType(target, con.start, con.limit, offset, opts); |
| 143 | int after = getWordType(target, con.start, con.limit, offset, opts); | ||||||||||||||||||||||||||||||||||
144 | go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts); |
| 144 | go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts); | ||||||||||||||||||||||||||||||||||
145 | if (!go) | 145 | if (!go) | |||||||||||||||||||||||||||||||||||
146 | return -1; | 146 | return -1; | |||||||||||||||||||||||||||||||||||
147 | break; | 147 | break; | |||||||||||||||||||||||||||||||||||
148 | case '<': | 148 | case '<': | |||||||||||||||||||||||||||||||||||
149 | if (con.length == 0 || offset == con.limit) | 149 | if (con.length == 0 || offset == con.limit) | |||||||||||||||||||||||||||||||||||
150 | return -1; | 150 | return -1; | |||||||||||||||||||||||||||||||||||
151 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) |
| 151 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) | ||||||||||||||||||||||||||||||||||
152 | return -1; | 152 | return -1; | |||||||||||||||||||||||||||||||||||
153 | break; | 153 | break; | |||||||||||||||||||||||||||||||||||
154 | case '>': | 154 | case '>': | |||||||||||||||||||||||||||||||||||
155 | if (con.length == 0 || offset == con.start) | 155 | if (con.length == 0 || offset == con.start) | |||||||||||||||||||||||||||||||||||
156 | return -1; | 156 | return -1; | |||||||||||||||||||||||||||||||||||
157 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) |
| 157 | if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) | ||||||||||||||||||||||||||||||||||
158 | return -1; | 158 | return -1; | |||||||||||||||||||||||||||||||||||
159 | break; | 159 | break; | |||||||||||||||||||||||||||||||||||
160 | op = op.next; | 160 | op = op.next; | |||||||||||||||||||||||||||||||||||
161 | break; | 161 | break; | |||||||||||||||||||||||||||||||||||
162 | case Op.BACKREFERENCE: | 162 | case Op.BACKREFERENCE: | |||||||||||||||||||||||||||||||||||
163 | int refno = op.getData(); | 163 | int refno = op.getData(); | |||||||||||||||||||||||||||||||||||
164 | if (refno <= 0 || refno >= this.nofparen) | 164 | if (refno <= 0 || refno >= this.nofparen) | |||||||||||||||||||||||||||||||||||
165 | throw new RuntimeException("Internal Error: Reference number must be more than zero: " + refno); | 165 | throw new RuntimeException("Internal Error: Reference number must be more than zero: " + refno); | |||||||||||||||||||||||||||||||||||
166 | if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) | 166 | if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) | |||||||||||||||||||||||||||||||||||
167 | return -1; | 167 | return -1; | |||||||||||||||||||||||||||||||||||
168 | int o2 = con.match.getBeginning(refno); | 168 | int o2 = con.match.getBeginning(refno); | |||||||||||||||||||||||||||||||||||
169 | int literallen = con.match.getEnd(refno) - o2; | 169 | int literallen = con.match.getEnd(refno) - o2; | |||||||||||||||||||||||||||||||||||
170 | if (!isSet(opts, IGNORE_CASE)) | 170 | if (!isSet(opts, IGNORE_CASE)) | |||||||||||||||||||||||||||||||||||
171 | if (dx > 0) | 171 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
172 | if (!regionMatches(target, offset, con.limit, o2, literallen)) |
| 172 | if (!regionMatches(target, offset, con.limit, o2, literallen)) | ||||||||||||||||||||||||||||||||||
173 | return -1; | 173 | return -1; | |||||||||||||||||||||||||||||||||||
174 | offset += literallen; | 174 | offset += literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
175 | if (!regionMatches(target, offset - literallen, con.limit, o2, literallen)) |
| 175 | if (!regionMatches(target, offset - literallen, con.limit, o2, literallen)) | ||||||||||||||||||||||||||||||||||
176 | return -1; | 176 | return -1; | |||||||||||||||||||||||||||||||||||
177 | offset -= literallen; | 177 | offset -= literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
178 | if (dx > 0) | 178 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
179 | if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) |
| 179 | if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) | ||||||||||||||||||||||||||||||||||
180 | return -1; | 180 | return -1; | |||||||||||||||||||||||||||||||||||
181 | offset += literallen; | 181 | offset += literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
182 | if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen)) |
| 182 | if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen)) | ||||||||||||||||||||||||||||||||||
183 | return -1; | 183 | return -1; | |||||||||||||||||||||||||||||||||||
184 | offset -= literallen; | 184 | offset -= literallen; | |||||||||||||||||||||||||||||||||||
185 | op = op.next; | 185 | op = op.next; | |||||||||||||||||||||||||||||||||||
186 | break; | 186 | break; | |||||||||||||||||||||||||||||||||||
187 | case Op.STRING: | 187 | case Op.STRING: | |||||||||||||||||||||||||||||||||||
188 | String literal = op.getString(); | 188 | String literal = op.getString(); | |||||||||||||||||||||||||||||||||||
189 | int literallen = literal.length(); | 189 | int literallen = literal.length(); | |||||||||||||||||||||||||||||||||||
190 | if (!isSet(opts, IGNORE_CASE)) | 190 | if (!isSet(opts, IGNORE_CASE)) | |||||||||||||||||||||||||||||||||||
191 | if (dx > 0) | 191 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
192 | if (!regionMatches(target, offset, con.limit, literal, literallen)) |
| 192 | if (!regionMatches(target, offset, con.limit, literal, literallen)) | ||||||||||||||||||||||||||||||||||
193 | return -1; | 193 | return -1; | |||||||||||||||||||||||||||||||||||
194 | offset += literallen; | 194 | offset += literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
195 | if (!regionMatches(target, offset - literallen, con.limit, literal, literallen)) |
| 195 | if (!regionMatches(target, offset - literallen, con.limit, literal, literallen)) | ||||||||||||||||||||||||||||||||||
196 | return -1; | 196 | return -1; | |||||||||||||||||||||||||||||||||||
197 | offset -= literallen; | 197 | offset -= literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
198 | if (dx > 0) | 198 | if (dx > 0) | |||||||||||||||||||||||||||||||||||
199 | if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) |
| 199 | if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) | ||||||||||||||||||||||||||||||||||
200 | return -1; | 200 | return -1; | |||||||||||||||||||||||||||||||||||
201 | offset += literallen; | 201 | offset += literallen; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
202 | if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen)) |
| 202 | if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen)) | ||||||||||||||||||||||||||||||||||
203 | return -1; | 203 | return -1; | |||||||||||||||||||||||||||||||||||
204 | offset -= literallen; | 204 | offset -= literallen; | |||||||||||||||||||||||||||||||||||
205 | op = op.next; | 205 | op = op.next; | |||||||||||||||||||||||||||||||||||
206 | break; | 206 | break; | |||||||||||||||||||||||||||||||||||
207 | case Op.CLOSURE: | 207 | case Op.CLOSURE: | |||||||||||||||||||||||||||||||||||
208 | int id = op.getData(); | 208 | int id = op.getData(); | |||||||||||||||||||||||||||||||||||
209 | if (id >= 0) | 209 | if (id >= 0) | |||||||||||||||||||||||||||||||||||
210 | int previousOffset = con.offsets[id]; | 210 | int previousOffset = con.offsets[id]; | |||||||||||||||||||||||||||||||||||
211 | if (previousOffset < 0 || previousOffset != offset) | 211 | if (previousOffset < 0 || previousOffset != offset) | |||||||||||||||||||||||||||||||||||
212 | con.offsets[id] = offset; | 212 | con.offsets[id] = offset; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
213 | con.offsets[id] = -1; | 213 | con.offsets[id] = -1; | |||||||||||||||||||||||||||||||||||
214 | op = op.next; | 214 | op = op.next; | |||||||||||||||||||||||||||||||||||
215 | break; | 215 | break; | |||||||||||||||||||||||||||||||||||
216 | int ret = this.matchString(con, op.getChild(), offset, dx, opts); |
| 216 | int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts); | ||||||||||||||||||||||||||||||||||
217 | if (id >= 0) | 217 | if (id >= 0) | |||||||||||||||||||||||||||||||||||
218 | con.offsets[id] = -1; | 218 | con.offsets[id] = -1; | |||||||||||||||||||||||||||||||||||
219 | if (ret >= 0) | 219 | if (ret >= 0) | |||||||||||||||||||||||||||||||||||
220 | return ret; | 220 | return ret; | |||||||||||||||||||||||||||||||||||
221 | op = op.next; | 221 | op = op.next; | |||||||||||||||||||||||||||||||||||
222 | break; | 222 | break; | |||||||||||||||||||||||||||||||||||
223 | case Op.QUESTION: | 223 | case Op.QUESTION: | |||||||||||||||||||||||||||||||||||
224 | int ret = this.matchString(con, op.getChild(), offset, dx, opts); |
| 224 | int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts); | ||||||||||||||||||||||||||||||||||
225 | if (ret >= 0) | 225 | if (ret >= 0) | |||||||||||||||||||||||||||||||||||
226 | return ret; | 226 | return ret; | |||||||||||||||||||||||||||||||||||
227 | op = op.next; | 227 | op = op.next; | |||||||||||||||||||||||||||||||||||
228 | break; | 228 | break; | |||||||||||||||||||||||||||||||||||
229 | case Op.NONGREEDYCLOSURE: | 229 | case Op.NONGREEDYCLOSURE: | |||||||||||||||||||||||||||||||||||
230 | case Op.NONGREEDYQUESTION: | 230 | case Op.NONGREEDYQUESTION: | |||||||||||||||||||||||||||||||||||
231 | int ret = this.matchString(con, op.next, offset, dx, opts); |
| 231 | int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts); | ||||||||||||||||||||||||||||||||||
232 | if (ret >= 0) | 232 | if (ret >= 0) | |||||||||||||||||||||||||||||||||||
233 | return ret; | 233 | return ret; | |||||||||||||||||||||||||||||||||||
234 | op = op.getChild(); | 234 | op = op.getChild(); | |||||||||||||||||||||||||||||||||||
235 | break; | 235 | break; | |||||||||||||||||||||||||||||||||||
236 | case Op.UNION: | 236 | case Op.UNION: | |||||||||||||||||||||||||||||||||||
237 | for (int i = 0; i < op.size(); i++) | 237 | for (int i = 0; i < op.size(); i++) | |||||||||||||||||||||||||||||||||||
238 | int ret = this.matchString(con, op.elementAt(i), offset, dx, opts); |
| 238 | int ret = this.matchCharacterIterator(con, op.elementAt(i), offset, dx, opts); | ||||||||||||||||||||||||||||||||||
239 | if (DEBUG) | 239 | if (DEBUG) | |||||||||||||||||||||||||||||||||||
240 | System.err.println("UNION: " + i + ", ret=" + ret); | 240 | System.err.println("UNION: " + i + ", ret=" + ret); | |||||||||||||||||||||||||||||||||||
241 | if (ret >= 0) | 241 | if (ret >= 0) | |||||||||||||||||||||||||||||||||||
242 | return ret; | 242 | return ret; | |||||||||||||||||||||||||||||||||||
243 | return -1; | 243 | return -1; | |||||||||||||||||||||||||||||||||||
244 | case Op.CAPTURE: | 244 | case Op.CAPTURE: | |||||||||||||||||||||||||||||||||||
245 | int refno = op.getData(); | 245 | int refno = op.getData(); | |||||||||||||||||||||||||||||||||||
246 | if (con.match != null && refno > 0) | 246 | if (con.match != null && refno > 0) | |||||||||||||||||||||||||||||||||||
247 | int save = con.match.getBeginning(refno); | 247 | int save = con.match.getBeginning(refno); | |||||||||||||||||||||||||||||||||||
248 | con.match.setBeginning(refno, offset); | 248 | con.match.setBeginning(refno, offset); | |||||||||||||||||||||||||||||||||||
249 | int ret = this.matchString(con, op.next, offset, dx, opts); |
| 249 | int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts); | ||||||||||||||||||||||||||||||||||
250 | if (ret < 0) | 250 | if (ret < 0) | |||||||||||||||||||||||||||||||||||
251 | con.match.setBeginning(refno, save); | 251 | con.match.setBeginning(refno, save); | |||||||||||||||||||||||||||||||||||
252 | return ret; | 252 | return ret; | |||||||||||||||||||||||||||||||||||
253 | else if (con.match != null && refno < 0) | 253 | else if (con.match != null && refno < 0) | |||||||||||||||||||||||||||||||||||
254 | int index = -refno; | 254 | int index = -refno; | |||||||||||||||||||||||||||||||||||
255 | int save = con.match.getEnd(index); | 255 | int save = con.match.getEnd(index); | |||||||||||||||||||||||||||||||||||
256 | con.match.setEnd(index, offset); | 256 | con.match.setEnd(index, offset); | |||||||||||||||||||||||||||||||||||
257 | int ret = this.matchString(con, op.next, offset, dx, opts); |
| 257 | int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts); | ||||||||||||||||||||||||||||||||||
258 | if (ret < 0) | 258 | if (ret < 0) | |||||||||||||||||||||||||||||||||||
259 | con.match.setEnd(index, save); | 259 | con.match.setEnd(index, save); | |||||||||||||||||||||||||||||||||||
260 | return ret; | 260 | return ret; | |||||||||||||||||||||||||||||||||||
261 | op = op.next; | 261 | op = op.next; | |||||||||||||||||||||||||||||||||||
262 | break; | 262 | break; | |||||||||||||||||||||||||||||||||||
263 | case Op.LOOKAHEAD: | 263 | case Op.LOOKAHEAD: | |||||||||||||||||||||||||||||||||||
264 | if (0 > this.matchString(con, op.getChild(), offset, 1, opts)) |
| 264 | if (0 > this.matchCharacterIterator(con, op.getChild(), offset, 1, opts)) | ||||||||||||||||||||||||||||||||||
265 | return -1; | 265 | return -1; | |||||||||||||||||||||||||||||||||||
266 | op = op.next; | 266 | op = op.next; | |||||||||||||||||||||||||||||||||||
267 | break; | 267 | break; | |||||||||||||||||||||||||||||||||||
268 | case Op.NEGATIVELOOKAHEAD: | 268 | case Op.NEGATIVELOOKAHEAD: | |||||||||||||||||||||||||||||||||||
269 | if (0 <= this.matchString(con, op.getChild(), offset, 1, opts)) |
| 269 | if (0 <= this.matchCharacterIterator(con, op.getChild(), offset, 1, opts)) | ||||||||||||||||||||||||||||||||||
270 | return -1; | 270 | return -1; | |||||||||||||||||||||||||||||||||||
271 | op = op.next; | 271 | op = op.next; | |||||||||||||||||||||||||||||||||||
272 | break; | 272 | break; | |||||||||||||||||||||||||||||||||||
273 | case Op.LOOKBEHIND: | 273 | case Op.LOOKBEHIND: | |||||||||||||||||||||||||||||||||||
274 | if (0 > this.matchString(con, op.getChild(), offset, -1, opts)) |
| 274 | if (0 > this.matchCharacterIterator(con, op.getChild(), offset, -1, opts)) | ||||||||||||||||||||||||||||||||||
275 | return -1; | 275 | return -1; | |||||||||||||||||||||||||||||||||||
276 | op = op.next; | 276 | op = op.next; | |||||||||||||||||||||||||||||||||||
277 | break; | 277 | break; | |||||||||||||||||||||||||||||||||||
278 | case Op.NEGATIVELOOKBEHIND: | 278 | case Op.NEGATIVELOOKBEHIND: | |||||||||||||||||||||||||||||||||||
279 | if (0 <= this.matchString(con, op.getChild(), offset, -1, opts)) |
| 279 | if (0 <= this.matchCharacterIterator(con, op.getChild(), offset, -1, opts)) | ||||||||||||||||||||||||||||||||||
280 | return -1; | 280 | return -1; | |||||||||||||||||||||||||||||||||||
281 | op = op.next; | 281 | op = op.next; | |||||||||||||||||||||||||||||||||||
282 | break; | 282 | break; | |||||||||||||||||||||||||||||||||||
283 | case Op.INDEPENDENT: | 283 | case Op.INDEPENDENT: | |||||||||||||||||||||||||||||||||||
284 | int ret = this.matchString(con, op.getChild(), offset, dx, opts); |
| 284 | int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts); | ||||||||||||||||||||||||||||||||||
285 | if (ret < 0) | 285 | if (ret < 0) | |||||||||||||||||||||||||||||||||||
286 | return ret; | 286 | return ret; | |||||||||||||||||||||||||||||||||||
287 | offset = ret; | 287 | offset = ret; | |||||||||||||||||||||||||||||||||||
288 | op = op.next; | 288 | op = op.next; | |||||||||||||||||||||||||||||||||||
289 | break; | 289 | break; | |||||||||||||||||||||||||||||||||||
290 | case Op.MODIFIER: | 290 | case Op.MODIFIER: | |||||||||||||||||||||||||||||||||||
291 | int localopts = opts; | 291 | int localopts = opts; | |||||||||||||||||||||||||||||||||||
292 | localopts |= op.getData(); | 292 | localopts |= op.getData(); | |||||||||||||||||||||||||||||||||||
293 | localopts &= ~op.getData2(); | 293 | localopts &= ~op.getData2(); | |||||||||||||||||||||||||||||||||||
294 | int ret = this.matchString(con, op.getChild(), offset, dx, localopts); |
| 294 | int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, localopts); | ||||||||||||||||||||||||||||||||||
295 | if (ret < 0) | 295 | if (ret < 0) | |||||||||||||||||||||||||||||||||||
296 | return ret; | 296 | return ret; | |||||||||||||||||||||||||||||||||||
297 | offset = ret; | 297 | offset = ret; | |||||||||||||||||||||||||||||||||||
298 | op = op.next; | 298 | op = op.next; | |||||||||||||||||||||||||||||||||||
299 | break; | 299 | break; | |||||||||||||||||||||||||||||||||||
300 | case Op.CONDITION: | 300 | case Op.CONDITION: | |||||||||||||||||||||||||||||||||||
301 | Op.ConditionOp cop = (Op.ConditionOp)op; | 301 | Op.ConditionOp cop = (Op.ConditionOp)op; | |||||||||||||||||||||||||||||||||||
302 | boolean matchp = false; | 302 | boolean matchp = false; | |||||||||||||||||||||||||||||||||||
303 | if (cop.refNumber > 0) | 303 | if (cop.refNumber > 0) | |||||||||||||||||||||||||||||||||||
304 | if (cop.refNumber >= this.nofparen) | 304 | if (cop.refNumber >= this.nofparen) | |||||||||||||||||||||||||||||||||||
305 | throw new RuntimeException("Internal Error: Reference number must be more than zero: " + cop.refNumber); | 305 | throw new RuntimeException("Internal Error: Reference number must be more than zero: " + cop.refNumber); | |||||||||||||||||||||||||||||||||||
306 | matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0; | 306 | matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
307 | matchp = 0 <= this.matchString(con, cop.condition, offset, dx, opts); |
| 307 | matchp = 0 <= this.matchCharacterIterator(con, cop.condition, offset, dx, opts); | ||||||||||||||||||||||||||||||||||
308 | if (matchp) | 308 | if (matchp) | |||||||||||||||||||||||||||||||||||
309 | op = cop.yes; | 309 | op = cop.yes; | |||||||||||||||||||||||||||||||||||
310 | else if (cop.no != null) | 310 | else if (cop.no != null) | |||||||||||||||||||||||||||||||||||
311 | op = cop.no; | 311 | op = cop.no; | |||||||||||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||||||||||
312 | op = cop.next; | 312 | op = cop.next; | |||||||||||||||||||||||||||||||||||
313 | break; | 313 | break; | |||||||||||||||||||||||||||||||||||
314 | default: | 314 | default: | |||||||||||||||||||||||||||||||||||
315 | throw new RuntimeException("Unknown operation type: " + op.type); | 315 | throw new RuntimeException("Unknown operation type: " + op.type); |
Row | Violation |
---|---|
1 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
4 | Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
7 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
10 | Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
13 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
16 | Expression target.charAt(++offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression target.setIndex(++offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
19 | Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
22 | Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Expression target.setIndex(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
25 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
26 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
27 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
28 | Expression target.charAt(++offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
29 | Expression target.setIndex(++offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
30 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
31 | Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
32 | Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
33 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
34 | Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
35 | Expression target.setIndex(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
37 | Expression target.charAt(offset - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
38 | Expression target.setIndex(offset - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
39 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
40 | Expression target.charAt(offset - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
41 | Expression target.setIndex(offset - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
42 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
43 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
44 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
45 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
46 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
47 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
48 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
49 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
50 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
51 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
52 | Expression target.charAt(offset + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
53 | Expression target.setIndex(offset + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
54 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
55 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
56 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
57 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
58 | Expression target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
59 | Expression target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
60 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
61 | Expression target.charAt(offset + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
62 | Expression target.setIndex(offset + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
63 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
64 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
65 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
66 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
67 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
68 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
69 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
70 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
71 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
72 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
73 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
74 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
75 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
76 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
77 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
78 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
79 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
80 | Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
81 | Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
82 | Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
83 | Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
84 | Expression this.matchString(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
85 | Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
86 | Expression this.matchString(con,op.elementAt(i),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
87 | Expression this.matchCharacterIterator(con,op.elementAt(i),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
88 | Expression this.matchString(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
89 | Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
90 | Expression this.matchString(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
91 | Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
92 | Expression this.matchString(con,op.getChild(),offset,1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
93 | Expression this.matchCharacterIterator(con,op.getChild(),offset,1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
94 | Expression this.matchString(con,op.getChild(),offset,1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
95 | Expression this.matchCharacterIterator(con,op.getChild(),offset,1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
96 | Expression this.matchString(con,op.getChild(),offset,-1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
97 | Expression this.matchCharacterIterator(con,op.getChild(),offset,-1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
98 | Expression this.matchString(con,op.getChild(),offset,-1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
99 | Expression this.matchCharacterIterator(con,op.getChild(),offset,-1,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
100 | Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
101 | Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
102 | Expression this.matchString(con,op.getChild(),offset,dx,localopts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
103 | Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,localopts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
104 | Expression this.matchString(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
105 | Expression this.matchCharacterIterator(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted |