private bool Configure(ILrDfa dfa, RuntimeOptions flags, out ILrParserTable outputTable) { bool result; ComplyWithConfiguration = true; switch (flags & RuntimeOptions.ParserAlgorithmMask) { case RuntimeOptions.ForceDeterministic: outputTable = BuildCanonicalLRTable(dfa); RequiresGlr = false; result = outputTable != null && !outputTable.RequiresGlr; if (!result) { data.Clear(); ComplyWithConfiguration = false; RequiresGlr = true; outputTable = BuildReductionModifiedLRTable(dfa); } break; case RuntimeOptions.ForceNonDeterministic: RequiresGlr = true; outputTable = BuildReductionModifiedLRTable(dfa); result = outputTable != null; break; case RuntimeOptions.AllowNonDeterministic: outputTable = BuildCanonicalLRTable(dfa); result = outputTable != null && !outputTable.RequiresGlr; if (!result) { data.Clear(); goto case RuntimeOptions.ForceNonDeterministic; } RequiresGlr = false; break; default: #if DEBUG throw new InvalidOperationException( "Internal error: unsupported language flags: " + (int)flags); #else result = false; outputTable = null; break; #endif } return(result); }
private bool Configure(ILrDfa dfa, RuntimeOptions flags, out ILrParserTable outputTable) { bool result; ComplyWithConfiguration = true; switch (flags & RuntimeOptions.ParserAlgorithmMask) { case RuntimeOptions.ForceDeterministic: outputTable = BuildCanonicalLRTable(dfa); RequiresGlr = false; result = outputTable != null && !outputTable.RequiresGlr; if (!result) { data.Clear(); ComplyWithConfiguration = false; RequiresGlr = true; outputTable = BuildReductionModifiedLRTable(dfa); } break; case RuntimeOptions.ForceNonDeterministic: RequiresGlr = true; outputTable = BuildReductionModifiedLRTable(dfa); result = outputTable != null; break; case RuntimeOptions.AllowNonDeterministic: outputTable = BuildCanonicalLRTable(dfa); result = outputTable != null && !outputTable.RequiresGlr; if (!result) { data.Clear(); goto case RuntimeOptions.ForceNonDeterministic; } RequiresGlr = false; break; default: #if DEBUG throw new InvalidOperationException( "Internal error: unsupported language flags: " + (int)flags); #else result = false; outputTable = null; break; #endif } return result; }