final RegExp parseRepeatExp() throws IllegalArgumentException { RegExp e = parseComplExp(); while (peek("?*+{")) { if (match('?')) e = makeOptional(e); else if (match('*')) e = makeRepeat(e); else if (match('+')) e = makeRepeat(e, 1); else if (match('{')) { int start = pos; while (peek("0123456789")) next(); if (start == pos) throw new IllegalArgumentException( "integer expected at position " + pos); int n = Integer.parseInt(originalString.substring(start, pos)); int m = -1; if (match(',')) { start = pos; while (peek("0123456789")) next(); if (start != pos) m = Integer.parseInt( originalString.substring(start, pos)); } else m = n; if (!match('}')) throw new IllegalArgumentException( "expected '}' at position " + pos); if (m == -1) e = makeRepeat(e, n); else e = makeRepeat(e, n, m); } } return e; }
final RegExp parseRepeatExp() throws IllegalArgumentException { RegExp e = parseComplExp(); while (peek("?*+{")) { if (match('?')) e = makeOptional(e); else if (match('*')) e = makeRepeat(e); else if (match('+')) e = makeRepeat(e, 1); else if (match('{')) { int start = pos; while (peek("0123456789")) next(); if (start == pos) throw new IllegalArgumentException( "integer expected at position " + pos); int n = Integer.parseInt(originalString.substring(start, pos)); int m = -1; if (match(',')) { start = pos; while (peek("0123456789")) next(); if (start != pos) m = Integer.parseInt( originalString.substring(start, pos)); } else m = n; if (!match('}')) throw new IllegalArgumentException( "expected '}' at position " + pos); if (m == -1) e = makeRepeat(e, n); else e = makeRepeat(e, n, m); } } return e; }
final RegExp parseRepeatExp() throws IllegalArgumentException { RegExp e = parseComplExp(); while (peek("?*+{")) { if (match('?')) e = makeOptional(e); else if (match('*')) e = makeRepeat(e); else if (match('+')) e = makeRepeat(e, 1); else if (match('{')) { int start = pos; while (peek("0123456789")) next(); if (start == pos) throw new IllegalArgumentException( "integer expected at position " + pos); int n = Integer.parseInt(originalString.substring(start, pos)); int m = -1; if (match(',')) { start = pos; while (peek("0123456789")) next(); if (start != pos) m = Integer.parseInt( originalString.substring(start, pos)); } else m = n; if (!match('}')) throw new IllegalArgumentException( "expected '}' at position " + pos); if (m == -1) e = makeRepeat(e, n); else e = makeRepeat(e, n, m); } } return e; }
final RegExp parseRepeatExp() throws IllegalArgumentException { RegExp e = parseComplExp(); while (peek("?*+{")) { if (match('?')) e = makeOptional(e); else if (match('*')) e = makeRepeat(e); else if (match('+')) e = makeRepeat(e, 1); else if (match('{')) { int start = pos; while (peek("0123456789")) next(); if (start == pos) throw new IllegalArgumentException( "integer expected at position " + pos); int n = Integer.parseInt(originalString.substring(start, pos)); int m = -1; if (match(',')) { start = pos; while (peek("0123456789")) next(); if (start != pos) m = Integer.parseInt( originalString.substring(start, pos)); } else m = n; if (!match('}')) throw new IllegalArgumentException( "expected '}' at position " + pos); if (m == -1) e = makeRepeat(e, n); else e = makeRepeat(e, n, m); } } return e; }