public YieldAssignment(String left, bool isVar, String targetType, Expression right) { Left = left; IsVar = isVar; TargetType = targetType; Right = right; }
public override Yielding Copy(string renameSuffix) { Expression[] valuesCopy = new Expression[Values.Length]; for(int i = 0; i < Values.Length; ++i) valuesCopy[i] = Values[i].Copy(renameSuffix); Expression[] sourceNamesCopy = new Expression[SourceNames.Length]; for(int i = 0; i < SourceNames.Length; ++i) sourceNamesCopy[i] = SourceNames[i].Copy(renameSuffix); return new DebugHighlightStatement(Message.Copy(renameSuffix), Values, SourceNames); }
public IndexAccessEquality(IndexDescription index, PatternElement neededElement, bool variablesNeeded, Expression expr) : base(index, neededElement, variablesNeeded) { Expr = expr; }
//////////////////////////////////////////////////////////////////////////// /// <summary> /// Instantiates a new PatternVariable object. /// </summary> /// <param name="type">The GrGen type of the variable.</param> /// <param name="name">The name of the variable.</param> /// <param name="unprefixedName">Pure name of the variable as specified in the .grg without any prefixes.</param> /// <param name="parameterIndex">Specifies to which rule parameter this variable corresponds.</param> /// <param name="defToBeYieldedTo">Iff true the element is only defined in its PointOfDefinition pattern, /// it gets matched in another, nested or called pattern which yields it to the containing pattern.</param> /// <param name="initialization">The initialization expression for the variable if some was defined, otherwise null.</param> public PatternVariable(VarType type, String name, String unprefixedName, int parameterIndex, bool defToBeYieldedTo, Expression initialization) { this.type = type; this.name = name; this.unprefixedName = unprefixedName; this.ParameterIndex = parameterIndex; this.defToBeYieldedTo = defToBeYieldedTo; this.initialization = initialization; }
/// <summary> /// Instantiates a new PatternElement object as a copy from an original element, used for independent inlining. /// </summary> /// <param name="original">The original pattern element to be copy constructed.</param> /// <param name="nameSuffix">The suffix to be added to the name of the pattern element (to avoid name collisions).</param> public PatternElement(PatternElement original, String nameSuffix) { TypeID = original.TypeID; typeName = original.typeName; name = original.name + nameSuffix; unprefixedName = original.unprefixedName + nameSuffix; pointOfDefinition = original.pointOfDefinition; defToBeYieldedTo = original.defToBeYieldedTo; initialization = original.initialization != null ? original.initialization.Copy(nameSuffix) : null; annotations = original.annotations; AllowedTypes = original.AllowedTypes; IsAllowedType = original.IsAllowedType; Cost = original.Cost; ParameterIndex = original.ParameterIndex; MaybeNull = original.MaybeNull; Storage = original.Storage != null ? new StorageAccess(original.Storage) : null; StorageIndex = original.StorageIndex != null ? new StorageAccessIndex(original.StorageIndex) : null; IndexAccess = original.IndexAccess != null ? original.IndexAccess.Copy(nameSuffix) : null; NameLookup = original.NameLookup != null ? original.NameLookup.Copy(nameSuffix) : null; UniqueLookup = original.UniqueLookup != null ? original.UniqueLookup.Copy(nameSuffix) : null; ElementBeforeCasting = original.ElementBeforeCasting; AssignmentSource = original.AssignmentSource; OriginalIndependentElement = original; }
//////////////////////////////////////////////////////////////////////////// /// <summary> /// Constructs a PatternGraphEmbedding object. /// </summary> /// <param name="name">The name of the usage of the subpattern.</param> /// <param name="matchingPatternOfEmbeddedGraph">The embedded subpattern.</param> /// <param name="connections">An array with the expressions defining how the subpattern is connected /// to the containing pattern (graph elements and basic variables) .</param> /// <param name="yields">An array with the def elements and variables /// from the containing pattern yielded to from the subpattern.</param> /// <param name="neededNodes">An array with names of nodes needed by this embedding.</param> /// <param name="neededEdges">An array with names of edges needed by this embedding.</param> /// <param name="neededVariables">An array with names of variables needed by this embedding.</param> /// <param name="neededVariableTypes">An array with types of variables needed by this embedding.</param> public PatternGraphEmbedding(String name, LGSPMatchingPattern matchingPatternOfEmbeddedGraph, Expression[] connections, String[] yields, String[] neededNodes, String[] neededEdges, String[] neededVariables, VarType[] neededVariableTypes) { this.name = name; this.matchingPatternOfEmbeddedGraph = matchingPatternOfEmbeddedGraph; this.connections = connections; this.yields = yields; this.neededNodes = neededNodes; this.neededEdges = neededEdges; this.neededVariables = neededVariables; this.neededVariableTypes = neededVariableTypes; this.matchingPatternOfEmbeddedGraph.uses += 1; }
//////////////////////////////////////////////////////////////////////////// /// <summary> /// Constructs a PatternCondition object. /// </summary> /// <param name="conditionExpression">The condition expression to evaluate.</param> /// <param name="neededNodes">An array of node names needed by this condition.</param> /// <param name="neededEdges">An array of edge names needed by this condition.</param> /// <param name="neededVariables">An array of variable names needed by this condition.</param> /// <param name="neededVariableTypes">An array of variable types (corresponding to the variable names) needed by this condition.</param> public PatternCondition(Expression conditionExpression, String[] neededNodes, String[] neededEdges, String[] neededVariables, VarType[] neededVariableTypes) { ConditionExpression = conditionExpression; NeededNodes = neededNodes; NeededEdges = neededEdges; NeededVariables = neededVariables; NeededVariableTypes = neededVariableTypes; }
public IndexAccessDescending(IndexDescription index, PatternElement neededElement, bool variablesNeeded, Expression from, bool includingFrom, Expression to, bool includingTo) : base(index, neededElement, variablesNeeded) { From = from; IncludingFrom = includingFrom; To = to; IncludingTo = includingTo; }
public MapAdd(String left, Expression key, Expression value) : base(left, key) { Value = value; }
public SetAdd(String left, Expression value) : base(left, value) { }
public DequeRemove(String left, Expression right) : base(left, right) { }
public ArrayRemove(String left, Expression right) : base(left, right) { }
public SetMapRemove(String left, Expression right) : base(left, right) { }
public RecordStatement(Expression toRecord) { ToRecordExpression = toRecord; }
public YieldMethod(String left, Expression right) { Left = left; Right = right; }
public YieldAssignmentIndexed(String left, Expression right, Expression index) { Left = left; Right = right; Index = index; }
public ForFunction(String variable, String unprefixedVariable, String variableType, Expression function, Yielding[] statements) { Variable = variable; UnprefixedVariable = unprefixedVariable; VariableType = variableType; Function = function; Statements = statements; }
public DequeAdd(String left, Expression value, Expression index) : base(left, value) { Index = index; }
public UniqueLookup(PatternElement neededElement, bool variablesNeeded, Expression expr) { NeededElement = neededElement; VariablesNeeded = variablesNeeded; Expr = expr; }
public DequeAdd(String left, Expression value) : base(left, value) { Index = null; }
/// <summary> /// Instantiates a new PatternCondition object as a copy from an original condition, used for inlining. /// </summary> /// <param name="original">The original condition to be copy constructed.</param> /// <param name="inlinedSubpatternEmbedding">The embedding which just gets inlined.</param> /// <param name="renameSuffix">The rename suffix to be applied to all the nodes, edges, and variables used.</param> public PatternCondition(PatternCondition original, PatternGraphEmbedding inlinedSubpatternEmbedding, string renameSuffix) { originalCondition = original; originalSubpatternEmbedding = inlinedSubpatternEmbedding; ConditionExpression = (Expression)original.ConditionExpression.Copy(renameSuffix); NeededNodes = new String[original.NeededNodes.Length]; for(int i = 0; i < original.NeededNodes.Length; ++i) NeededNodes[i] = original.NeededNodes[i] + renameSuffix; NeededEdges = new String[original.NeededEdges.Length]; for(int i = 0; i < original.NeededEdges.Length; ++i) NeededEdges[i] = original.NeededEdges[i] + renameSuffix; NeededVariables = new String[original.NeededVariables.Length]; for(int i = 0; i < original.NeededVariables.Length; ++i) NeededVariables[i] = original.NeededVariables[i] + renameSuffix; NeededVariableTypes = (VarType[])original.NeededVariableTypes.Clone(); }
public SetMapUnion(String left, Expression right) : base(left, right) { }
//////////////////////////////////////////////////////////////////////////// /// <summary> /// Instantiates a new PatternElement object. /// </summary> /// <param name="typeID">The type ID of the pattern element.</param> /// <param name="typeName">The name of the type interface of the pattern element.</param> /// <param name="name">The name of the pattern element.</param> /// <param name="unprefixedName">Pure name of the pattern element as specified in the .grg without any prefixes</param> /// <param name="allowedTypes">An array of allowed types for this pattern element. /// If it is null, all subtypes of the type specified by typeID (including itself) /// are allowed for this pattern element.</param> /// <param name="isAllowedType">An array containing a bool for each node/edge type (order defined by the TypeIDs) /// which is true iff the corresponding type is allowed for this pattern element. /// It should be null if allowedTypes is null or empty or has only one element.</param> /// <param name="cost">Default cost/priority from frontend, user priority if given.</param> /// <param name="parameterIndex">Specifies to which rule parameter this pattern element corresponds.</param> /// <param name="maybeNull">Tells whether this pattern element may be null (is a parameter if true).</param> /// <param name="storage">If not null this pattern element is to be bound by iterating the given storage.</param> /// <param name="storageIndex">If not null this pattern element is to be determined by a storage lookup, /// with the accessor given here applied as index into the storage given in the storage parameter.</param> /// <param name="indexAccess">If not null this pattern element is to be determined by an index lookup, with details specified by the concrete index access type contained in this field.</param> /// <param name="nameLookup">If not null this pattern element is to be determined by a name map lookup.</param> /// <param name="uniqueLookup">If not null this pattern element is to be determined by a unique index lookup.</param> /// <param name="elementBeforeCasting">If not null this pattern node is to be bound by casting the given elementBeforeCasting to the pattern node type or causing matching to fail.</param> /// <param name="defToBeYieldedTo">Iff true the element is only defined in its PointOfDefinition pattern, /// it gets matched in another, nested or called pattern which yields it to the containing pattern.</param> /// <param name="initialization">The initialization expression for the element if some was defined, /// only possible for defToBeYieldedTo elements, otherwise null.</param> public PatternElement(int typeID, String typeName, String name, String unprefixedName, GrGenType[] allowedTypes, bool[] isAllowedType, float cost, int parameterIndex, bool maybeNull, StorageAccess storage, StorageAccessIndex storageIndex, IndexAccess indexAccess, NameLookup nameLookup, UniqueLookup uniqueLookup, PatternElement elementBeforeCasting, bool defToBeYieldedTo, Expression initialization) { this.TypeID = typeID; this.typeName = typeName; this.name = name; this.unprefixedName = unprefixedName; this.AllowedTypes = allowedTypes; this.IsAllowedType = isAllowedType; this.Cost = cost; this.ParameterIndex = parameterIndex; this.MaybeNull = maybeNull; this.Storage = storage; this.StorageIndex = storageIndex; this.IndexAccess = indexAccess; this.NameLookup = nameLookup; this.UniqueLookup = uniqueLookup; this.ElementBeforeCasting = elementBeforeCasting; this.defToBeYieldedTo = defToBeYieldedTo; this.initialization = initialization; // TODO: the last parameters are (mostly) mutually exclusive, // introduce some abstract details class with specialized classed for the different cases, // only one instance needed instead of the large amount of mostly null valued variables now // better now with the introduction of helper classes for StorageAccess and StorageAccessIndex, but could be improved further }
public SetMapIntersect(String left, Expression right) : base(left, right) { }
/// <summary> /// Instantiates a new PatternEdge object /// </summary> /// <param name="fixedDirection">Whether this pattern edge should be matched with a fixed direction or not.</param> /// <param name="typeID">The type ID of the pattern edge.</param> /// <param name="type">The GrGen type of the pattern edge.</param> /// <param name="typeName">The name of the type interface of the pattern element.</param> /// <param name="name">The name of the pattern edge.</param> /// <param name="unprefixedName">Pure name of the pattern element as specified in the .grg without any prefixes</param> /// <param name="allowedTypes">An array of allowed types for this pattern element. /// If it is null, all subtypes of the type specified by typeID (including itself) /// are allowed for this pattern element.</param> /// <param name="isAllowedType">An array containing a bool for each edge type (order defined by the TypeIDs) /// which is true iff the corresponding type is allowed for this pattern element. /// It should be null if allowedTypes is null or empty or has only one element.</param> /// <param name="cost"> default cost/priority from frontend, user priority if given</param> /// <param name="parameterIndex">Specifies to which rule parameter this pattern element corresponds</param> /// <param name="maybeNull">Tells whether this pattern edge may be null (is a parameter if true).</param> /// <param name="storage">If not null this edge is to be bound by iterating the given storage.</param> /// <param name="storageIndex">If not null this edge is to be determined by a storage lookup, /// with the accessor given here applied as index into the storage given in the storage parameter.</param> /// <param name="indexAccess">If not null this pattern element is to be determined by an index lookup, with details specified by the concrete index access type contained in this field.</param> /// <param name="nameLookup">If not null this pattern element is to be determined by a name map lookup.</param> /// <param name="uniqueLookup">If not null this pattern element is to be determined by a unique index lookup.</param> /// <param name="elementBeforeCasting">If not null this pattern node is to be bound by casting the given elementBeforeCasting to the pattern node type or causing matching to fail.</param> /// <param name="defToBeYieldedTo">Iff true the element is only defined in its PointOfDefinition pattern, /// it gets matched in another, nested or called pattern which yields it to the containing pattern.</param> /// <param name="initialization">The initialization expression for the edge if some was defined, /// only possible for defToBeYieldedTo edges, otherwise null.</param> public PatternEdge(bool fixedDirection, int typeID, EdgeType type, String typeName, String name, String unprefixedName, GrGenType[] allowedTypes, bool[] isAllowedType, float cost, int parameterIndex, bool maybeNull, StorageAccess storage, StorageAccessIndex storageIndex, IndexAccess indexAccess, NameLookup nameLookup, UniqueLookup uniqueLookup, PatternElement elementBeforeCasting, bool defToBeYieldedTo, Expression initialization) : base(typeID, typeName, name, unprefixedName, allowedTypes, isAllowedType, cost, parameterIndex, maybeNull, storage, storageIndex, indexAccess, nameLookup, uniqueLookup, elementBeforeCasting, defToBeYieldedTo, initialization) { this.fixedDirection = fixedDirection; this.type = type; }
public SetMapExcept(String left, Expression right) : base(left, right) { }
/// <summary> /// Instantiates a new PatternVariable object as a copy from an original variable, used for inlining. /// </summary> /// <param name="original">The original pattern variable to be copy constructed.</param> /// <param name="inlinedSubpatternEmbedding">The embedding which just gets inlined.</param> /// <param name="newHost">The pattern graph the new pattern element will be contained in.</param> /// <param name="nameSuffix">The suffix to be added to the name of the pattern variable (to avoid name collisions).</param> public PatternVariable(PatternVariable original, PatternGraphEmbedding inlinedSubpatternEmbedding, PatternGraph newHost, String nameSuffix) { type = original.type; name = original.name + nameSuffix; unprefixedName = original.unprefixedName + nameSuffix; pointOfDefinition = newHost; defToBeYieldedTo = original.defToBeYieldedTo; initialization = original.initialization; annotations = original.annotations; ParameterIndex = original.ParameterIndex; originalVariable = original; originalSubpatternEmbedding = inlinedSubpatternEmbedding; }
public IntegerRangeIterationYield(String variable, String unprefixedVariable, String variableType, Expression left, Expression right, Yielding[] statements) { Variable = variable; UnprefixedVariable = unprefixedVariable; VariableType = variableType; Left = left; Right = right; Statements = statements; }
public override void PatchUsersOfCopiedElements(string renameSuffix, Dictionary<PatternNode, PatternNode> nodeToCopy, Dictionary<PatternEdge, PatternEdge> edgeToCopy) { Expr = Expr.Copy(renameSuffix); if(NeededElement != null) { if(NeededElement is PatternNode) { if(nodeToCopy.ContainsKey((PatternNode)NeededElement)) NeededElement = nodeToCopy[(PatternNode)NeededElement]; } else { if(edgeToCopy.ContainsKey((PatternEdge)NeededElement)) NeededElement = edgeToCopy[(PatternEdge)NeededElement]; } } }
public DebugHighlightStatement(Expression message, Expression[] values, Expression[] sourceNames) { Message = message; Values = values; SourceNames = sourceNames; }