Changeset 2391


Ignore:
Timestamp:
Feb 11, 2007, 2:59:28 PM (14 years ago)
Author:
roman
Message:

Import checker

Location:
devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/Checker.java

    r2373 r2391  
    1212                        return;
    1313
    14                 ImportChecker.check(astImplem, environment);
     14                ImportChecker.checkImportLists(astImplem, environment);
     15                if (msgHandler.getErrorCount() > 0)
     16                        return;
     17               
     18                ImportChecker.populateImports(astImplem, environment);
    1519                if (msgHandler.getErrorCount() > 0)
    1620                        return;
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/CompilerEnvironment.java

    r2370 r2391  
    88       
    99        String getModuleName();
    10         Reader getInterfReader();
     10        Reader getInterfReader(String moduleName);
    1111        Reader getImplemReader();
    12         Reader getModuleInterfReader(String moduleName);
    1312       
    1413        void ReportImportedModules(String[] moduleNames);
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/ImportChecker.java

    r2378 r2391  
    11package org.refal.plus.comp;
    22
     3import java.io.Reader;
    34import java.util.ArrayList;
    45import java.util.Collections;
    56
    67import org.refal.plus.comp.ast.AstImplem;
     8import org.refal.plus.comp.ast.AstInterf;
    79import org.refal.plus.comp.ast.AstName;
    810import org.refal.plus.comp.ast.AstUse;
    911
    1012public class ImportChecker {
    11 
    12         public static void check(AstImplem astImplem,
     13       
     14        public static void checkImportLists(AstImplem astImplem,
    1315                        CompilerEnvironment environment) {
    1416                MsgHandler msgHandler = environment.getMsgHandler();
     
    3941        public static void populateImports(AstImplem astImplem,
    4042                        CompilerEnvironment environment) {
     43                MsgHandler msgHandler = environment.getMsgHandler();
    4144                AstUse[] astUseList = astImplem.useList;
    4245                for (AstUse astUse : astUseList) {
    43                         String moduleName = astUse.name.identifier;
     46                        AstName astName = astUse.name;
     47                        String moduleName = astName.identifier;
     48                        Reader reader = environment.getInterfReader(moduleName);
     49                        if( reader == null ) {
     50                                msgHandler.send(astName.pos, MsgCode.CanNotReadInterfaceForTheModule_X, moduleName);
     51                                continue;
     52                        }
     53                        astUse.interf = RfpParser.parseInterf(environment, moduleName);
    4454                }
    45 
    4655        }
    4756}
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/MsgCode.java

    r2373 r2391  
    44        AVariableWithoutIndexInResultExpression(Severity.Error,
    55                        "A variable without index in result expression"), //
     6        CanNotReadInterfaceForTheModule_X(Severity.Error, "Can not read interface for the module %s"), //
    67        CutWithoutAMatchingFence(Severity.Error, "\\! without a matching fence"), //
    78        DuplicateDeclarationOfTheName_X(Severity.Error,
    8                         "Duplicate declaration of the name %s"), //
     9                        "Duplicate declaration of the name %s"), // 
    910        DuplicateDefinitionOfTheFunction_X(Severity.Error,
    10                         "Duplicate definition of the function %s"), // 
     11                        "Duplicate definition of the function %s"), //
    1112        DuplicateImportOfTheModule_X(Severity.Error, "Duplicate import of the module %s"), //
    1213        ExceptionThrown(Severity.Error, "Exception thrown: %s"), //
     
    3738        UnexpectedNewLineInCharacterString(Severity.Error,
    3839                        "Unexpected new line in character string"), //
    39         UnexpectedNewLineInWord(Severity.Error, "Unexpected new line in word"), //
    40         Variable_X_IsNotDefined(Severity.Error, "Variable %s is not defined"), // 
     40        UnexpectedNewLineInWord(Severity.Error, "Unexpected new line in word"), // 
     41        Variable_X_IsNotDefined(Severity.Error, "Variable %s is not defined"), //
    4142        WrongSyntax(Severity.Error, "Wrong syntax"), //
    4243        X_IsNotAFunction(Severity.Error, "%s is not a function") //
Note: See TracChangeset for help on using the changeset viewer.