@@ -46,7 +46,8 @@ public static Pattern parse(final byte[] regex, final byte[] mod, final boolean
final InputInfo ii) throws QueryException {
// process modifiers
int m = Pattern.UNIX_LINES;
boolean strip = false, dotAll = false, multi = false;
boolean strip = false;
final boolean dotAll = false, multi = false;
if(mod != null) {
for(final byte b : mod) {
if(b == 'i') m |= CASE_INSENSITIVE | UNICODE_CASE;
@@ -106,7 +107,7 @@ final public RegExp regExp() throws ParseException {
brs = new RegExp[] { nd };
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case OR:
;
break;
@@ -135,7 +136,7 @@ final public RegExp branch() throws ParseException {
Quantifier qu = null;
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case NPAR_OPEN:
case PAR_OPEN:
case CHAR:
@@ -155,7 +156,7 @@ final public RegExp branch() throws ParseException {
break label_2;
}
atom = atom();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case Q_MARK:
case STAR:
case PLUS:
@@ -183,7 +184,7 @@ final public Quantifier quantifier() throws ParseException {
int min = 0, max = 0;
boolean lazy = false;
int[] qu = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case Q_MARK:
jj_consume_token(Q_MARK);
max = 1;
@@ -207,7 +208,7 @@ final public Quantifier quantifier() throws ParseException {
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case Q_MARK:
jj_consume_token(Q_MARK);
lazy = true;
@@ -230,11 +231,11 @@ final public int[] quantity() throws ParseException {
final int[] qty = new int[2];
jj_consume_token(NUMBER);
qty[0] = qty[1] = (Integer) token.getValue();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case COMMA:
jj_consume_token(COMMA);
qty[1] = -1;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case NUMBER:
jj_consume_token(NUMBER);
qty[1] = (Integer) token.getValue();
@@ -259,7 +260,7 @@ final public int[] quantity() throws ParseException {
*/
final public RegExp atom() throws ParseException {
RegExp nd = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case CHAR:
case DIGIT:
nd = Char();
@@ -303,7 +304,7 @@ final public RegExp atom() throws ParseException {
* Parses the "Char" rule.
*/
final public Literal Char() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case CHAR:
jj_consume_token(CHAR);
break;
@@ -328,7 +329,7 @@ final public BackRef backReference() throws ParseException {
backref = token.image.charAt(1) - '0';
label_3:
while (true) {
if (jj_2_1(1) && (10 * backref + token.next.image.charAt(0) - '0' <= groups)) {
if (jj_2_1(1) && 10 * backref + token.next.image.charAt(0) - '0' <= groups) {
;
} else {
break label_3;
@@ -347,7 +348,7 @@ final public BackRef backReference() throws ParseException {
*/
final public RegExp charClass() throws ParseException {
RegExp nd = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case SINGLE_ESC:
case MULTI_ESC:
case CAT_ESC:
@@ -381,7 +382,7 @@ final public RegExp charClass() throws ParseException {
* Parses the "charClassEsc" rule.
*/
final public RegExp charClassEsc() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case SINGLE_ESC:
jj_consume_token(SINGLE_ESC);
break;
@@ -410,7 +411,7 @@ final public CharClass charClassExpr() throws ParseException {
CharGroup group = null;
CharClass sub = null;
jj_consume_token(BR_OPEN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case NEG:
jj_consume_token(NEG);
group = posCharGroup();
@@ -425,7 +426,7 @@ final public CharClass charClassExpr() throws ParseException {
throw new ParseException();
}
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case TO:
jj_consume_token(TO);
sub = charClassExpr();
@@ -451,11 +452,11 @@ final public CharGroup posCharGroup() throws ParseException {
sub = charRange();
cg.add(sub);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case SINGLE_ESC:
case MULTI_ESC:
case CAT_ESC:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case SINGLE_ESC:
jj_consume_token(SINGLE_ESC);
break;
@@ -500,7 +501,7 @@ final public RegExp charRange() throws ParseException {
if(a > b) {if (true) throw new ParseException("Illegal range, " +
"lower > upper bound: " + Literal.escape(a) + "-" + Literal.escape(b));}
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case CHAR:
case DIGIT:
a = XmlChar();
@@ -520,7 +521,7 @@ final public RegExp charRange() throws ParseException {
*/
final public int charOrEsc() throws ParseException {
int cp = -1;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case CHAR:
case DIGIT:
cp = XmlChar();
@@ -539,7 +540,7 @@ final public int charOrEsc() throws ParseException {
}

final public int XmlChar() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
case CHAR:
jj_consume_token(CHAR);
break;
@@ -555,31 +556,31 @@ final public int XmlChar() throws ParseException {
throw new Error("Missing return statement in function");
}

private boolean jj_2_1(int xla) {
private boolean jj_2_1(final int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
catch(final LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
}

private boolean jj_2_2(int xla) {
private boolean jj_2_2(final int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_2(); }
catch(LookaheadSuccess ls) { return true; }
catch(final LookaheadSuccess ls) { return true; }
finally { jj_save(1, xla); }
}

private boolean jj_2_3(int xla) {
private boolean jj_2_3(final int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_3(); }
catch(LookaheadSuccess ls) { return true; }
catch(final LookaheadSuccess ls) { return true; }
finally { jj_save(2, xla); }
}

private boolean jj_2_4(int xla) {
private boolean jj_2_4(final int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_4(); }
catch(LookaheadSuccess ls) { return true; }
catch(final LookaheadSuccess ls) { return true; }
finally { jj_save(3, xla); }
}

@@ -713,7 +714,7 @@ private static void jj_la1_init_0() {


/** Constructor with user supplied Token Manager. */
public RegExParser(TokenManager tm) {
public RegExParser(final TokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
@@ -723,7 +724,7 @@ public RegExParser(TokenManager tm) {
}

/** Reinitialise. */
public void ReInit(TokenManager tm) {
public void ReInit(final TokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
@@ -732,7 +733,7 @@ public void ReInit(TokenManager tm) {
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}

private Token jj_consume_token(int kind) throws ParseException {
private Token jj_consume_token(final int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
@@ -741,8 +742,8 @@ private Token jj_consume_token(int kind) throws ParseException {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
for (int i = 0; i < jj_2_rtns.length; i++) {
JJCalls c = jj_2_rtns[i];
for(final JJCalls jj_2_rtn : jj_2_rtns) {
JJCalls c = jj_2_rtn;
while (c != null) {
if (c.gen < jj_gen) c.first = null;
c = c.next;
@@ -758,7 +759,7 @@ private Token jj_consume_token(int kind) throws ParseException {

static private final class LookaheadSuccess extends java.lang.Error { }
final private LookaheadSuccess jj_ls = new LookaheadSuccess();
private boolean jj_scan_token(int kind) {
private boolean jj_scan_token(final int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
@@ -790,7 +791,7 @@ final public Token getNextToken() {
}

/** Get the specific Token. */
final public Token getToken(int index) {
final public Token getToken(final int index) {
Token t = jj_lookingAhead ? jj_scanpos : token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
@@ -801,18 +802,18 @@ final public Token getToken(int index) {

private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
return jj_ntk = (token.next=token_source.getNextToken()).kind;
else
return (jj_ntk = jj_nt.kind);
return jj_ntk = jj_nt.kind;
}

private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private final java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
private final int[] jj_lasttokens = new int[100];
private int jj_endpos;

private void jj_add_error_token(int kind, int pos) {
private void jj_add_error_token(final int kind, final int pos) {
if (pos >= 100) return;
if (pos == jj_endpos + 1) {
jj_lasttokens[jj_endpos++] = kind;
@@ -821,8 +822,8 @@ private void jj_add_error_token(int kind, int pos) {
for (int i = 0; i < jj_endpos; i++) {
jj_expentry[i] = jj_lasttokens[i];
}
jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
int[] oldentry = (int[])(it.next());
jj_entries_loop: for(final Object name : jj_expentries) {
final int[] oldentry = (int[])name;
if (oldentry.length == jj_expentry.length) {
for (int i = 0; i < jj_expentry.length; i++) {
if (oldentry[i] != jj_expentry[i]) {
@@ -840,15 +841,15 @@ private void jj_add_error_token(int kind, int pos) {
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[25];
final boolean[] la1tokens = new boolean[25];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 18; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
if ((jj_la1_0[i] & 1<<j) != 0) {
la1tokens[j] = true;
}
}
@@ -864,7 +865,7 @@ public ParseException generateParseException() {
jj_endpos = 0;
jj_rescan_token();
jj_add_error_token(0, 0);
int[][] exptokseq = new int[jj_expentries.size()][];
final int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = jj_expentries.get(i);
}
@@ -896,12 +897,12 @@ private void jj_rescan_token() {
}
p = p.next;
} while (p != null);
} catch(LookaheadSuccess ls) { }
} catch(final LookaheadSuccess ls) { }
}
jj_rescan = false;
}

private void jj_save(int index, int xla) {
private void jj_save(final int index, final int xla) {
JJCalls p = jj_2_rtns[index];
while (p.gen > jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }
@@ -49,7 +49,7 @@ public class TokenMgrError extends Error {
* @return escaped string
*/
protected static final String addEscapes(final String str) {
StringBuffer retval = new StringBuffer();
final StringBuilder retval = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
@@ -81,7 +81,7 @@ protected static final String addEscapes(final String str) {
continue;
default:
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
String s = "0000" + Integer.toString(ch, 16);
final String s = "0000" + Integer.toString(ch, 16);
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
} else {
retval.append(ch);
@@ -108,7 +108,7 @@ protected static final String addEscapes(final String str) {
protected static String lexicalError(final boolean eof, final int state, final int line,
final int col, final String after, final char curr) {
return "Lexical error at line " + line + ", column " + col + ". Encountered: " +
(eof ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curr)) + "\"") +
(eof ? "<EOF> " : "\"" + addEscapes(String.valueOf(curr)) + "\"" +
" (" + (int) curr + "), ") + "after : \"" + addEscapes(after) + "\"";
}