Changeset 4123 for devel-tools


Ignore:
Timestamp:
Dec 15, 2009, 5:49:26 PM (11 years ago)
Author:
yura
Message:
  • For ref-files use Rf5Compiler.
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/compiler/AstEnvironment.java

    r3648 r4123  
    77import org.refal.rfpdt.ast.AstInterf;
    88import org.refal.rfpdt.ast.AstTopNode;
     9import org.refal.rfpdt.parser.Rf5Parser;
    910import org.refal.rfpdt.parser.RfpParser;
    1011
     
    2425    public CompilerEnvironment getCompilerEnvironment () {
    2526        return env;
     27    }
     28
     29    public AstImplem getRefal5Program (String moduleName) {
     30        return Rf5Parser.parseProgram(moduleName, env.getREFReader(moduleName), msgHandler);
    2631    }
    2732
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/compiler/Checker.java

    r3619 r4123  
    2020        return astImplem;
    2121    }
     22
     23    public static AstImplem getR5 (CompilerEnvironment env) {
     24        return new AstEnvironment(env).getRefal5Program(env.getModuleName());
     25    }
    2226}
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/compiler/CompilerEnvironment.java

    r3566 r4123  
    1313    Reader getRFIReader (String moduleName);
    1414
     15    Reader getREFReader (String moduleName);
     16
    1517    Reader getClassReader (String moduleName);
    1618
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpAbstractBuilder.java

    r3784 r4123  
    6969            getProject().accept(new IResourceVisitor() {
    7070                public boolean visit (IResource resource) throws CoreException {
    71                     if (RfpProject.isRfFile(resource)) {
     71                    if (RfpProject.isRfFile(resource) || RfpProject.isRefFile(resource)) {
    7272                        String moduleName = rfpProject.getModuleName((IFile) resource);
    7373                        if (moduleName != null)
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpBuilder.java

    r3784 r4123  
    147147        }
    148148
     149        public Reader getREFReader (String moduleName) {
     150            IFile file = project.getSource(moduleName, "ref");
     151            if (file == null || !file.exists())
     152                return null;
     153            try {
     154                return new InputStreamReader(file.getContents(), file.getCharset());
     155            } catch (Exception e) {
     156                RfpCore.log(e);
     157                return null;
     158            }
     159        }
     160
    149161        // FIXME: Some thing strange...
    150162        private Reader getClassReaderFromLibrary (IClasspathEntry entry, String moduleName) {
     
    266278    protected void checkAndCompileModuleImplem (String moduleName) {
    267279        IFile file = getRfpProject().getSource(moduleName, "rf");       
    268         if (!RfpProject.isRfFile(file))
    269             return;
     280        IFile file1 = getRfpProject().getSource(moduleName, "ref");       
     281        if (!RfpProject.isRfFile(file)) {
     282            if (!RfpProject.isRefFile(file1))
     283                return;
     284            file = file1;
     285        }
    270286        deleteMarkers(file);
    271287        CompilerEnvironment environment = new IdeCompilerEnvironment(getRfpProject(), file);
     288        if (file == file1) {
     289            Checker.getR5(environment);
     290            return;           
     291        }
    272292        AstImplem astImplem = Checker.getModuleImplementation(environment);
    273293        if (environment.getMsgHandler().getErrorCount() > 0)
     
    350370                        case IResourceDelta.ADDED:
    351371                        case IResourceDelta.CHANGED:
    352                             if (RfpProject.isRfFile(resource) || RfpProject.isRfiFile(resource)) {
     372                            if (RfpProject.isRfFile(resource) || RfpProject.isRfiFile(resource) || RfpProject.isRefFile(resource)) {
    353373                                String moduleName = rfpProject.getModuleName((IFile) resource);
    354374                                if (moduleName != null) {
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpPreBuilder.java

    r3783 r4123  
    5555        }
    5656
     57        public Reader getREFReader (String moduleName) {
     58                return null;
     59        }
     60       
    5761        public Reader getRFIReader (String moduleName) {
    5862            if (!moduleName.equals(this.moduleName))
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpProject.java

    r3879 r4123  
    200200                && resource.getFileExtension().equals("rfi");
    201201    }
     202
     203    public static boolean isRefFile (IResource resource) {
     204        return resource instanceof IFile && resource.getFileExtension() != null
     205                && resource.getFileExtension().equals("ref");
     206    }
    202207}
Note: See TracChangeset for help on using the changeset viewer.