State GetBlockEnd ()
{
int start = position;
for (; position < content.Length; position++) {
char c = content[position];
nextStateTagStartLocation = nextStateLocation;
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();
} else if (c =='>' && content[position-1] == '#' && content[position-2] != '\\') {
value = content.Substring (start, position - start - 1);
position++;
TagEndLocation = nextStateLocation;
//skip newlines directly after blocks, unless they're expressions
if (State != State.Expression && (position += IsNewLine()) > 0) {
nextStateLocation = nextStateLocation.AddLine ();
}
return State.Content;
}
}
throw new ParserException ("Unexpected end of file.", nextStateLocation);
}