1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
package com.stevesoft.pat; |
9 |
|
|
10 |
|
import java.util.Hashtable; |
11 |
|
|
12 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
13 |
|
class BadRangeArgs extends RegSyntax |
14 |
|
{ |
15 |
|
}; |
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
@see |
22 |
|
@see |
23 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 16 |
Complexity Density: 0.57 |
|
24 |
|
class Range extends Pattern |
25 |
|
{ |
26 |
|
char lo, hi, altlo, althi; |
27 |
|
|
28 |
|
boolean printBrackets = false; |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
30 |
0 |
public String toString()... |
31 |
|
{ |
32 |
0 |
String s = protect("" + lo, PROTECT_THESE, ESC) + "-" |
33 |
|
+ protect("" + hi, PROTECT_THESE, ESC); |
34 |
0 |
if (!printBrackets) |
35 |
|
{ |
36 |
0 |
return s; |
37 |
|
} |
38 |
0 |
return "[" + s + "]"; |
39 |
|
} |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
41 |
0 |
Range(char loi, char hii) throws RegSyntax... |
42 |
|
{ |
43 |
0 |
lo = loi; |
44 |
0 |
hi = hii; |
45 |
0 |
oneChar o = null; |
46 |
0 |
if (lo >= hi) |
47 |
|
{ |
48 |
|
|
49 |
0 |
RegSyntaxError.endItAll("Badly formed []'s : " + lo + " >= " + hi); |
50 |
|
} |
51 |
0 |
o = new oneChar(lo); |
52 |
0 |
altlo = o.altc; |
53 |
0 |
o = new oneChar(hi); |
54 |
0 |
althi = o.altc; |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 8 |
Complexity Density: 1 |
|
57 |
0 |
public int matchInternal(int pos, Pthings pt)... |
58 |
|
{ |
59 |
0 |
if (pos >= pt.src.length()) |
60 |
|
{ |
61 |
0 |
return -1; |
62 |
|
} |
63 |
0 |
if (Masked(pos, pt)) |
64 |
|
{ |
65 |
0 |
return -1; |
66 |
|
} |
67 |
0 |
char c = pt.src.charAt(pos); |
68 |
0 |
if (lo <= c && c <= hi || (pt.ignoreCase && (altlo <= c && c <= althi))) |
69 |
|
{ |
70 |
0 |
return nextMatch(pos + 1, pt); |
71 |
|
} |
72 |
0 |
return -1; |
73 |
|
} |
74 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
75 |
0 |
public patInt minChars()... |
76 |
|
{ |
77 |
0 |
return new patInt(1); |
78 |
|
} |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0 |
public patInt maxChars()... |
81 |
|
{ |
82 |
0 |
return new patInt(1); |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
85 |
0 |
public Pattern clone1(Hashtable h)... |
86 |
|
{ |
87 |
0 |
try |
88 |
|
{ |
89 |
0 |
Range r = new Range(lo, hi); |
90 |
0 |
r.printBrackets = printBrackets; |
91 |
0 |
return r; |
92 |
|
} catch (RegSyntax rs) |
93 |
|
{ |
94 |
0 |
return null; |
95 |
|
} |
96 |
|
} |
97 |
|
}; |