Examples of CodeAnalyser


Examples of org.openquark.cal.compiler.CodeAnalyser

    /**
     * Tests getAutoburnInfo() with a two-argument gem where both arguments are pre-burnt.
     */
    public void testAutoburnDualArgGemBothArgsBurnt() {
        CodeAnalyser codeAnalyser = new CodeAnalyser(calServices.getTypeChecker(),
                                                     calServices.getCALWorkspace().getMetaModule(testModule).getTypeInfo(),
                                                     true,
                                                     false);

        GemGraph gemGraph = new GemGraph();
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

    /**
     * Test autoburning of a gem that has a bound connection.
     */
    public void testAutoburnBoundGem() {
        // Create a new code analyser so we can build code gems
        CodeAnalyser codeAnalyser = new CodeAnalyser(calServices.getTypeChecker(),
                                                     calServices.getCALWorkspace().getMetaModule(testModule).getTypeInfo(),
                                                     true,
                                                     false);
       
        // Create the code gem that will be bound to the primary source gem.
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

    /**
     * Test autoburning of a gem that has a bound connection and one of it's inputs already burnt.
     */
    public void testAutoburnBoundAndBurntGem() {
        //Create a new code analyser so we can build code gems
        CodeAnalyser codeAnalyser = new CodeAnalyser(calServices.getTypeChecker(),
            calServices.getCALWorkspace().getMetaModule(testModule).getTypeInfo(),
            true,
            false);
        GemGraph gemGraph = new GemGraph();
       
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

    /**
     * Tests autoburning on a code gem that outputs a function even before any arguments are burnt.
     */
    public void testAutoburnFunctionGem() {
        // Create a new code analyzer so we can build code gems
        CodeAnalyser codeAnalyser = new CodeAnalyser(calServices.getTypeChecker(),
                calServices.getCALWorkspace().getMetaModule(testModule).getTypeInfo(),
                true,
                false);
       
        // Create a gem whose output type is Num a => [a] -> [a]
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

     * Second test autoburning a code gem that outputs a function even before any arguments are burnt.
     * In this case, the test is designed so that burning the input is necessary.
     */
    public void testAutoburnFunctionGem2() {
        // Create a new code analyser so we can build code gems
        CodeAnalyser codeAnalyser = new CodeAnalyser(calServices.getTypeChecker(),
                calServices.getCALWorkspace().getMetaModule(testModule).getTypeInfo(),
                true,
                false);
       
        // Create a gem with output type Num b => [b] -> [b] and input type a
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

            }
           
            ModuleNameResolver oldExpressionContextModuleNameResolver = moduleTypeInfo.getModuleNameResolver();
            String newExpressionString = typeChecker.calculateUpdatedCodeExpression(oldExpression.getExpressionText(), oldExpression.getModuleContext(), oldExpressionContextModuleNameResolver, oldExpression.getQualificationMap(), oldName, newName, category, null);
           
            CodeAnalyser codeAnalyser = new CodeAnalyser(typeChecker, moduleTypeInfo, false, false);
            MessageLogger logger = new MessageLogger();
            QualificationResults qualificationResults = codeAnalyser.qualifyExpression(newExpressionString, null, oldExpression.getQualificationMap(), logger);
            if (qualificationResults == null) {
                // failed to parse.
                String featureName = functionalAgentMetadata.getFeatureName().getName();
                String errorMessage =
                    "Can not update the metadata for " + featureName + ", example " + (i + 1) + ", since it could not be parsed.\n" +
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

   
    /**
     * @return the code analyzer for code gems in the GemCutter.
     */
    CodeAnalyser getCodeGemAnalyser() {
        return new CodeAnalyser(getTypeChecker(), getPerspective().getWorkingModuleTypeInfo(), true, false);
    }
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

        setLayout(new BorderLayout(5, 5));
        add(getSplitPane(), BorderLayout.CENTER);
        add(buttonBox, BorderLayout.EAST);
        add(statusLabel, BorderLayout.SOUTH);
       
        codeAnalyser = new CodeAnalyser(owner.getTypeChecker(), moduleTypeInfo, false, false);
        editorTransferHandler = new CodeGemEditor.EditorTextTransferHandler(getCALEditor().getTransferHandler(), codeAnalyser);
        editorTransferHandler.setUserQualifiedIdentifiers(userResolvedAmbiguities);
        getCALEditor().setTransferHandler(editorTransferHandler);
       
        // Add popup menu providers
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

     */
    public void setModuleName(ModuleName moduleName) {
        this.moduleTypeInfo = owner.getPerspective().getMetaModule(moduleName).getTypeInfo();
       
        // Create new code analyser and editor transfer handle, since they depend on the current module
        codeAnalyser = new CodeAnalyser(owner.getTypeChecker(), moduleTypeInfo, false, false);
        editorTransferHandler = new CodeGemEditor.EditorTextTransferHandler(getCALEditor().getTransferHandler(), codeAnalyser);
       
        // Module change may affect visibility of qualifications in code, so update them
        if (!calEditor.getText().equals("")) {
            if (userResolvedAmbiguities == null) {
View Full Code Here

Examples of org.openquark.cal.compiler.CodeAnalyser

     * @param expression
     * @param messageLogger logger to hold errors encountered in auto-qualification
     * @return expression with updated qualified code and map; null if errors occurred
     */
    private static CALExpression qualifyExpression(NavFrameOwner owner, CALExpression expression, CompilerMessageLogger messageLogger) {
        CodeAnalyser analyser = new CodeAnalyser(
                owner.getTypeChecker(),
                owner.getPerspective().getMetaModule(expression.getModuleContext()).getTypeInfo(),
                true,
                true);
        CodeAnalyser.QualificationResults qualificationResults =
                analyser.qualifyExpression(expression.getExpressionText(), null, expression.getQualificationMap(), messageLogger);
        if (qualificationResults == null) {
            return null;
        }

        return new CALExpression(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.