// This can be pretty simple because Noweb doesn't allow = or , to appear
// in names or values (i.e. no quotes or escaping to make parsing more
// complicated).
String token = null;
JsArrayString completions = JsArrayString.createArray().cast();
ArrayList<String> names = new ArrayList<String>();
ArrayList<String> values = new ArrayList<String>();
parseRnwChunkHeader(linePart, names, values);
assert names.size() == values.size();
String name = names.size() == 0
? null : names.get(names.size()-1);
String value = values.size() == 0
? null : values.get(values.size()-1);
if (value != null)
{
token = value;
// If value is not null, we follow an equal sign; try to complete
// based on value.
completeValue(rnwWeave, name, value, completions);
}
else if (name != null)
{
token = name;
for (String optionName : this.getOptions())
if (optionName.startsWith(name))
completions.push(optionName + "=");
}
RnwOptionCompletionResult result = new RnwOptionCompletionResult();
result.token = token;
result.completions = completions;