/** * Constructs new <code>RegExp</code> from a string. * * @param s regexp string * @param syntax_flags boolean 'or' of optional syntax constructs to be * enabled * @exception IllegalArgumentException if an error occured while parsing the * regular expression */ public RegExp(String s, int syntax_flags) throws IllegalArgumentException { originalString = s; flags = syntax_flags; RegExp e; if (s.length() == 0) e = makeString(""); else { e = parseUnionExp(); if (pos < originalString.length()) throw new IllegalArgumentException( "end-of-string expected at position " + pos); } kind = e.kind; exp1 = e.exp1; exp2 = e.exp2; this.s = e.s; c = e.c; min = e.min; max = e.max; digits = e.digits; from = e.from; to = e.to; }
final RegExp parseUnionExp() throws IllegalArgumentException { RegExp e = parseInterExp(); if (match('|')) e = makeUnion(e, parseUnionExp()); return e; }
} else if (match('(')) { if (match(')')) return makeString(""); RegExp e = parseUnionExp(); if (!match(')')) throw new IllegalArgumentException( "expected ')' at position " + pos);
/** * Constructs new <code>RegExp</code> from a string. * * @param s regexp string * @param syntax_flags boolean 'or' of optional syntax constructs to be * enabled * @exception IllegalArgumentException if an error occured while parsing the * regular expression */ public RegExp(String s, int syntax_flags) throws IllegalArgumentException { originalString = s; flags = syntax_flags; RegExp e; if (s.length() == 0) e = makeString(""); else { e = parseUnionExp(); if (pos < originalString.length()) throw new IllegalArgumentException( "end-of-string expected at position " + pos); } kind = e.kind; exp1 = e.exp1; exp2 = e.exp2; this.s = e.s; c = e.c; min = e.min; max = e.max; digits = e.digits; from = e.from; to = e.to; }
/** * Constructs new <code>RegExp</code> from a string. * * @param s regexp string * @param syntax_flags boolean 'or' of optional syntax constructs to be * enabled * @exception IllegalArgumentException if an error occured while parsing the * regular expression */ public RegExp(String s, int syntax_flags) throws IllegalArgumentException { originalString = s; flags = syntax_flags; RegExp e; if (s.length() == 0) e = makeString(""); else { e = parseUnionExp(); if (pos < originalString.length()) throw new IllegalArgumentException( "end-of-string expected at position " + pos); } kind = e.kind; exp1 = e.exp1; exp2 = e.exp2; this.s = e.s; c = e.c; min = e.min; max = e.max; digits = e.digits; from = e.from; to = e.to; }
/** * Constructs new <code>RegExp</code> from a string. * * @param s regexp string * @param syntax_flags boolean 'or' of optional syntax constructs to be * enabled * @exception IllegalArgumentException if an error occured while parsing the * regular expression */ public RegExp(String s, int syntax_flags) throws IllegalArgumentException { originalString = s; flags = syntax_flags; RegExp e; if (s.length() == 0) e = makeString(""); else { e = parseUnionExp(); if (pos < originalString.length()) throw new IllegalArgumentException( "end-of-string expected at position " + pos); } kind = e.kind; exp1 = e.exp1; exp2 = e.exp2; this.s = e.s; c = e.c; min = e.min; max = e.max; digits = e.digits; from = e.from; to = e.to; }
final RegExp parseUnionExp() throws IllegalArgumentException { RegExp e = parseInterExp(); if (match('|')) e = makeUnion(e, parseUnionExp()); return e; }
final RegExp parseUnionExp() throws IllegalArgumentException { RegExp e = parseInterExp(); if (match('|')) e = makeUnion(e, parseUnionExp()); return e; }
final RegExp parseUnionExp() throws IllegalArgumentException { RegExp e = parseInterExp(); if (match('|')) e = makeUnion(e, parseUnionExp()); return e; }
} else if (match('(')) { if (match(')')) return makeString(""); RegExp e = parseUnionExp(); if (!match(')')) throw new IllegalArgumentException( "expected ')' at position " + pos);
} else if (match('(')) { if (match(')')) return makeString(""); RegExp e = parseUnionExp(); if (!match(')')) throw new IllegalArgumentException( "expected ')' at position " + pos);
} else if (match('(')) { if (match(')')) return makeString(""); RegExp e = parseUnionExp(); if (!match(')')) throw new IllegalArgumentException( "expected ')' at position " + pos);