Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.TypeConstructor


                final Function function = moduleInfo.getNthFunction(i);
                caldocComments.put("function " + function.getName().getQualifiedName(), function.getCALDocComment());
            }
           
            for (int i = 0, n = moduleInfo.getNTypeConstructors(); i < n; i++) {
                final TypeConstructor typeCons = moduleInfo.getNthTypeConstructor(i);
                caldocComments.put("type cons " + typeCons.getName().getQualifiedName(), typeCons.getCALDocComment());

                for (int j = 0, m = typeCons.getNDataConstructors(); j < m; j++) {
                    final DataConstructor dataCons = typeCons.getNthDataConstructor(j);
                    caldocComments.put("data cons " + dataCons.getName().getQualifiedName(), dataCons.getCALDocComment());
                }
            }
           
            for (int i = 0, n = moduleInfo.getNTypeClasses(); i < n; i++) {
View Full Code Here


            } else if (listEntryData instanceof TypeConsApp) {
           
                TypeConsApp typeConsApp = (TypeConsApp) listEntryData;
                QualifiedName typeConsName = typeConsApp.getName();
               
                TypeConstructor typeCons = valueEditorManager.getPerspective().getTypeConstructor(typeConsName);
                return ToolTipHelpers.getEntityToolTip(typeCons, getNamingPolicy(), valueEditorManager.getWorkspace(), invoker);
               
            } else {
                throw new IllegalStateException("ParametricValueEditor: Unsupported list entry type");
            }
View Full Code Here

            /**
             * Returns a list of the names of the available connection gems.
             */
            private List <String> fetchConnectionGemNames() {
                TypeConstructor typeConstructor = perspective.getTypeConstructor(CAL_DataGems.TypeConstructors.JDBCConnection);
                final TypeExpr typeExpr = TypeExpr.makeNonParametricType(typeConstructor);

                return fetchGemsOfType(typeExpr);
            }
