last = start;
len = avt.length();
while (last < len) {
i2 = avt.indexOf(terminator, last);
if (i2 < 0) {
throw new StaticError("Attribute constructor is not properly terminated");
}
i0 = avt.indexOf("{", last);
i1 = avt.indexOf("{{", last);
i8 = avt.indexOf("}", last);
i9 = avt.indexOf("}}", last);
if ((i0 < 0 || i2 < i0) && (i8 < 0 || i2 < i8)) { // found end of string
addStringComponent(components, avt, last, i2);
// look for doubled quotes, and skip them (for now)
if (i2+1 < avt.length() && avt.charAt(i2+1)==terminator) {
components.add(new StringValue(terminator + ""));
last = i2+2;
continue;
} else {
last = i2;
break;
}
} else if (i8 >= 0 && (i0 < 0 || i8 < i0)) { // found a "}"
if (i8 != i9) { // a "}" that isn't a "}}"
throw new StaticError(
"Closing curly brace in attribute value template \"" + avt + "\" must be doubled");
}
addStringComponent(components, avt, last, i8 + 1);
last = i8 + 2;
} else if (i1 >= 0 && i1 == i0) { // found a doubled "{{"