public static void Run(Rule rule, IMessageSink sink, IDictionary<Symbol, Rule> rules, IPGCodeGenHelper codeGen) { // 1. Scan for a list of code blocks that use $labels, and a list of rules referenced. var data = new DataGatheringVisitor(rules, rule); if (data.RulesReferenced.Count != 0 || data.OtherReferences.Count != 0 || data.ProperLabels.Count != 0) { var vsv = new AutoValueSaverVisitor(data, sink, rules, codeGen); // 2. Create $result variable if it was used // 3. Scan for predicates with labels, and RuleRefs referenced by // code blocks. For each such predicate, generate a variable at // the beginning of the rule and set the ResultSaver. vsv.Process(rule); // 4. Replace recognized $substitutions in code blocks vsv.ReplaceSubstitutionsInCodeBlocks(); } }
public static void Run(Rule rule, IMessageSink sink, IDictionary <Symbol, Rule> rules, IPGCodeGenHelper codeGen) { // 1. Scan for a list of code blocks that use $labels, and a list of rules referenced. var data = new DataGatheringVisitor(rules, rule); if (data.RulesReferenced.Count != 0 || data.OtherReferences.Count != 0 || data.ProperLabels.Count != 0) { var vsv = new AutoValueSaverVisitor(data, sink, rules, codeGen); // 2. Create $result variable if it was used // 3. Scan for predicates with labels, and RuleRefs referenced by // code blocks. For each such predicate, generate a variable at // the beginning of the rule and set the ResultSaver. vsv.Process(rule); // 4. Replace recognized $substitutions in code blocks vsv.ReplaceSubstitutionsInCodeBlocks(); } }