private object ParseAssignment(ref string file, ref string data, ref int pos, ref int line)
{
object val = null;
while((pos < data.Length) && !cpErrorResult)
{
// Get current character
char c = data[pos++];
// Check for string opening
if(c == '\"')
{
// Now parsing a string
val = ParseString(ref file, ref data, ref pos, ref line);
if(cpErrorResult) return null;
}
// Check for numeric character
else if("0123456789-.&".IndexOf(c.ToString(CultureInfo.InvariantCulture)) > -1)
{
// Go one byte back, because this
// byte is part of the number!
pos--;
// Now parsing a number
val = ParseNumber(ref file, ref data, ref pos, ref line);
if(cpErrorResult) return null;
}
// Check for new line
else if(c == '\n')
{
// Count the new line
line++;
}
// Check if assignment ends
else if(c == ';')
{
// End of assignment
return val;
}
// Otherwise (if not whitespace) it is a keyword
else if((c != ' ') && (c != '\t'))
{
// Go one byte back, because this
// byte is part of the keyword!
pos--;
// Now parsing a keyword
val = ParseKeyword(ref file, ref data, ref pos, ref line);
if(cpErrorResult) return null;
}
}
RaiseError(file, line, ERROR_UNEXPECTED_END);
return null;
}