public void Unmark(int rule, int match, SequenceSomeFromSet seq) { if (seq.IsNonRandomRuleAllCall(rule)) { MarkMatches(seq.Matches[rule], null, null); AnnotateMatches(seq.Matches[rule], false); } else { MarkMatch(seq.Matches[rule].GetMatch(match), null, null); AnnotateMatch(seq.Matches[rule].GetMatch(match), false); } }
public void Mark(int rule, int match, SequenceSomeFromSet seq) { if (seq.IsNonRandomRuleAllCall(rule)) { MarkMatches(seq.Matches[rule], realizers.MatchedNodeRealizer, realizers.MatchedEdgeRealizer); AnnotateMatches(seq.Matches[rule], true); } else { MarkMatch(seq.Matches[rule].GetMatch(match), realizers.MatchedNodeRealizer, realizers.MatchedEdgeRealizer); AnnotateMatch(seq.Matches[rule].GetMatch(match), true); } }
public SequenceSomeRuleCallGenerator(SequenceSomeFromSet seqSome, SequenceRuleCall seqRule, SequenceExpressionGenerator seqExprGen, SequenceGeneratorHelper seqHelper) { this.seqSome = seqSome; // parent this.seqRule = seqRule; this.seqExprGen = seqExprGen; this.seqHelper = seqHelper; ArgumentExpressions = seqRule.ArgumentExpressions; specialStr = seqRule.Special ? "true" : "false"; matchingPatternClassName = "GRGEN_ACTIONS." + TypesHelper.GetPackagePrefixDot(seqRule.Package) + "Rule_" + seqRule.Name; patternName = seqRule.Name; ruleName = "rule_" + TypesHelper.PackagePrefixedNameUnderscore(seqRule.Package, seqRule.Name); matchType = matchingPatternClassName + "." + NamesOfEntities.MatchInterfaceName(patternName); matchName = "match_" + seqRule.Id; matchesType = "GRGEN_LIBGR.IMatchesExact<" + matchType + ">"; matchesName = "matches_" + seqRule.Id; }
public int ChooseMatch(int totalMatchExecute, SequenceSomeFromSet seq) { return(totalMatchExecute); }
public static bool ChooseMatch(IDebuggerEnvironment env, ref int totalMatchToExecute, SequenceSomeFromSet seq) { do { ConsoleKeyInfo key = env.ReadKeyWithCancel(); switch (key.KeyChar) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': int num = key.KeyChar - '0'; if (num >= seq.NumTotalMatches) { Console.WriteLine("You must specify a number between 0 and " + (seq.NumTotalMatches - 1) + "!"); break; } totalMatchToExecute = num; return(false); case 'e': Console.Write("Enter number of rule to show: "); String numStr = Console.ReadLine(); if (int.TryParse(numStr, out num)) { if (num < 0 || num >= seq.NumTotalMatches) { Console.WriteLine("You must specify a number between 0 and " + (seq.NumTotalMatches - 1) + "!"); break; } totalMatchToExecute = num; return(false); } Console.WriteLine("You must enter a valid integer number!"); break; case 's': case 'n': return(true); default: Console.WriteLine("Illegal choice (Key = " + key.Key + ")! Only (0)...(9), (e)nter number, (s)/(n) to commit and continue allowed! "); break; } }while(true); }
private static void PrintSequenceSomeFromSet(SequenceSomeFromSet seqSome, Sequence parent, PrintSequenceContext context) { if (context.cpPosCounter >= 0 && seqSome.Random) { PrintChoice(seqSome, context); ++context.cpPosCounter; Console.Write(seqSome.Choice ? "$%{<" : "${<"); bool first = true; foreach (Sequence seqChild in seqSome.Children) { if (!first) { Console.Write(", "); } int cpPosCounterBackup = context.cpPosCounter; context.cpPosCounter = -1; // rules within some-from-set are not choicepointable PrintSequence(seqChild, seqSome, context); context.cpPosCounter = cpPosCounterBackup; first = false; } Console.Write(")}"); return; } bool highlight = false; foreach (Sequence seqChild in seqSome.Children) { if (seqChild == context.highlightSeq) { highlight = true; } } if (highlight && context.choice) { WorkaroundManager.Workaround.PrintHighlighted("$%{<", HighlightingMode.Choicepoint); bool first = true; int numCurTotalMatch = 0; foreach (Sequence seqChild in seqSome.Children) { if (!first) { Console.Write(", "); } if (seqChild == context.highlightSeq) { WorkaroundManager.Workaround.PrintHighlighted(">>", HighlightingMode.Choicepoint); } if (context.sequences != null) { for (int i = 0; i < context.sequences.Count; ++i) { if (seqChild == context.sequences[i] && context.matches[i].Count > 0) { PrintListOfMatchesNumbers(context, ref numCurTotalMatch, seqSome.IsNonRandomRuleAllCall(i) ? 1 : context.matches[i].Count); } } } Sequence highlightSeqBackup = context.highlightSeq; context.highlightSeq = null; // we already highlighted here PrintSequence(seqChild, seqSome, context); context.highlightSeq = highlightSeqBackup; if (seqChild == context.highlightSeq) { WorkaroundManager.Workaround.PrintHighlighted("<<", HighlightingMode.Choicepoint); } first = false; } WorkaroundManager.Workaround.PrintHighlighted(">}", HighlightingMode.Choicepoint); return; } bool succesBackup = context.success; if (highlight) { context.success = true; } Console.Write(seqSome.Random ? (seqSome.Choice ? "$%{<" : "${<") : "{<"); PrintChildren(seqSome, context); Console.Write(">}"); context.success = succesBackup; }