View Full Code Here

        // Note that below we pass in null for code generation stats
        //   The stats object is used to track stats for generation of the whole module or program (which we aren't doing here).
        //   We can pass a non-null object if in future we want to track stats for a single program.
        if (typeName != null) {
            // Get the class from the type definition builder.
            TypeConstructor typeConstructor = module.getModuleTypeInfo().getTypeConstructor(typeName);
            return DataTypeDefinitionBuilder.getClassRep(typeConstructor, unqualifiedClassName, module, null);
        } else {
            // Get the class from the function definition builder.
            String functionName = CALToJavaNames.getUnqualifiedFunctionNameFromClassName(moduleName, outerClassName, module);
            MachineFunction mf = module.getFunction(functionName);
View Full Code Here

        // Note that below we pass in null for code generation stats
        //   The stats object is used to track stats for generation of the whole module or program (which we aren't doing here).
        //   We can pass a non-null object if in future we want to track stats for a single program.
        if (typeName != null) {
            // Get the class from the type definition builder.
            TypeConstructor typeConstructor = module.getModuleTypeInfo().getTypeConstructor(typeName);
            return DataTypeDefinitionBuilder.getDataTypeDefinition(typeConstructor, module, null);
        } else {
            // Get the class from the function definition builder.
            String functionName = CALToJavaNames.getUnqualifiedFunctionNameFromClassName(moduleName, outerClassName, module);
            MachineFunction mf = module.getFunction(functionName);
View Full Code Here

                    fieldInitializer =
                        new MethodInvocation.Static(jf.getFieldType(), "make", JavaExpression.EMPTY_JAVA_EXPRESSION_ARRAY, JavaExpression.EMPTY_TYPE_NAME_ARRAY, jf.getFieldType());
                } else {
                    // This is a zero arity data constructor.  We get the singleton instance by accessing
                    // the DataType class factory method if the data type has more than one zero arity DC.
                    TypeConstructor typeCons = dc.getTypeConstructor();
                    if (SCJavaDefn.isTagDC(dc, module)) {
                        JavaTypeName typeClass = CALToJavaNames.createTypeNameFromType(typeCons, module);
                        JavaTypeName tagDCTypeName = CALToJavaNames.createTypeNameForTagDCFromType(typeCons, module);
                        Integer ordinal = Integer.valueOf(dc.getOrdinal());
                        fieldInitializer = new MethodInvocation.Static(typeClass, "getTagDC", LiteralWrapper.make(ordinal), JavaTypeName.INT, tagDCTypeName);
View Full Code Here

        int numTypes =
                perspective.getWorkingModuleTypeInfo().getNTypeConstructors();
       
        for (int i = 0; i < numTypes; i++) {
           
            TypeConstructor typeCons =
                    perspective.getWorkingModuleTypeInfo().getNthTypeConstructor(i);

            try {
                if (perspective.isEnumDataType(typeCons.getName()) &&
                    perspective.getWorkspace().checkDefinitionContent(perspective.getWorkingModuleName(),
                                                                      typeCons.getName().getUnqualifiedName(),
                                                                      GeneratorMessages.getString("ETGF_CALDeclComment"))) {
                   
                    allEnumerationNamesList.add(typeCons.getName().getUnqualifiedName());
                }
               
            } catch (IOException ex) {
                JOptionPane.showMessageDialog(this, GeneratorMessages.getString("ETGF_ErrorReadingEnums") + ex.getLocalizedMessage(),
                                             GeneratorMessages.getString("ETGF_PopulateFailed"), JOptionPane.ERROR_MESSAGE);
View Full Code Here

     * @return true if specified enumeration exists; false if not
     */
    private boolean retrieveEnumerationValues(String enumName) {
        ModuleTypeInfo workingModuleTypeInfo = perspective.getWorkingModuleTypeInfo();
       
        TypeConstructor typeCons = workingModuleTypeInfo.getTypeConstructor(enumName);
       
        if (typeCons != null) {
            ((DefaultListModel)enumListControl.getModel()).clear();
           
            if(typeCons.getScope() == Scope.PUBLIC) {
                publicButton.doClick();
            } else {
                privateButton.doClick();
            }
           
            int constructors = typeCons.getNDataConstructors();
            for (int i = 0; i < constructors; i++) {
                QualifiedName constructorName = typeCons.getNthDataConstructor(i).getName();
                ((DefaultListModel)enumListControl.getModel()).addElement(constructorName.getUnqualifiedName());
            }
           
            // We need to determine whether the existing enumeration has only a derived Eq instance,
            // or the full complement of derived instances (i.e. Eq, Ord, Bounded, Enum), so that
View Full Code Here

     *               This is used for obtaining the appropriate {@link LECCModule.ClassNameMapper} for use in mapping names.
     * @return the class name
     */
    private static String createClassNameFromDC (DataConstructor dc, LECCModule module) {
        // Determine whether this DC is going to be in a shared class.
        TypeConstructor typeCons = dc.getTypeConstructor();
       
        boolean inSharedClass = false;
        if (dc.getArity() == 0) {
            int nTagDCs = 0;
            for (int i = 0, nDCs = typeCons.getNDataConstructors(); i < nDCs; ++i) {
                if (typeCons.getNthDataConstructor(i).getArity() == 0) {
                    nTagDCs++;

                    if (nTagDCs > 1) {
                        inSharedClass = true;
                        break;
View Full Code Here

                    // This can either be a supercombinator or a data declaration
                    PackCons packCons = label.getExpressionForm().asPackCons();
                    if (packCons != null) {
                        // This is a data declaration
                        TypeConstructor typeCons = packCons.getDataConstructor().getTypeConstructor();

                        if (LECCMachineConfiguration.TREAT_ENUMS_AS_INTS && TypeExpr.isEnumType(typeCons)) {
                            //System.out.println ("**** skipping data type because it is enum: " + typeConsName);
                            continue;
                        }
View Full Code Here

TOP

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

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.