Exemple #1
0
    public CoreClassifier parseType(
        EnvironmentImpl environment,
        string name)
    {
        CSTNode       node  = null;
        List <object> nodes = null;

        try {
            nodes = compileOclStream(name, "", new StreamWriter(new MemoryStream()), typeof(CSTTypeCS));
            node  = (CSTNode)nodes[0];
        } catch (Exception e) {
            Console.WriteLine(e.Message);
        }

        if (node != null)
        {
            CSTTypeCS typeNode = (CSTTypeCS)node;
            parsedTypes.Add(typeNode.getAst().getFullPathName(), nodes);
            return(typeNode.getAst());
        }
        else
        {
            return(null);
        }
    }
Exemple #2
0
 public CSTAttrOrAssocContextCS(
     CSTPathNameCS pathName,
     CSTTypeCS type,
     CSTInitDerivedValueCS value)
 {
     this.pathNameNodeCS        = pathName;
     this.typeNodeCS            = type;
     this.valueExpressionNodeCS = value;
 }
 public CSTOperationCS(
     CSTNameCS name,
     List <object> parameters,
     CSTTypeCS returnType)
 {
     this.nameNodeCS        = name;
     this.parametersNodesCS = parameters;
     this.returnTypeNodeCS  = returnType;
 }
 public CSTDefVarExpressionCS(
     CSTNameCS name,
     CSTTypeCS type,
     CSTExpressionInOclCS expression)
 {
     this.nameNodeCS       = name;
     this.typeNodeCS       = type;
     this.expressionNodeCS = expression;
 }
        public CoreClassifier doParseTestOK(String stream, String inputName, String resultName, Type className)
        {
            try {
                CSTNode node = parseOK(stream, inputName);
                Assert.IsTrue(node is CSTTypeCS);
                CSTTypeCS type = (CSTTypeCS)node;

                CoreClassifier ast = type.getAst();
                Assert.IsNotNull(ast);
                Assert.AreEqual(resultName, ast.getName());
                Assert.IsTrue(className.IsInstanceOfType(ast));
                return(ast);
            }
            catch (Exception e) {
                Console.WriteLine(e.StackTrace);
                throw new AssertFailedException();
            }

            return(null);
        }