protected void CheckBaseObjectTypeIsKnown(SequenceCheckingEnvironment env, String baseObjectType, String whichArgument) { if (TypesHelper.GetObjectType(baseObjectType, env.Model) == null && TypesHelper.GetTransientObjectType(baseObjectType, env.Model) == null) { throw new SequenceParserException(Symbol + whichArgument, "object type or transient object type", baseObjectType); } }
public override string Type(SequenceCheckingEnvironment env) { if (DestVar.Type == "") { return(""); } InheritanceType inheritanceType = TypesHelper.GetInheritanceType(DestVar.Type, env.Model); AttributeType attributeType = inheritanceType.GetAttributeType(AttributeName); if (attributeType == null) { return(""); // error, will be reported by Check, just ensure we don't crash here } string ContainerType = TypesHelper.AttributeTypeToXgrsType(attributeType); if (DestVar.Type.StartsWith("map")) { return(TypesHelper.ExtractDst(DestVar.Type) ?? ""); } else { return(TypesHelper.ExtractSrc(DestVar.Type) ?? ""); } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); if (DestVar.Type == "") { return; // we can't check source and destination types if the variable is untyped, only runtime-check possible } if (TypesHelper.ExtractSrc(DestVar.Type) == null || TypesHelper.ExtractDst(DestVar.Type) == null || TypesHelper.ExtractDst(DestVar.Type) == "SetValueType") { throw new SequenceParserException(Symbol, "map<S,T> or array<T> or deque<T>", DestVar.Type); } if (DestVar.Type.StartsWith("array")) { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), "int", env.Model)) { throw new SequenceParserException(Symbol, "int", KeyExpression.Type(env)); } } else if (DestVar.Type.StartsWith("deque")) { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), "int", env.Model)) { throw new SequenceParserException(Symbol, "int", KeyExpression.Type(env)); } } else { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), TypesHelper.ExtractSrc(DestVar.Type), env.Model)) { throw new SequenceParserException(Symbol, TypesHelper.ExtractSrc(DestVar.Type), KeyExpression.Type(env)); } } }
public override string Type(SequenceCheckingEnvironment env) { if(DestVar.Type.StartsWith("map")) return TypesHelper.ExtractDst(DestVar.Type) ?? ""; else return TypesHelper.ExtractSrc(DestVar.Type) ?? ""; }
public override string Type(SequenceCheckingEnvironment env) { if(DestVar.Type == "") return ""; GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(DestVar.Type, env.Model); AttributeType attributeType = nodeOrEdgeType.GetAttributeType(AttributeName); return TypesHelper.AttributeTypeToXgrsType(attributeType); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(GraphElementVar.Type, env.Model); if(GraphElementVar.Type != "" && nodeOrEdgeType == null) throw new SequenceParserException(Symbol, "node or edge type", GraphElementVar.Type); if(!TypesHelper.IsSameOrSubtype(VisitedFlagExpression.Type(env), "int", env.Model)) throw new SequenceParserException(Symbol, "int", VisitedFlagExpression.Type(env)); }
public override string Type(SequenceCheckingEnvironment env) { if (DestVar.Type == "") { return(""); } InheritanceType inheritanceType = TypesHelper.GetInheritanceType(DestVar.Type, env.Model); AttributeType attributeType = inheritanceType.GetAttributeType(AttributeName); return(TypesHelper.AttributeTypeToXgrsType(attributeType)); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); if (DestVar.Type == "") { return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible } InheritanceType inheritanceType = TypesHelper.GetInheritanceType(DestVar.Type, env.Model); if (inheritanceType == null) { throw new SequenceParserException(Symbol, "node or edge or object or transient object type (class)", DestVar.Type); } AttributeType attributeType = inheritanceType.GetAttributeType(AttributeName); if (attributeType == null) { throw new SequenceParserException(AttributeName, SequenceParserError.UnknownAttribute); } string ContainerType = TypesHelper.AttributeTypeToXgrsType(attributeType); if (TypesHelper.ExtractSrc(ContainerType) == null || TypesHelper.ExtractDst(ContainerType) == null || TypesHelper.ExtractDst(ContainerType) == "SetValueType") { throw new SequenceParserException(Symbol, "map<S,T> or array<T> or deque<T>", DestVar.Type); } if (ContainerType.StartsWith("array")) { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), "int", env.Model)) { throw new SequenceParserException(Symbol, "int", KeyExpression.Type(env)); } } else if (ContainerType.StartsWith("deque")) { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), "int", env.Model)) { throw new SequenceParserException(Symbol, "int", KeyExpression.Type(env)); } } else { if (!TypesHelper.IsSameOrSubtype(KeyExpression.Type(env), TypesHelper.ExtractSrc(ContainerType), env.Model)) { throw new SequenceParserException(Symbol, TypesHelper.ExtractSrc(ContainerType), KeyExpression.Type(env)); } } }
protected void CheckEdgeTypeIsKnown(SequenceCheckingEnvironment env, SequenceExpression typeExpr, String whichArgument) { if (typeExpr == null || typeExpr.Type(env) == "") { return; } string typeString = GetTypeString(env, typeExpr); if (TypesHelper.GetEdgeType(typeString, env.Model) == null && typeString != null) { throw new SequenceParserException(Symbol + whichArgument, "edge type or string denoting edge type", typeString); } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); if(DestVar.Type == "") return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(DestVar.Type, env.Model); if(nodeOrEdgeType == null) throw new SequenceParserException(Symbol, "node or edge type", DestVar.Type); AttributeType attributeType = nodeOrEdgeType.GetAttributeType(AttributeName); if(attributeType == null) throw new SequenceParserException(AttributeName, SequenceParserError.UnknownAttribute); }
protected string GetTypeString(SequenceCheckingEnvironment env, SequenceExpression typeExpr) { if (typeExpr.Type(env) == "string") { if (typeExpr is SequenceExpressionConstant) { return((string)((SequenceExpressionConstant)typeExpr).Constant); } } else { return(typeExpr.Type(env)); } return(null); }
public override string Type(SequenceCheckingEnvironment env) { if(DestVar.Type == "") return ""; GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(DestVar.Type, env.Model); AttributeType attributeType = nodeOrEdgeType.GetAttributeType(AttributeName); if(attributeType == null) return ""; // error, will be reported by Check, just ensure we don't crash here string ContainerType = TypesHelper.AttributeTypeToXgrsType(attributeType); if(DestVar.Type.StartsWith("map")) return TypesHelper.ExtractDst(DestVar.Type) ?? ""; else return TypesHelper.ExtractSrc(DestVar.Type) ?? ""; }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); if (DestVar.Type == "") { return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible } InheritanceType inheritanceType = TypesHelper.GetInheritanceType(DestVar.Type, env.Model); if (inheritanceType == null) { throw new SequenceParserException(Symbol, "node or edge or object or transient object type (class)", DestVar.Type); } AttributeType attributeType = inheritanceType.GetAttributeType(AttributeName); if (attributeType == null) { throw new SequenceParserException(AttributeName, SequenceParserError.UnknownAttribute); } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(Graph.Type(env) == "") return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible if(Graph.Type(env) != "graph") { throw new SequenceParserException(Symbol, "graph type", Graph.Type(env)); } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(!SourceVarType.StartsWith("match<")) throw new Exception("SequenceExpression MatchAccess can only access a variable of type match<rulename>"); string ruleName = TypesHelper.ExtractSrc(SourceVarType); // throws exceptions in case the rule does not exist, or it does not contain an element of the given name string elementType = env.TypeOfTopLevelEntityInRule(ruleName, ElementName); if(elementType == "") throw new Exception("Internal failure, static type of element in match type not known"); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(Subgraph.Type(env) != "") { if(Subgraph.Type(env) != "graph") { throw new SequenceParserException(Symbol + ", first argument", "graph type", Subgraph.Type(env)); } } if(SubgraphSet.Type(env) != "") { if(!SubgraphSet.Type(env).StartsWith("set<")) { throw new SequenceParserException(Symbol + ", second argument", "set<graph> type", SubgraphSet.Type(env)); } if(TypesHelper.ExtractSrc(SubgraphSet.Type(env)) != "graph") { throw new SequenceParserException(Symbol + ", second argument", "set<graph> type", SubgraphSet.Type(env)); } } }
public override String Type(SequenceCheckingEnvironment env) { return ObjectToBeCopied.Type(env); }
public override void Check(SequenceCheckingEnvironment env) { env.CheckFunctionMethodCall(TargetExpr, this); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children }
public override String Type(SequenceCheckingEnvironment env) { return "graph"; }
public override String Type(SequenceCheckingEnvironment env) { return ""; // no constraints regarding the types of the expressions to choose from }
public override String Type(SequenceCheckingEnvironment env) { if(SequenceExpressionType == SequenceExpressionType.AdjacentNodes || SequenceExpressionType == SequenceExpressionType.AdjacentNodesViaIncoming || SequenceExpressionType == SequenceExpressionType.AdjacentNodesViaOutgoing) { return "set<Node>"; } else // SequenceExpressionType.IncidentEdges || SequenceExpressionType.IncomingEdges || SequenceExpressionType.OutgoingEdges { return "set<Edge>"; } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(!TypesHelper.IsSameOrSubtype(Condition.Type(env), "boolean", env.Model)) { throw new SequenceParserException(Symbol, "boolean", Condition.Type(env)); } }
public override void Check(SequenceCheckingEnvironment env) { }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(EdgeType != null && EdgeType.Type(env) != "") { string typeString = null; if(EdgeType.Type(env) == "string") { if(EdgeType is SequenceExpressionConstant) typeString = (string)((SequenceExpressionConstant)EdgeType).Constant; } else { typeString = EdgeType.Type(env); } EdgeType edgeType = TypesHelper.GetEdgeType(typeString, env.Model); if(edgeType == null && typeString != null) { throw new SequenceParserException(Symbol + ", argument", "edge type or string denoting edge type", typeString); } } }
public override String Type(SequenceCheckingEnvironment env) { return "set<Edge>"; }
public override String Type(SequenceCheckingEnvironment env) { string ruleName = TypesHelper.ExtractSrc(SourceVarType); return env.TypeOfTopLevelEntityInRule(ruleName, ElementName); }
public override void Check(SequenceCheckingEnvironment env) { if(UniquelyIdentifiedEntity != null) { base.Check(env); // check children if(!TypesHelper.IsSameOrSubtype(UniquelyIdentifiedEntity.Type(env), "Node", env.Model) && !TypesHelper.IsSameOrSubtype(UniquelyIdentifiedEntity.Type(env), "Edge", env.Model) && !TypesHelper.IsSameOrSubtype(UniquelyIdentifiedEntity.Type(env), "graph", env.Model)) { throw new SequenceParserException(Symbol, "node or edge or graph type", UniquelyIdentifiedEntity.Type(env)); } } }
public string CheckAndReturnAttributeType(SequenceCheckingEnvironment env) { base.Check(env); // check children if(SourceVarType == "") return ""; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(SourceVarType, env.Model); if(nodeOrEdgeType == null) { throw new SequenceParserException(Symbol, "node or edge type", SourceVarType); } AttributeType attributeType = nodeOrEdgeType.GetAttributeType(AttributeName); if(attributeType == null) { throw new SequenceParserException(AttributeName, SequenceParserError.UnknownAttribute); } return TypesHelper.AttributeTypeToXgrsType(attributeType); }
public override String Type(SequenceCheckingEnvironment env) { return "string"; // typeof in the sequences returns the type name }
public override string Type(SequenceCheckingEnvironment env) { LeftTypeStatic = Left.Type(env); RightTypeStatic = Right.Type(env); return SequenceExpressionHelper.Balance(SequenceExpressionType, LeftTypeStatic, RightTypeStatic, env.Model); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(Path.Type(env) == "") return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible if(!TypesHelper.IsSameOrSubtype(Path.Type(env), "string", env.Model)) { throw new SequenceParserException(Symbol, "string type", Path.Type(env)); } }
public override string Type(SequenceCheckingEnvironment env) { return(DestVar.Type); }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(ObjectToBeCopied.Type(env) == "") return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible if(!TypesHelper.IsSameOrSubtype(ObjectToBeCopied.Type(env), "graph", env.Model) && !ObjectToBeCopied.Type(env).StartsWith("match<") && (TypesHelper.ExtractSrc(ObjectToBeCopied.Type(env)) == null || TypesHelper.ExtractDst(ObjectToBeCopied.Type(env)) == null)) { throw new SequenceParserException(Symbol, "graph type or match type or container type", ObjectToBeCopied.Type(env)); } }
public override void Check(SequenceCheckingEnvironment env) { CheckAndReturnAttributeType(env); }
public override void Check(SequenceCheckingEnvironment env) { env.CheckFunctionCall(this); IsExternalFunctionCalled = env.IsFunctionCallExternal(ParamBindings); }
/// <summary> /// Returns the type of the sequence /expression (for sequences always "boolean") /// </summary> public abstract string Type(SequenceCheckingEnvironment env);
public override String Type(SequenceCheckingEnvironment env) { if(ParamBindings.FunctionDef != null) return TypesHelper.DotNetTypeToXgrsType(ParamBindings.FunctionDef.Output); else // compiled sequence return ParamBindings.ReturnType; }
public override String Type(SequenceCheckingEnvironment env) { if(SourceVarType == "") return ""; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible GrGenType nodeOrEdgeType = TypesHelper.GetNodeOrEdgeType(SourceVarType, env.Model); AttributeType attributeType = nodeOrEdgeType.GetAttributeType(AttributeName); if(attributeType == null) return ""; // error, will be reported by Check, just ensure we don't crash here return TypesHelper.AttributeTypeToXgrsType(attributeType); }
/// <summary> /// Returns the type of the sequence expression /// default behaviour: returns "boolean" /// </summary> public override string Type(SequenceCheckingEnvironment env) { return "boolean"; }
public override String Type(SequenceCheckingEnvironment env) { if(TargetType is NodeType) return ((NodeType)TargetType).Name; if(TargetType is EdgeType) return ((EdgeType)TargetType).Name; return null; // TODO: handle the non-node and non-edge-types, too }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(SourceNode.Type(env) != "") // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible { NodeType nodeType = TypesHelper.GetNodeType(SourceNode.Type(env), env.Model); if(nodeType == null) { throw new SequenceParserException(Symbol+", first argument", "node type", SourceNode.Type(env)); } } if(EndElement.Type(env) != "") // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible { if(SequenceExpressionType == SequenceExpressionType.IsReachableNodes || SequenceExpressionType == SequenceExpressionType.IsReachableNodesViaIncoming || SequenceExpressionType == SequenceExpressionType.IsReachableNodesViaOutgoing) { NodeType nodeType = TypesHelper.GetNodeType(EndElement.Type(env), env.Model); if(nodeType == null) { throw new SequenceParserException(Symbol + ", second argument", "node type", EndElement.Type(env)); } } else { EdgeType edgeType = TypesHelper.GetEdgeType(EndElement.Type(env), env.Model); if(edgeType == null) { throw new SequenceParserException(Symbol + ", second argument", "edge type", EndElement.Type(env)); } } } if(EdgeType != null && EdgeType.Type(env) != "") { string typeString = null; if(EdgeType.Type(env) == "string") { if(EdgeType is SequenceExpressionConstant) typeString = (string)((SequenceExpressionConstant)EdgeType).Constant; } else { typeString = EdgeType.Type(env); } EdgeType edgeType = TypesHelper.GetEdgeType(typeString, env.Model); if(edgeType == null && typeString != null) { throw new SequenceParserException(Symbol + ", third argument", "edge type or string denoting edge type", typeString); } } if(OppositeNodeType!=null && OppositeNodeType.Type(env)!="") { string typeString = null; if(OppositeNodeType.Type(env) == "string") { if(OppositeNodeType is SequenceExpressionConstant) typeString = (string)((SequenceExpressionConstant)OppositeNodeType).Constant; } else { typeString = OppositeNodeType.Type(env); } NodeType nodeType = TypesHelper.GetNodeType(typeString, env.Model); if(nodeType == null && typeString != null) { throw new SequenceParserException(Symbol + ", fourth argument", "node type or string denoting node type", typeString); } } }
public override void Check(SequenceCheckingEnvironment env) { base.Check(env); // check children if(EdgeSet.Type(env) == "") return; // we can't gain access to an attribute type if the variable is untyped, only runtime-check possible if(!EdgeSet.Type(env).StartsWith("set<")) { throw new SequenceParserException(Symbol, "set<Edge> type", EdgeSet.Type(env)); } if(TypesHelper.ExtractSrc(EdgeSet.Type(env)) != "Edge") { throw new SequenceParserException(Symbol, "set<Edge> type", EdgeSet.Type(env)); } }
public override String Type(SequenceCheckingEnvironment env) { if(SequenceExpressionType == SequenceExpressionType.BoundedReachableNodes || SequenceExpressionType == SequenceExpressionType.BoundedReachableNodesViaIncoming || SequenceExpressionType == SequenceExpressionType.BoundedReachableNodesViaOutgoing) { return "set<Node>"; } else // SequenceExpressionType.BoundedReachableEdges || SequenceExpressionType.BoundedReachableEdgesViaIncoming || SequenceExpressionType.BoundedReachableEdgesViaOutgoing { return "set<Edge>"; } }
/// <summary> /// Checks the sequence /expression for errors utilizing the given checking environment /// reports them by exception /// </summary>s public abstract void Check(SequenceCheckingEnvironment env);
public override string Type(SequenceCheckingEnvironment env) { return("boolean"); }
public override String Type(SequenceCheckingEnvironment env) { return "map<Node,int>"; }