internal float <> m__0(GrammarResolver.RuleEntry rule) { if (rule.knownUnresolvable || !rule.ValidateConstantConstraints(this.constants)) { return(0f); } return(rule.SelectionWeight); }
internal float <> m__0(GrammarResolver.RuleEntry rule) { float result; if (rule.knownUnresolvable || !rule.ValidateConstantConstraints(this.constants)) { result = 0f; } else { result = rule.SelectionWeight; } return(result); }
private static bool TryResolveRecursive(GrammarResolver.RuleEntry entry, int depth, Dictionary <string, string> constants, out string output, bool log) { if (log) { GrammarResolver.logSb.AppendLine(); GrammarResolver.logSb.Append(depth.ToStringCached() + " "); for (int i = 0; i < depth; i++) { GrammarResolver.logSb.Append(" "); } GrammarResolver.logSb.Append(entry + " "); } GrammarResolver.loopCount++; if (GrammarResolver.loopCount > 1000) { Log.Error("Hit loops limit resolving grammar.", false); output = "HIT_LOOPS_LIMIT"; if (log) { GrammarResolver.logSb.Append("UNRESOLVABLE: Hit loops limit"); } return(false); } if (depth > 50) { Log.Error("Grammar recurred too deep while resolving keyword (>" + 50 + " deep)", false); output = "DEPTH_LIMIT_REACHED"; if (log) { GrammarResolver.logSb.Append("UNRESOLVABLE: Depth limit reached"); } return(false); } string text = entry.rule.Generate(); bool flag = false; int num = -1; for (int j = 0; j < text.Length; j++) { char c = text[j]; if (c == '[') { num = j; } if (c == ']') { if (num == -1) { Log.Error("Could not resolve rule " + text + ": mismatched brackets.", false); output = "MISMATCHED_BRACKETS"; if (log) { GrammarResolver.logSb.Append("UNRESOLVABLE: Mismatched brackets"); } flag = true; } else { string text2 = text.Substring(num + 1, j - num - 1); string str; while (true) { GrammarResolver.RuleEntry ruleEntry = GrammarResolver.RandomPossiblyResolvableEntry(text2, constants); if (ruleEntry == null) { break; } ruleEntry.uses++; if (GrammarResolver.TryResolveRecursive(ruleEntry, depth + 1, constants, out str, log)) { goto Block_13; } ruleEntry.MarkKnownUnresolvable(); } entry.MarkKnownUnresolvable(); output = "CANNOT_RESOLVE_SUBSYMBOL:" + text2; if (log) { GrammarResolver.logSb.Append("UNRESOLVABLE: Cannot resolve subsymbol '" + text2 + "'"); } flag = true; goto IL_219; Block_13: text = text.Substring(0, num) + str + text.Substring(j + 1); j = num; } } IL_219 :; } output = text; return(!flag); }