Changeset 2370


Ignore:
Timestamp:
Feb 10, 2007, 3:29:51 PM (14 years ago)
Author:
roman
Message:

CompilerEnvironment?

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

Legend:

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

    r2369 r2370  
    77public class Checker {
    88
    9         private static void checkModuleImplementation(PushbackReader reader,
    10                         String fileName, MsgHandler msgHandler) {
     9        public static void checkModuleImplementation(CompilerEnvironment environment) {
     10                MsgHandler msgHandler = environment.getMsgHandler();
    1111
    12                 Scanner scanner = new Scanner(reader, fileName, msgHandler);
    13                 AstImplem astImplem = Parser.parseImplem(scanner, fileName, msgHandler);
     12                AstImplem astImplem = RfpParser.parseImplem(environment);
    1413                if (msgHandler.getErrorCount() > 0)
    1514                        return;
     
    2322                FormatChecker.check(astImplem, msgHandler);
    2423        }
    25 
    26         public static void checkModuleImplementation(CompilerEnvironment environment) {
    27                 checkModuleImplementation(environment.getImplemReader(), environment
    28                                 .getModuleName(), environment.getMsgHandler());
    29         }
    3024}
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/CompilerEnvironment.java

    r2369 r2370  
    11package org.refal.plus.comp;
    22
    3 import java.io.PushbackReader;
     3import java.io.Reader;
    44
    55public interface CompilerEnvironment {
     
    88       
    99        String getModuleName();
    10         PushbackReader getInterfReader();
    11         PushbackReader getImplemReader();
    12         PushbackReader getModuleInterfReader(String moduleName);
     10        Reader getInterfReader();
     11        Reader getImplemReader();
     12        Reader getModuleInterfReader(String moduleName);
    1313       
    1414        void ReportImportedModules(String[] moduleNames);
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/RfpParser.java

    r2329 r2370  
    6969import static org.refal.plus.comp.TkTags.WORD;
    7070
     71import java.io.Reader;
    7172import java.util.ArrayList;
    7273import java.util.HashMap;
     
    113114import org.refal.plus.comp.ast.AstWordSymbol;
    114115
    115 public final class Parser {
    116 
    117         private final Scanner scanner;
     116public final class RfpParser {
     117
     118        private final RfpScanner scanner;
    118119
    119120        private final MsgHandler msgHandler;
    120121
    121         private Parser(Scanner scanner, String fileName, MsgHandler msgHandler) {
     122        private RfpParser(CompilerEnvironment environment) {
     123                Reader reader = environment.getImplemReader();
     124                String moduleName = environment.getModuleName();
     125                MsgHandler msgHandler = environment.getMsgHandler();
     126                RfpScanner scanner = new RfpScanner(reader, moduleName, msgHandler);
     127
    122128                this.scanner = scanner;
    123129                this.msgHandler = msgHandler;
     
    291297        }
    292298
    293         public static AstInterf parseInterf(Scanner scanner, String fileName,
    294                         MsgHandler msgHandler) {
    295                 Parser parser = new Parser(scanner, fileName, msgHandler);
     299        public static AstInterf parseInterf(CompilerEnvironment environment) {
     300                RfpParser parser = new RfpParser(environment);
    296301                return parser.interf();
    297302        }
    298303
    299         public static AstImplem parseImplem(Scanner scanner, String fileName,
    300                         MsgHandler msgHandler) {
    301                 Parser parser = new Parser(scanner, fileName, msgHandler);
     304        public static AstImplem parseImplem(CompilerEnvironment environment) {
     305                RfpParser parser = new RfpParser(environment);
    302306                return parser.implem();
    303307        }
  • devel-tools/trunk/eclipse/org.refal.plus.comp/src/org/refal/plus/comp/RfpScanner.java

    r2329 r2370  
    44import java.io.IOException;
    55import java.io.PushbackReader;
     6import java.io.Reader;
    67import java.math.BigInteger;
    78import java.util.TreeMap;
     
    1011import static org.refal.plus.comp.TkTags.*;
    1112
    12 public final class Scanner {
     13public final class RfpScanner {
    1314
    1415        private final PushbackReader reader;
     
    1819        private final MsgHandler msgHandler;
    1920
    20         public Scanner(PushbackReader reader, String fileName,
     21        public RfpScanner(Reader reader, String fileName,
    2122                        MsgHandler msgHandler) {
    22                 this.reader = reader;
     23                this.reader = new PushbackReader(reader);
    2324                this.fileName = fileName;
    2425                this.msgHandler = msgHandler;
Note: See TracChangeset for help on using the changeset viewer.