if (escapeNode != null) {
String escape = escapeNode.getText();
if (escape.length() != 1) {
String msg = "escape must be a single character";
throw new SelectorException(escapeNode.getContext(), msg);
}
char esc = escape.charAt(0);
for (int i = 0; i < pattern.length(); ++i) {
char ch = pattern.charAt(i);
if (pattern.charAt(i) == esc) {
if (++i >= pattern.length()) {
String msg = "invalid pattern: no character "
+ "following last escape character";
throw new SelectorException(patternNode.getContext(),
msg);
}
}
}
}