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