State GetNextStateAndCurrentValue ()
{
switch (State) {
case State.Block:
case State.Expression:
case State.Helper:
return GetBlockEnd ();
case State.Directive:
return NextStateInDirective ();
case State.Content:
return NextStateInContent ();
case State.DirectiveName:
return GetDirectiveName ();
case State.DirectiveValue:
return GetDirectiveValue ();
default:
throw new InvalidOperationException ("Unexpected state '" + State.ToString () + "'");
}
}