Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CALDocComment


                        } else {                           
                            ScopedEntityNamingPolicy scopedEntityNamingPolicy = new ScopedEntityNamingPolicy.UnqualifiedUnlessAmbiguous(typeInfo);
                           
                            iceLogger.log(Level.INFO, qualifiedFunctionName + " :: " + function.getTypeExpr().toString(true, scopedEntityNamingPolicy) + "\n");
                           
                            CALDocComment comment;
                            String kind;
                            if (function instanceof Function) {
                                comment = ((Function)function).getCALDocComment();
                                kind = "function";
                            } else {
View Full Code Here


                        String typeName = qualifiedTypeName.getUnqualifiedName();
                        TypeConstructor typeCons = typeInfo.getTypeConstructor(typeName);
                        if (typeCons == null) {
                            iceLogger.log(Level.INFO, "The type constructor " + qualifiedTypeName + " does not exist.");
                        } else {
                            CALDocComment comment = typeCons.getCALDocComment();
                            if (comment != null) {
                                iceLogger.log(Level.INFO, "CALDoc for the " + qualifiedTypeName + " type constructor:\n" + CALDocToTextUtilities.getTextFromCALDocComment(comment));
                            } else {
                                iceLogger.log(Level.INFO, "There is no CALDoc for the " + qualifiedTypeName + " type constructor.");
                            }
View Full Code Here

                        } else {
                            ScopedEntityNamingPolicy scopedEntityNamingPolicy = new ScopedEntityNamingPolicy.UnqualifiedUnlessAmbiguous(typeInfo);
                           
                            iceLogger.log(Level.INFO, qualifiedDataConsName + " :: " + dataCons.getTypeExpr().toString(scopedEntityNamingPolicy) + "\n");
                           
                            CALDocComment comment = dataCons.getCALDocComment();
                            if (comment != null) {
                                iceLogger.log(Level.INFO, "CALDoc for the " + qualifiedDataConsName + " data constructor:\n" + CALDocToTextUtilities.getTextFromCALDocComment(comment, dataCons, scopedEntityNamingPolicy));
                            } else {
                                iceLogger.log(Level.INFO, "There is no CALDoc for the " + qualifiedDataConsName + " data constructor.\n" + CALDocToTextUtilities.getTextForArgumentsAndReturnValue(null, dataCons, scopedEntityNamingPolicy));
                            }
View Full Code Here

                        String typeClassName = qualifiedTypeClassName.getUnqualifiedName();
                        TypeClass typeClass = typeInfo.getTypeClass(typeClassName);
                        if (typeClass == null) {
                            iceLogger.log(Level.INFO, "The type class " + qualifiedTypeClassName + " does not exist.");
                        } else {
                            CALDocComment comment = typeClass.getCALDocComment();
                            if (comment != null) {
                                iceLogger.log(Level.INFO, "CALDoc for the " + qualifiedTypeClassName + " type class:\n" + CALDocToTextUtilities.getTextFromCALDocComment(comment));
                            } else {
                                iceLogger.log(Level.INFO, "There is no CALDoc for the " + qualifiedTypeClassName + " type class.");
                            }
View Full Code Here

                        ClassInstance instance = typeInfo.getVisibleClassInstance(id);
                       
                        if (instance == null) {
                            iceLogger.log(Level.INFO, "The instance " + id + " does not exist.");
                        } else {
                            CALDocComment comment = instance.getCALDocComment();
                            if (comment != null) {
                                iceLogger.log(Level.INFO, "CALDoc for the " + id + " instance:\n" + CALDocToTextUtilities.getTextFromCALDocComment(comment));
                            } else {
                                iceLogger.log(Level.INFO, "There is no CALDoc for the " + id + " instance.");
                            }
View Full Code Here

                            iceLogger.log(Level.INFO, methodName + " :: " + instanceMethodTypeExpr.toString(scopedEntityNamingPolicy) + "\n");
                           
                            ClassMethod classMethod = instance.getTypeClass().getClassMethod(methodName);
                           
                            try {
                                CALDocComment comment = instance.getMethodCALDocComment(methodName);
                                if (comment != null) {
                                    iceLogger.log(Level.INFO, "CALDoc for the " + methodName + " method in the " + id + " instance:\n" + CALDocToTextUtilities.getTextFromCALDocComment(comment, classMethod, instanceMethodTypeExpr, scopedEntityNamingPolicy));
                                } else {
                                    CALDocComment classMethodCALDoc = classMethod.getCALDocComment();
                                    String classMethodDoc;
                                    if (classMethodCALDoc != null) {
                                        classMethodDoc = CALDocToTextUtilities.getTextFromCALDocComment(classMethodCALDoc, classMethod, instanceMethodTypeExpr, scopedEntityNamingPolicy);
                                    } else {
                                        classMethodDoc = CALDocToTextUtilities.getTextForArgumentsAndReturnValue(classMethodCALDoc, classMethod, instanceMethodTypeExpr, scopedEntityNamingPolicy);
View Full Code Here

        JavaClassRep bindingClass =
            new JavaClassRep (bindingClassTypeName, JavaTypeName.OBJECT, Modifier.PUBLIC | Modifier.FINAL, EMPTY_TYPE_NAME_ARRAY);
       
        // We want to insert the CALDoc comment for the module as a comment for the class.
        JavaDocComment jdc;
        CALDocComment moduleComment = moduleTypeInfo.getCALDocComment();
        if (moduleComment != null) {
            String convertedComment = calDocCommentToJavaComment (moduleComment, null, true);
            jdc = new JavaDocComment (convertedComment);
        } else {
            // If there is no module comment from the CAL source we should just
View Full Code Here

        for (final Map.Entry<String, FunctionalAgent> entry : nameToFuncInfo.entrySet()) {
          
            String calFuncName = entry.getKey();
            FunctionalAgent functionalAgent = entry.getValue();

            CALDocComment cdc = functionalAgent.getCALDocComment();

            // We need to make sure the name for the helper function/qualified name field is
            // a valid java name.
            String javaFuncName = fixupVarName(calFuncName);
           
            // Add a binding method for the CAL function.
            // Essentially this method builds an application
            // of the function to the supplied arguments using our
            // source model.
           
            // Build up the argument names and types.
            TypeExpr te = functionalAgent.getTypeExpr();
            int nArgs = te.getArity();
            int nNamedArgs = functionalAgent.getNArgumentNames();
           
            String paramNames[] = CALDocToJavaDocUtilities.getArgumentNamesFromCALDocComment(cdc, functionalAgent);
            if (paramNames.length != nArgs)  {
                throw new NullPointerException ("Mismatch between arity and number of arguments for " + calFuncName);
            }
            String origParamNames[] = new String[paramNames.length];
            System.arraycopy(paramNames, 0, origParamNames, 0, origParamNames.length);
           
            JavaTypeName paramTypes[] = new JavaTypeName [paramNames.length];
           
            // If we have named arguments we should use those names.
            Set<String> paramNamesSet = new HashSet<String>();
            for (int i = 0; i < paramNames.length; ++i) {
                String name = paramNames[i];

                if (name == null) {
                    if (i < nNamedArgs) {
                        name = functionalAgent.getArgumentName(i);
                    }
                   
                    if (name == null || name.equals("")) {
                        name = null;
                        // There is no name for this argument in the functional entity.  This
                        // usually occurs with foreign functions and class methods because
                        // you don't have to explicitly name the arguments.
                       
                        // Check to see if there was a CALDoc comment that named the arguments.
                        if (cdc != null && cdc.getNArgBlocks() == paramNames.length) {
                            name = cdc.getNthArgBlock(i).getArgName().getCalSourceForm();
                        }
                       
                        // If we still don't have an argument name just build one.
                        if (name == null) {
                            name = "arg_" + (i+1);
View Full Code Here

            JavaFieldDeclaration jfd =
                makeQualifiedNameDeclaration(fieldName, typeConstructorName);

            // Add JavaDoc for the field declaration.  We use the CALDoc if there is any.
            JavaDocComment typeConstructorComment;
            CALDocComment cdc = typeCons.getCALDocComment();
            if (cdc != null) {
                typeConstructorComment = new JavaDocComment(calDocCommentToJavaComment(cdc, null, false));
            } else {
                typeConstructorComment = new JavaDocComment("/** Name binding for TypeConsApp: " + typeConstructorName + ". */");
            }
View Full Code Here

                                   null, javaFuncName);
                dataConstructorsClass.addMethod(bindingFunction);
               
                // Add JavaDoc for the method.
                JavaDocComment funcComment;
                CALDocComment cdc = dc.getCALDocComment();
                if (cdc != null) {
                    funcComment = new JavaDocComment(calDocCommentToJavaComment(cdc, dc, false, argNames));
                    funcComment = fixupJavaDoc(funcComment, origArgNames, argNames);
                } else {
                    funcComment = new JavaDocComment("Binding for DataConstructor: " + dc.getName().getQualifiedName() + ".");
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.CALDocComment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.