void PopPreStack(string directive) { if (this.PreStack.Count == 0) { throw ParseException("{0} with no matching #if", directive); } PreDirectiveClass pdc = this.PreStack.Pop(); if (directive != "#endif" && pdc == PreDirectiveClass.Else) { throw ParseException("{0} after #else", directive); } }
void PopPreStack(string directive) { try { PreDirectiveClass pdc = this.PreStack.Pop(); if (directive != "#endif" && pdc == PreDirectiveClass.Else) { throw new ParseException(directive + " after #else"); } } catch (InvalidOperationException) { throw new ParseException(directive + " with no matching #if"); } }