Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CALDocComment


       
        } else if (metadata.getLongDescription() != null) {
            text.append("<br>").append(wrapTextToHTMLLines(metadata.getLongDescription(), parent));           
        } else {
            // If there is neither a short nor a long description, display the CALDoc description instead.
            CALDocComment caldoc = gem.getGemEntity().getFunctionalAgent().getCALDocComment();
            if (caldoc != null) {
                String caldocDesc = NavHtmlFactory.getHtmlForCALDocSummaryWithNoHyperlinks(caldoc, locale, true);
                if (caldocDesc.length() > 0) {
                    text.append(caldocDesc);
                } else {
View Full Code Here


            text.append("<br>");
            text.append(wrapTextToHTMLLines(metadata.getLongDescription(), parent));
            text.append("<br>");
        } else {
            // If there is neither a short nor a long description, display the CALDoc description instead.
            CALDocComment caldoc = scopedEntity.getCALDocComment();
            if (caldoc != null) {
                String caldocDesc = getHTMLForBoundedToolTipText(
                    NavHtmlFactory.getHtmlForCALDocSummaryWithNoHyperlinks(caldoc, locale, true), TOOLTIP_MAX_WIDTH, 0, true, parent);
               
                if (caldocDesc.length() > 0) {
                    text.append(caldocDesc);
                } else {
                    text.append("<br>");
                }
            } else {
                text.append("<br>");
            }
        }

        if (metadata instanceof FunctionalAgentMetadata) {

            FunctionalAgent envEntity = (FunctionalAgent)scopedEntity;
            PolymorphicVarContext polymorphicVarContext = PolymorphicVarContext.make();
            TypeExpr[] typePieces = envEntity.getTypeExpr().getTypePieces();

            CALDocComment caldoc = envEntity.getCALDocComment();

            // Add the result type.           
            text.append("<br>");
            text.append("<b>");
            text.append(GemCutter.getResourceString("ToolTipHelper_Returns"));
            text.append("</b>");
            text.append("<br>");
            String returnValueIndicator = "<i>" + GemCutter.getResourceString("ToolTipHelper_ReturnValueIndicator") + "</i>";
            String returnType = typePieces[typePieces.length - 1].toString(polymorphicVarContext, namingPolicy);
            String returnValueMetadata;
            if (metadata instanceof FunctionMetadata) {
                returnValueMetadata = ((FunctionMetadata)metadata).getReturnValueDescription();
            } else if (metadata instanceof ClassMethodMetadata) {
                returnValueMetadata = ((ClassMethodMetadata)metadata).getReturnValueDescription();
            } else {
                returnValueMetadata = null;
            }
            CALDocComment.TextBlock returnValueCALDoc;
            if (caldoc != null) {
                returnValueCALDoc = caldoc.getReturnBlock();
            } else {
                returnValueCALDoc = null;
            }
            buildTypeSignatureAndDescription(parent, text, returnValueIndicator, returnType, returnValueMetadata, returnValueCALDoc, true);
   
            // Add the argument descriptions
            NavAddressHelper.isMetadataValid(envEntity, (FunctionalAgentMetadata) metadata);
            ArgumentMetadata[] arguments = ((FunctionalAgentMetadata) metadata).getArguments();
            NavAddressHelper.adjustArgumentNames(envEntity, arguments);

            if (arguments.length > 0) {
                text.append("<br>");               
                text.append("<b>");
                text.append(GemCutter.getResourceString("ToolTipHelper_Arguments"));
                text.append("</b>");
   
                // Process the tagged blocks in the CALDoc to extract the @arg blocks.
                text.append("<br>");
                for (int i = 0; i < arguments.length; i++) {
                    String displayName = arguments[i].getDisplayName();
                    String type = typePieces[i].toString(polymorphicVarContext, namingPolicy);
                    String descriptionFromMetadata = arguments[i].getShortDescription();
                    CALDocComment.TextBlock descriptionFromCALDoc;
                    if (caldoc != null && i < caldoc.getNArgBlocks()) {
                        descriptionFromCALDoc = caldoc.getNthArgBlock(i).getTextBlock();
                    } else {
                        descriptionFromCALDoc = null;
                    }
                   
                    boolean shouldEmitLineBreakSuffix = i < arguments.length - 1;
View Full Code Here

                    int argNum = inputPart.getInputNum();
                    argDesc = argNum < gemArguments.length ? gemArguments[argNum].getShortDescription() : null;
                   
                    // If there is no description of the gem argument, display the CALDoc instead.
                    if (argDesc == null) {
                        CALDocComment caldoc = faGem.getGemEntity().getFunctionalAgent().getCALDocComment();
                       
                        if (caldoc != null) {
                            if (argNum < caldoc.getNArgBlocks()) {
                                argCALDocDesc = NavHtmlFactory.getHtmlForCALDocTextBlockWithNoHyperlinks(caldoc.getNthArgBlock(argNum).getTextBlock(), true);
                            }
                        }
                    }
                }
               
                CollectorGem argTargetGem = GemGraph.getInputArgumentTarget(inputPart);
                if (argTargetGem != null) {
                    argTarget = argTargetGem.getUnqualifiedName();
                }
            }
        } else if (part instanceof Gem.PartOutput) {
           
            Gem gem = part.getGem();
            Gem.PartOutput outputPart = (Gem.PartOutput)part;
           
            if (!outputPart.isConnected() && gem instanceof FunctionalAgentGem) {
                FunctionalAgentGem faGem = (FunctionalAgentGem) gem;
                FunctionalAgentMetadata gemMetadata = faGem.getGemEntity().getMetadata(GemCutter.getLocaleFromPreferences());

                if (gemMetadata instanceof FunctionMetadata) {
                    argDesc = ((FunctionMetadata)gemMetadata).getReturnValueDescription();
                } else if (gemMetadata instanceof ClassMethodMetadata) {
                    argDesc = ((ClassMethodMetadata)gemMetadata).getReturnValueDescription();
                } else {
                    argDesc = null;
                }
               
                // If there is no description of the return value, display the CALDoc instead.
                if (argDesc == null) {
                    CALDocComment caldoc = faGem.getGemEntity().getFunctionalAgent().getCALDocComment();
                   
                    if (caldoc != null) {
                        CALDocComment.TextBlock returnBlock = caldoc.getReturnBlock();
                        if (returnBlock != null) {
                            argCALDocDesc = NavHtmlFactory.getHtmlForCALDocTextBlockWithNoHyperlinks(returnBlock, true);
                        }
                    }
                }
View Full Code Here

     * @param programModelManager the ProgramModelManager for the program containing the entity.
     * @param entity the ScopedEntity to be documented.
     * @return the HTML for the documentation.
     */
    public static String getHTMLForCALDocCommentOfScopedEntity(final ProgramModelManager programModelManager, final ScopedEntity entity) {
        final CALDocComment caldoc = entity.getCALDocComment();
       
        final HTMLDocumentationGeneratorConfiguration config = makeBareboneConfiguration();
        final HTMLDocumentationGenerator docGenerator = new HTMLDocumentationGenerator(programModelManager, null, config, true);
        docGenerator.startNewCurrentPageWithModule(entity.getName().getModuleName());
       
View Full Code Here

     * @param entity the ScopedEntity to be documented.
     * @param localFunctionOrPatternMatchVar the variable to be documented.
     * @return the HTML for the documentation.
     */
    private static String getHTMLForCALDocCommentOfLocalFunctionOrPatternMatchVar(final ProgramModelManager programModelManager, final Function entity, final IdentifierInfo.Local localFunctionOrPatternMatchVar) {
        final CALDocComment caldoc = entity.getCALDocComment();
       
        final HTMLDocumentationGeneratorConfiguration config = makeBareboneConfiguration();
        final HTMLDocumentationGenerator docGenerator = new HTMLDocumentationGenerator(programModelManager, null, config, true);
        docGenerator.startNewCurrentPageWithModule(entity.getName().getModuleName());
       
View Full Code Here

     * @param entity the ScopedEntity of the associated top-level/local function or class method.
     * @param parameter the parameter to be documented.
     * @return the HTML for the documentation.
     */
    public static String getHTMLForCALDocCommentOfFunctionParameter(final ProgramModelManager programModelManager, final FunctionalAgent entity, final IdentifierInfo.Local.Parameter parameter) {
        final CALDocComment caldoc = entity.getCALDocComment();
       
        final HTMLDocumentationGeneratorConfiguration config = makeBareboneConfiguration();
        final HTMLDocumentationGenerator docGenerator = new HTMLDocumentationGenerator(programModelManager, null, config, true);
        docGenerator.startNewCurrentPageWithModule(entity.getName().getModuleName());
       
View Full Code Here

        docGenerator.tooltip_generateDataConsFieldNameEntry(dataConsField);

        for (final DataConstructor dataCons : entities) {
            docGenerator.tooltip_generateHorizontalRule();

            final CALDocComment caldoc = dataCons.getCALDocComment();
            final String unqualifiedName = dataCons.getName().getUnqualifiedName();
           
            docGenerator.tooltip_generateDefListOpen();
            docGenerator.generateFunctionalAgentDoc(unqualifiedName, (FunctionalAgent)dataCons, "", (FunctionalAgentMetadata)MetadataManager.getEmptyMetadata(dataCons, LocaleUtilities.INVARIANT_LOCALE), caldoc, 0, false);
            docGenerator.tooltip_generateDefListClose();
View Full Code Here

     * Generates a plain text representation for a CALDoc comment of a ScopedEntity.
     * @param entity the entity with the CALDoc comment.
     * @return a plain text representation for the comment, or null if the entity does not have a CALDoc comment.
     */
    public static String getTextFromCALDocCommentOfScopedEntity(final ScopedEntity entity) {
        final CALDocComment caldoc = entity.getCALDocComment();
        if (caldoc == null) {
            return null;
        }
       
        if (entity instanceof FunctionalAgent) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    void generateUsageDocInstanceIndexEntry(ScopedEntity documentedEntity, ClassInstance classInstance) {
        CALFeatureMetadata metadata = getMetadata(CALFeatureName.getClassInstanceFeatureName(classInstance), getLocale());
        CALDocComment docComment = classInstance.getCALDocComment();

        /// Generate the name of the class instance
        //
        currentPage
            .openTag(HTML.Tag.TR, classAttribute(getScopeStyleClass(minScopeForInstanceClassAndInstanceType(classInstance))))
View Full Code Here

     * @param moduleName the module to be described.
     */
    private void generateShortDescriptionForModule(final ModuleName moduleName) {
        ModuleTypeInfo moduleTypeInfo = programModelManager.getModuleTypeInfo(moduleName);
        CALFeatureMetadata metadata = getMetadata(CALFeatureName.getModuleFeatureName(moduleName), getLocale());
        CALDocComment docComment = moduleTypeInfo.getCALDocComment();

        generateShortDescription(metadata, docComment, new ReferenceGenerator(MODULES_SUBDIRECTORY));
    }
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.