Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CALDocComment$Segment


                        } 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

            JavaFieldDeclaration jfd =
                makeQualifiedNameDeclaration(fieldName, typeClassName);

            // Add JavaDoc.  We use any CALDoc for the type class if available.
            JavaDocComment comment;
            CALDocComment cdc = tc.getCALDocComment();
            if (cdc != null) {
                comment = new JavaDocComment(calDocCommentToJavaComment(cdc, null, false));
            } else {
                comment = new JavaDocComment("/** Name binding for TypeClass: " + tc.getName().getQualifiedName() + ". */");
            }
View Full Code Here

            };
           
            for (final Map.Entry<String, CALDocComment> entry : caldocComments.entrySet()) {
               
                final String entityName = entry.getKey();
                final CALDocComment comment = entry.getValue();
               
                if (comment != null) {
                    if (comment.getDescriptionBlock() != null) {
                        comment.getDescriptionBlock().accept(visitor, entityName);
                    }
                   
                    if (comment.getDeprecatedBlock() != null) {
                        comment.getDeprecatedBlock().accept(visitor, entityName);
                    }

                    for (int j = 0, m = comment.getNArgBlocks(); j < m; j++) {
                        if (comment.getNthArgBlock(j).getTextBlock() != null) {
                            comment.getNthArgBlock(j).getTextBlock().accept(visitor, entityName);
                        }
                    }
                   
                    for (int j = 0, m = comment.getNAuthorBlocks(); j < m; j++) {
                        if (comment.getNthAuthorBlock(j) != null) {
                            comment.getNthAuthorBlock(j).accept(visitor, entityName);
                        }
                    }
                   
                    for (int j = 0, m = comment.getNDataConstructorReferences(); j < m; j++) {
                        if (comment.getNthDataConstructorReference(j) != null) {
                            validateGemReference(comment.getNthDataConstructorReference(j), entityName, workspaceManager, brokenReferences);
                        }
                    }
                    for (int j = 0, m = comment.getNFunctionOrClassMethodReferences(); j < m; j++) {
                        if (comment.getNthFunctionOrClassMethodReference(j) != null) {
                            validateGemReference(comment.getNthFunctionOrClassMethodReference(j), entityName, workspaceManager, brokenReferences);
                        }
                    }
                   
                    for (int j = 0, m = comment.getNModuleReferences(); j < m; j++) {
                        if (comment.getNthModuleReference(j) != null) {
                            validateModuleReference(comment.getNthModuleReference(j), entityName, workspaceManager, brokenReferences);
                        }
                    }
                   
                    for (int j = 0, m = comment.getNTypeClassReferences(); j < m; j++) {
                        if (comment.getNthTypeClassReference(j) != null) {
                            validateTypeClassReference(comment.getNthTypeClassReference(j), entityName, workspaceManager, brokenReferences);
                        }
                    }
                   
                    for (int j = 0, m = comment.getNTypeConstructorReferences(); j < m; j++) {
                        if (comment.getNthTypeConstructorReference(j) != null) {
                            validateTypeConsReference(comment.getNthTypeConstructorReference(j), entityName, workspaceManager, brokenReferences);
                        }
                    }

                    if (comment.getReturnBlock() != null) {
                        comment.getReturnBlock().accept(visitor, entityName);
                    }
                   
                    if (comment.getSummary() != null) {
                        comment.getSummary().accept(visitor, entityName);
                    }
                   
                    if (comment.getVersionBlock() != null) {
                        comment.getVersionBlock().accept(visitor, entityName);
                    }

                }
            }
        }
View Full Code Here

TOP

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

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.