private void ParseElementOnlyContentNoValidation() {
Stack<ParseElementOnlyContentNoValidation_LocalFrame> localFrames =
new Stack<ParseElementOnlyContentNoValidation_LocalFrame>();
ParseElementOnlyContentNoValidation_LocalFrame currentFrame =
new ParseElementOnlyContentNoValidation_LocalFrame();
localFrames.Push(currentFrame);
RecursiveCall:
Loop:
switch ( GetToken( false ) ) {
case Token.QName:
GetNameQualified(true);
ParseHowManyNoValidation();
break;
case Token.LeftParen:
// We could just do this:
// ParseElementOnlyContentNoValidation();
//
// But that would be a recursion - so we will simulate the call using our localFrames stack
// instead.
currentFrame =
new ParseElementOnlyContentNoValidation_LocalFrame();
localFrames.Push(currentFrame);
goto RecursiveCall;
// And we should return here when we return from the recursion
// but it's the samea s returning after the switch statement
case Token.GreaterThan:
Throw( curPos, SR.Xml_InvalidContentModel );
goto Return;
default:
goto UnexpectedError;
}
ReturnFromRecursiveCall:
switch ( GetToken( false ) ) {
case Token.Comma:
if ( currentFrame.parsingSchema == Token.Or ) {
Throw( curPos, SR.Xml_InvalidContentModel );
}
currentFrame.parsingSchema = Token.Comma;
break;
case Token.Or:
if ( currentFrame.parsingSchema == Token.Comma ) {
Throw( curPos, SR.Xml_InvalidContentModel );
}
currentFrame.parsingSchema = Token.Or;
break;
case Token.RightParen:
ParseHowManyNoValidation();
goto Return;
case Token.GreaterThan:
Throw( curPos, SR.Xml_InvalidContentModel );
goto Return;
default:
goto UnexpectedError;
}
goto Loop;
UnexpectedError:
OnUnexpectedError();
Return:
// This is equivalent to return; statement
// we simulate it using our localFrames stack
localFrames.Pop();
if (localFrames.Count > 0) {
currentFrame = localFrames.Peek();
goto ReturnFromRecursiveCall;
}
else {
return;
}
}