Changeset 3402


Ignore:
Timestamp:
Feb 12, 2008, 10:49:25 AM (13 years ago)
Author:
yura
Message:
  • No warnings in org.refal.plus.rfpdf - type is added to generic interface Comparable usage.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.plus.rfpdt/src/org/refal/plus/rfpdt/core/builder/RefalASGenerator.java

    r3347 r3402  
    4343public class RefalASGenerator implements ProgramVisitorWithEnv<Expr.Concatenator>,
    4444        SentenceVisitorWithEnv<Expr.Concatenator>, ExpVisitorWithEnv<Expr.Concatenator> {
    45     private static final Comparable MODULE = Symbol.newWord("MODULE");
    46     private static final Comparable IMPORT = Symbol.newWord("IMPORT");
    47     private static final Comparable EXPORT = Symbol.newWord("EXPORT");
    48     private static final Comparable LOCAL = Symbol.newWord("LOCAL");
    49     private static final Comparable FUNC = Symbol.newWord("FUNC");
    50     private static final Comparable FUNC_Q = Symbol.newWord("FUNC?");
    51     private static final Comparable CONST = Symbol.newWord("CONST");
    52     private static final Comparable NATIVE = Symbol.newWord("NATIVE");
    53     private static final Comparable BRANCH = Symbol.newWord("BRANCH");
    54     private static final Comparable ALT = Symbol.newWord("ALT");
    55     private static final Comparable ALT_Q = Symbol.newWord("ALT?");
    56     private static final Comparable NOT = Symbol.newWord("NOT");
    57     private static final Comparable ITER = Symbol.newWord("ITER");
    58     private static final Comparable TRY = Symbol.newWord("TRY");
    59     private static final Comparable FORMAT = Symbol.newWord("FORMAT");
    60     private static final Comparable LEFT = Symbol.newWord("LEFT");
    61     private static final Comparable RIGHT = Symbol.newWord("RIGHT");
    62     private static final Comparable RESULT = Symbol.newWord("RESULT");
    63     private static final Comparable PAREN = Symbol.newWord("PAREN");
    64     private static final Comparable CALL = Symbol.newWord("CALL");
    65     private static final Comparable REF = Symbol.newWord("REF");
    66     private static final Comparable CUT = Symbol.newWord("CUT");
    67     private static final Comparable FENCE = Symbol.newWord("STAKE");
    68     private static final Comparable CUTALL = Symbol.newWord("CUTALL");
    69     private static final Comparable FAIL = Symbol.newWord("FAIL");
    70     private static final Comparable ERROR = Symbol.newWord("ERROR");
     45    private static final Comparable<String> MODULE = Symbol.newWord("MODULE");
     46    private static final Comparable<String> IMPORT = Symbol.newWord("IMPORT");
     47    private static final Comparable<String> EXPORT = Symbol.newWord("EXPORT");
     48    private static final Comparable<String> LOCAL = Symbol.newWord("LOCAL");
     49    private static final Comparable<String> FUNC = Symbol.newWord("FUNC");
     50    private static final Comparable<String> FUNC_Q = Symbol.newWord("FUNC?");
     51    private static final Comparable<String> CONST = Symbol.newWord("CONST");
     52    private static final Comparable<String> NATIVE = Symbol.newWord("NATIVE");
     53    private static final Comparable<String> BRANCH = Symbol.newWord("BRANCH");
     54    private static final Comparable<String> ALT = Symbol.newWord("ALT");
     55    private static final Comparable<String> ALT_Q = Symbol.newWord("ALT?");
     56    private static final Comparable<String> NOT = Symbol.newWord("NOT");
     57    private static final Comparable<String> ITER = Symbol.newWord("ITER");
     58    private static final Comparable<String> TRY = Symbol.newWord("TRY");
     59    private static final Comparable<String> FORMAT = Symbol.newWord("FORMAT");
     60    private static final Comparable<String> LEFT = Symbol.newWord("LEFT");
     61    private static final Comparable<String> RIGHT = Symbol.newWord("RIGHT");
     62    private static final Comparable<String> RESULT = Symbol.newWord("RESULT");
     63    private static final Comparable<String> PAREN = Symbol.newWord("PAREN");
     64    private static final Comparable<String> CALL = Symbol.newWord("CALL");
     65    private static final Comparable<String> REF = Symbol.newWord("REF");
     66    private static final Comparable<String> CUT = Symbol.newWord("CUT");
     67    private static final Comparable<String> FENCE = Symbol.newWord("STAKE");
     68    private static final Comparable<String> CUTALL = Symbol.newWord("CUTALL");
     69    private static final Comparable<String> FAIL = Symbol.newWord("FAIL");
     70    private static final Comparable<String> ERROR = Symbol.newWord("ERROR");
    7171
    7272    private static Expr makeName (String name) {
     
    8686
    8787    private String moduleName;
    88    
     88
    8989    // ProgramVisitorWithEnv<Expr.Concatenator>
    9090
     
    101101        items.toRight(makeName(modName + "." + astConstBinding.name.identifier));
    102102        astConstBinding.exp.accept(this, items);
    103         e.toRight((Comparable) items.yield());
     103        e.toRight((Comparable<Expr>) items.yield());
    104104    }
    105105
     
    119119        Expr.Concatenator inFormat = Expr.getConcatenator();
    120120        astFuncDecl.inFormat.accept(this, inFormat);
    121         items.toRight((Comparable) inFormat.yield());
     121        items.toRight((Comparable<Expr>) inFormat.yield());
    122122        Expr.Concatenator outFormat = Expr.getConcatenator();
    123123        astFuncDecl.outFormat.accept(this, outFormat);
    124         items.toRight((Comparable) outFormat.yield());
     124        items.toRight((Comparable<Expr>) outFormat.yield());
    125125        if (astFuncDecl.funcDef instanceof AstNative)
    126126            items.toRight(((AstNative) astFuncDecl.funcDef).right.identifier);
     
    129129            body.toRight(BRANCH);
    130130            ((AstFuncDef) astFuncDecl.funcDef).body.accept(this, body);
    131             items.toRight((Comparable) body.yield());
     131            items.toRight((Comparable<Expr>) body.yield());
    132132        }
    133         e.toRight((Comparable) items.yield());
     133        e.toRight((Comparable<Expr>) items.yield());
    134134    }
    135135
     
    161161        Expr.Concatenator inFormat = Expr.getConcatenator();
    162162        astFuncDecl.inFormat.accept(this, inFormat);
    163         items.toRight((Comparable) inFormat.yield());
     163        items.toRight((Comparable<Expr>) inFormat.yield());
    164164        Expr.Concatenator outFormat = Expr.getConcatenator();
    165165        astFuncDecl.outFormat.accept(this, outFormat);
    166         items.toRight((Comparable) outFormat.yield());
     166        items.toRight((Comparable<Expr>) outFormat.yield());
    167167        items.toRight(astNative.left.identifier);
    168         e.toRight((Comparable) items.yield());
     168        e.toRight((Comparable<Expr>) items.yield());
    169169    }
    170170
     
    180180        String modName = astObjDecl.module != null ? astObjDecl.module : moduleName;
    181181        items.toRight(makeName(modName + "." + astObjDecl.name.identifier));
    182         e.toRight((Comparable) items.yield());
     182        e.toRight((Comparable<Expr>) items.yield());
    183183    }
    184184
     
    199199            sentence.toRight(BRANCH);
    200200            astSentence.accept(this, sentence);
    201             items.toRight((Comparable) sentence.yield());
     201            items.toRight((Comparable<Expr>) sentence.yield());
    202202        }
    203         e.toRight((Comparable) items.yield());
     203        e.toRight((Comparable<Expr>) items.yield());
    204204    }
    205205
    206206    public void visit (AstCut astCut, Expr.Concatenator e) {
    207         e.toRight((Comparable) new Expr(CUT));
     207        e.toRight((Comparable<Expr>) new Expr(CUT));
    208208    }
    209209
    210210    public void visit (AstCutAll astCutAll, Expr.Concatenator e) {
    211         e.toRight((Comparable) new Expr(CUTALL));
     211        e.toRight((Comparable<Expr>) new Expr(CUTALL));
    212212    }
    213213
     
    216216        error.toRight(ERROR);
    217217        astError.sentence.accept(this, error);
    218         e.toRight((Comparable) error.yield());
     218        e.toRight((Comparable<Expr>) error.yield());
    219219    }
    220220
    221221    public void visit (AstFail astFail, Expr.Concatenator e) {
    222         e.toRight((Comparable) new Expr(FAIL));
     222        e.toRight((Comparable<Expr>) new Expr(FAIL));
    223223    }
    224224
    225225    public void visit (AstFence astFence, Expr.Concatenator e) {
    226         e.toRight((Comparable) new Expr(FENCE));
     226        e.toRight((Comparable<Expr>) new Expr(FENCE));
    227227    }
    228228
     
    231231        format.toRight(FORMAT);
    232232        astFormat.exp.accept(this, format);
    233         e.toRight((Comparable) format.yield());
     233        e.toRight((Comparable<Expr>) format.yield());
    234234    }
    235235
     
    240240        source.toRight(BRANCH);
    241241        astIter.sentence.accept(this, source);
    242         iter.toRight((Comparable) source.yield());
     242        iter.toRight((Comparable<Expr>) source.yield());
    243243        Expr.Concatenator format = Expr.getConcatenator();
    244244        format.toRight(FORMAT);
    245245        astIter.target.accept(this, format);
    246         iter.toRight((Comparable) format.yield());
    247         e.toRight((Comparable) iter.yield());
     246        iter.toRight((Comparable<Expr>) format.yield());
     247        e.toRight((Comparable<Expr>) iter.yield());
    248248    }
    249249
    250250    public void visit (AstNot astNot, Expr.Concatenator e) {
    251         Comparable[] items = new Comparable[2];
    252         items[0] = NOT;
    253251        Expr.Concatenator source = Expr.getConcatenator();
    254252        source.toRight(BRANCH);
    255253        astNot.sentence.accept(this, source);
    256         items[1] = source.yield();
    257         e.toRight((Comparable) Expr.concat(items[0], items[1]));
     254        e.toRight((Comparable<Expr>) Expr.concat(NOT, (Comparable<Expr>) source.yield()));
    258255    }
    259256
     
    262259        items.toRight(astPattern.dir.select(LEFT, RIGHT));
    263260        astPattern.exp.accept(this, items);
    264         e.toRight((Comparable) items.yield());
     261        e.toRight((Comparable<Expr>) items.yield());
    265262    }
    266263
     
    269266        items.toRight(RESULT);
    270267        astResult.exp.accept(this, items);
    271         e.toRight((Comparable) items.yield());
     268        e.toRight((Comparable<Expr>) items.yield());
    272269    }
    273270
     
    283280        trap.toRight(BRANCH);
    284281        astTrap.trySentence.accept(this, trap);
    285         items.toRight((Comparable) trap.yield());
     282        items.toRight((Comparable<Expr>) trap.yield());
    286283        Expr.Concatenator with = Expr.getConcatenator();
    287284        with.toRight(BRANCH);
    288285        astTrap.catchSentence.accept(this, with);
    289         items.toRight((Comparable) with.yield());
    290         e.toRight((Comparable) items.yield());
     286        items.toRight((Comparable<Expr>) with.yield());
     287        e.toRight((Comparable<Expr>) items.yield());
    291288    }
    292289
     
    301298        items.toRight(makeName(modName + "." + astCall.funcDecl.name.identifier));
    302299        astCall.arg.accept(this, items);
    303         e.toRight((Comparable) items.yield());
     300        e.toRight((Comparable<Expr>) items.yield());
    304301    }
    305302
     
    321318        items.toRight(PAREN);
    322319        astParen.exp.accept(this, items);
    323         e.toRight((Comparable) items.yield());
     320        e.toRight((Comparable<Expr>) items.yield());
    324321    }
    325322
     
    331328            modName = moduleName;
    332329        items.toRight(makeName(modName + "." + astRef.decl.name.identifier));
    333         e.toRight((Comparable) items.yield());
     330        e.toRight((Comparable<Expr>) items.yield());
    334331    }
    335332
    336333    public void visit (AstVar astVar, Expr.Concatenator e) {
    337         Comparable[] items = new Comparable[2];
    338         items[0] = Symbol.newWord(astVar.type.name() + "VAR");
     334        Comparable<String> symbol1 = Symbol.newWord(astVar.type.name() + "VAR");
     335        Comparable<Expr> symbol2;
    339336        if (astVar.name != null && astVar.name.identifier.length() > 0)
    340             items[1] = new Expr(Symbol.newWord(astVar.name.identifier));
     337            symbol2 = new Expr(Symbol.newWord(astVar.name.identifier));
    341338        else
    342             items[1] = new Expr(Symbol.newWord("$tmp-" + astVar.pos.charStart));
    343         e.toRight((Comparable) Expr.concat(items[0], items[1]));
     339            symbol2 = new Expr(Symbol.newWord("$tmp-" + astVar.pos.charStart));
     340        e.toRight((Comparable<Expr>) Expr.concat(symbol1, symbol2));
    344341    }
    345342
Note: See TracChangeset for help on using the changeset viewer.