MCPcopy Create free account
hub / github.com/google/re2j / PatternSyntaxException

Class PatternSyntaxException

java/com/google/re2j/PatternSyntaxException.java:14–58  ·  view source on GitHub ↗

An exception thrown by the parser if the pattern was invalid. Following java.util.regex.PatternSyntaxException, this is an unchecked exception.

Source from the content-addressed store, hash-verified

12 * Following {@code java.util.regex.PatternSyntaxException}, this is an unchecked exception.
13 */
14public class PatternSyntaxException extends RuntimeException {
15
16 private final String error; // the nature of the error
17 private final String input; // the partial input at the point of error.
18
19 public PatternSyntaxException(String error, String input) {
20 super("error parsing regexp: " + error + ": `" + input + "`");
21 this.error = error;
22 this.input = input;
23 }
24
25 public PatternSyntaxException(String error) {
26 super("error parsing regexp: " + error);
27 this.error = error;
28 this.input = "";
29 }
30
31 /**
32 * Retrieves the error index.
33 *
34 * @return The approximate index in the pattern of the error, or <tt>-1</tt> if the index is not
35 * known
36 */
37 public int getIndex() {
38 return -1;
39 }
40
41 /**
42 * Retrieves the description of the error.
43 *
44 * @return The description of the error
45 */
46 public String getDescription() {
47 return error;
48 }
49
50 /**
51 * Retrieves the erroneous regular-expression pattern.
52 *
53 * @return The erroneous pattern
54 */
55 public String getPattern() {
56 return input;
57 }
58}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…