Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CompilerMessage


           
            List<CompilerMessage> compilerMessages = logger.getCompilerMessages(CompilerMessage.Severity.WARNING);
            if (!compilerMessages.isEmpty()) {
                int size = compilerMessages.size();
                for (int i = 0; i < size; i++) {
                    CompilerMessage message = compilerMessages.get(i);
                    System.err.println(message.toString());
                }
            }
        }

        return calServices;
View Full Code Here


    private static class MessageRenderer extends JLabel implements ListCellRenderer {
        private static final long serialVersionUID = 6898987006278555574L;

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
           
            CompilerMessage message = (CompilerMessage)value;
           
            if(message.getSeverity() == CompilerMessage.Severity.FATAL) {
                setIcon(ERROR_ICON);
           
            } else if(message.getSeverity() == CompilerMessage.Severity.ERROR) {
                setIcon(ERROR_ICON);

            } else if(message.getSeverity() == CompilerMessage.Severity.WARNING) {
                setIcon(WARNING_ICON);
           
            } else if(message.getSeverity() == CompilerMessage.Severity.INFO) {
                setIcon(INFO_ICON);
            }
           
            setText(message.toString());
            return this;
        }
View Full Code Here

        calServices.addNewModule(moduleDefn, logger);
       
        if (logger.getNErrors() > 0) {
            List<CompilerMessage> messages = logger.getCompilerMessages();
            for (int i = 0, n = messages.size(); i < n; i++) {
                CompilerMessage message = messages.get(i);
                if (CompilerTestUtilities.isInternalCodingError(message.getMessageKind())) {
                     fail("Unexpected: " + message);
                }
            }
        } else {
            fail("Expected error, but there were none.");
View Full Code Here

       
        // Write out compiler messages
        java.util.List<CompilerMessage> errs = ml.getCompilerMessages();
        int errsSize = errs.size();
        for (int i = 0; i < errsSize; i++) {
            CompilerMessage err = errs.get(i);
            jfitLogger.info("  " + err.toString());
        }
       
        jfitLogger.fine("CAL: Finished compiling in " + compileTime + "ms");
       
        this.calWorkspace = workspaceManager.getWorkspace();
View Full Code Here

        outputValueNode = valueNodeBuilderHelper.getValueNodeForTypeExpr(outputTypeExpr);
        if (outputValueNode == null) {
            // Unable to create an output value node for type: {declaredType}
            throw new ProgramCompileException(CompilerMessage.Severity.ERROR,
                    new CompilerMessage(new MessageKind.Error.UnableToCreateOutputValueNode(declaredType.toString())));
        }
       
        OutputPolicy outputPolicy = null;
        outputPolicy = outputValueNode.getOutputPolicy();
        if (outputPolicy == null) {
            // Unable to retrieve an output policy for type: {declaredType}
            throw new ProgramCompileException(CompilerMessage.Severity.ERROR,
                    new CompilerMessage(new MessageKind.Error.UnableToRetrieveAnOutputPolicy(declaredType.toString())));
        }

        if (getShowConsoleInfo()) {
            System.out.println("Executing:\n" + scDef);
        }
View Full Code Here

                        if (cause instanceof UnableToResolveForeignEntityException) {
                            generateLogger.logMessage(((UnableToResolveForeignEntityException)cause).getCompilerMessage());
                        }
                       
                        // Code generation aborted. Error generating code for: {cl.getQualifiedName()}
                        generateLogger.logMessage(new CompilerMessage(new MessageKind.Error.CodeGenerationAborted(gmf.getQualifiedName().getQualifiedName()), e));
                    } catch (CompilerMessage.AbortCompilation e2) {/* Ignore exceptions generated by the act of logging. */}
                    return generateLogger.getMaxSeverity();
                }
            }


            fixupPushGlobals (module);

        } catch (Exception e) {
            try {
                if (generateLogger.getNErrors() > 0) {
                    //if an error occurred previously, we continue to compile the program to try to report additional
                    //meaningful compilation errors. However, this can produce spurious exceptions related to the fact
                    //that the program state does not satisfy preconditions because of the initial error(s). We don't
                    //report the spurious exception as an internal coding error.
                    generateLogger.logMessage(new CompilerMessage(new MessageKind.Fatal.UnableToRecoverFromCodeGenErrors(module.getName())));
                } else {                              
                    generateLogger.logMessage(new CompilerMessage(new MessageKind.Fatal.CodeGenerationAbortedDueToInternalCodingError(module.getName()), e));
                }                                                                           
            } catch (CompilerMessage.AbortCompilation ace) {
                /* Ignore exceptions generated by the act of logging. */
            }
        } catch (Error e) {
            try {
                generateLogger.logMessage(new CompilerMessage(new MessageKind.Error.CodeGenerationAbortedWithException(module.getName(), e)));
            } catch (CompilerMessage.AbortCompilation ace) {
                /* Ignore exceptions generated by the act of logging. */
            }
        } finally {
            if (logger != null) {
View Full Code Here

     */
    public void compile(ModuleSourceDefinitionGroup definitionGroup, CompilerMessageLogger logger,
            boolean dirtyModulesOnly, StatusListener statusListener, CompilationOptions options) {
       
        if (definitionGroup == null) {
            logger.logMessage(new CompilerMessage(new MessageKind.Fatal.CouldNotFindWorkspaceDefinition()));
            return;
        }
       
        ProgramModifier newProgramModifier = makeProgramModifier(options);
       
View Full Code Here

    /**
     * @return a CompilerMessage which corresponds to this status object.
     */
    public CompilerMessage asCompilerMessage() {
        if (severity == Severity.OK || severity == Severity.INFO) {
            return new CompilerMessage(new MessageKind.Info.DebugMessage(getDebugMessage()));

        } else if (severity == Severity.WARNING) {
            return new CompilerMessage(new MessageKind.Warning.DebugMessage(getDebugMessage()));
       
        } else if (severity == Severity.ERROR) {
            return new CompilerMessage(new MessageKind.Error.DebugMessage(getDebugMessage()));
       
        } else {
            throw new IllegalStateException("Unknown Severity type:" + severity);
        }
    }
View Full Code Here

       
        List<CompilerMessage> messages = logger.getCompilerMessages();
   
        DefaultListModel listModel = (DefaultListModel) errorsList.getModel();
        for (int i = 0, n = messages.size(); i < n; i++) {
            CompilerMessage message = messages.get(i);
            if(message.getSeverity().compareTo(CompilerMessage.Severity.ERROR) < 0) {
                continue;
            }
            if (message.getException() instanceof CALRefactoringException) {
                CALRefactoringException refactoringException = (CALRefactoringException) message.getException();
                listModel.addElement(refactoringException.getDescription());
            } else {
                listModel.addElement(message.getMessage());
            }
        }
       
        informationScrollPane.setVisible(true);
        setSize(getPreferredSize());
View Full Code Here

                if (generateLogger.getNErrors() > 0) {
                    //if an error occurred previously, we continue to compile the program to try to report additional
                    //meaningful compilation errors. However, this can produce spurious exceptions related to the fact
                    //that the program state does not satisfy preconditions because of the initial error(s). We don't
                    //report the spurious exception as an internal coding error.
                    generateLogger.logMessage(new CompilerMessage(new MessageKind.Fatal.UnableToRecoverFromCodeGenErrors(module.getName())));
                } else {
                    generateLogger.logMessage(new CompilerMessage(new MessageKind.Fatal.CodeGenerationAbortedDueToInternalCodingError(module.getName()), e));
                }
            } catch (CompilerMessage.AbortCompilation ace) {/* Ignore and continue. */}
        } catch (Error e) {
            try {
                generateLogger.logMessage(new CompilerMessage(new MessageKind.Error.CodeGenerationAbortedWithException(module.getName(), e), null));
            } catch (CompilerMessage.AbortCompilation ace) {/* Ignore and continue. */}
        } finally {
            if (logger != null) {
                // Log messages to the passed-in logger.
                try {
View Full Code Here

TOP

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

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.