public void SetCurrentRuleForMatchAnnotation(IRulePattern curRulePattern) { this.curRulePatternForMatchAnnotation = curRulePattern; }
public void SetCurrentRule(IRulePattern curRulePattern) { this.curRulePattern = curRulePattern; }
private static bool IsFilterVariable(string variable, IRulePattern rulePattern) { foreach(IPatternVariable patternVariable in rulePattern.PatternGraph.Variables) { if(patternVariable.UnprefixedName == variable) return true; } return false; }
void DebugMatched(IMatches matches, IMatch match, bool special) { if(matches.Count == 0) // happens e.g. from compiled sequences firing the event always, but the Finishing only comes in case of Count!=0 return; // integrate matched actions into subrule traces stack computationsEnteredStack.Add(new SubruleComputation(matches.Producer.Name)); SubruleDebuggingConfigurationRule cr; SubruleDebuggingDecision d = shellProcEnv.SubruleDebugConfig.Decide(SubruleDebuggingEvent.Match, matches, shellProcEnv.ProcEnv, out cr); if(d == SubruleDebuggingDecision.Break) InternalHalt(cr, matches); else if(d == SubruleDebuggingDecision.Continue) { recentlyMatched = lastlyEntered; if(!detailedMode) return; if(recordMode) { DebugFinished(null, false); matchDepth++; annotatedNodes.Clear(); annotatedEdges.Clear(); } return; } if(dynamicStepMode && !skipMode) { skipMode = true; ycompClient.UpdateDisplay(); ycompClient.Sync(); context.highlightSeq = lastlyEntered; context.success = true; PrintSequence(debugSequences.Peek(), context, debugSequences.Count); Console.WriteLine(); if(!QueryUser(lastlyEntered)) { recentlyMatched = lastlyEntered; return; } } recentlyMatched = lastlyEntered; if(!detailedMode) return; if(recordMode) { DebugFinished(null, false); matchDepth++; if(outOfDetailedMode) { annotatedNodes.Clear(); annotatedEdges.Clear(); return; } } if(matchDepth++ > 0 || computationsEnteredStack.Count > 0) Console.WriteLine("Matched " + matches.Producer.Name); annotatedNodes.Clear(); annotatedEdges.Clear(); curRulePattern = matches.Producer.RulePattern; if(ycompClient.dumpInfo.IsExcludedGraph()) { if(!recordMode) { ycompClient.ClearGraph(); excludedGraphNodesIncluded.Clear(); excludedGraphEdgesIncluded.Clear(); } // add all elements from match to graph and excludedGraphElementsIncluded if(match != null) AddNeededGraphElements(match); else AddNeededGraphElements(matches); AddNeighboursAndParentsOfNeededGraphElements(); } if(match!=null) MarkMatch(match, realizers.MatchedNodeRealizer, realizers.MatchedEdgeRealizer); else MarkMatches(matches, realizers.MatchedNodeRealizer, realizers.MatchedEdgeRealizer); if(match!=null) AnnotateMatch(match, true); else AnnotateMatches(matches, true); ycompClient.UpdateDisplay(); ycompClient.Sync(); Console.WriteLine("Press any key to apply rewrite..."); ReadKeyWithCancel(); if(match!=null) MarkMatch(match, null, null); else MarkMatches(matches, null, null); recordMode = true; ycompClient.NodeRealizerOverride = realizers.NewNodeRealizer; ycompClient.EdgeRealizerOverride = realizers.NewEdgeRealizer; nextAddedNodeIndex = 0; nextAddedEdgeIndex = 0; }
public static bool IsGeneratedFilter(string filter, IRulePattern rulePattern) { if(filter.IndexOf('_')!=-1) { string filterBase = filter.Substring(0, filter.IndexOf('_')); string filterVariable = filter.Substring(filter.IndexOf('_') + 1); if(filterBase=="orderAscendingBy" || filterBase=="orderDescendingBy" || filterBase=="groupBy" || filterBase=="keepSameAsFirst" || filterBase=="keepSameAsLast" || filterBase=="keepOneForEach") { if(IsFilterVariable(filterVariable, rulePattern)) return true; } } if(filter == "auto") return true; return false; }