if ("{".equals(peek)) {
ptext += "{";
pos++;
} else {
if (!"".equals(ptext)) {
items.add(new XdmAtomicValue(ptext));
ptext = "";
}
state = XPATHMODE;
}
} else if ("}".equals(ch)) {
if ("}".equals(peek)) {
ptext += "}";
pos++;
} else {
throw XProcException.stepError(67);
}
} else {
ptext += ch;
}
break;
case XPATHMODE:
if ("{".equals(ch)) {
throw XProcException.stepError(67);
} else if ("'".equals(ch)) {
ptext += "'";
state = SQUOTEMODE;
} else if ("\"".equals(ch)) {
ptext += "\"";
state = DQUOTEMODE;
} else if ("}".equals(ch)) {
items.addAll(evaluateXPath(context, nsbindings, ptext, params));
ptext = "";
state = START;
} else {
ptext += ch;
}
break;
case SQUOTEMODE:
if ("'".equals(ch)) {
ptext += "'";
state = XPATHMODE;
} else {
ptext += ch;
}
break;
case DQUOTEMODE:
if (("\"").equals(ch)) {
ptext += "\"";
state = XPATHMODE;
} else {
ptext += ch;
}
break;
}
pos++;
}
if (state != START) {
throw XProcException.stepError(67);
}
if (!"".equals(ptext)) {
items.add(new XdmAtomicValue(ptext));
}
return items;
}