State GetDirectiveValue ()
{
int start = position;
int delimiter = '\0';
for (; position < content.Length; position++) {
char c = content[position];
nextStateLocation = nextStateLocation.AddCol ();
if (c == '\r') {
if (position + 1 < content.Length && content[position + 1] == '\n')
position++;
nextStateLocation = nextStateLocation.AddLine();
} else if (c == '\n')
nextStateLocation = nextStateLocation.AddLine();
if (delimiter == '\0') {
if (c == '\'' || c == '"') {
start = position;
delimiter = c;
} else if (!Char.IsWhiteSpace (c)) {
throw new ParserException ("Unexpected character '" + c + "'. Expecting attribute value.", nextStateLocation);
}
continue;
}
if (c == delimiter) {
value = content.Substring (start + 1, position - start - 1);
position++;
return State.Directive;
}
}
throw new ParserException ("Unexpected end of file.", nextStateLocation);;
}