Changeset 3313


Ignore:
Timestamp:
Jun 14, 2013, 5:16:59 PM (6 years ago)
Author:
ksherdy
Message:

Preparation for IDISA function call generators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/pabloj/trunk/src/toolchain/pabloB/ast/Generators.java

    r3266 r3313  
    155155        }       
    156156
     157        /*
     158    public static FuncCallNode makeIdisaFuncCallNode(Locator locator, int fieldWidth, String identifier) {       
     159        IdentifierNode identifierNode = Generators.makeIdentifierNode(locator, identifier);
     160        return Generators.makeFuncCallNode(locator, identifierNode);
     161    }
     162   
     163    public static FuncCallNode makeIdisaFuncCallNode(Locator locator, int fieldWidth, String identifier, ASTNode ...args) {
     164        FuncCallNode node = Generators.makeFuncCallNode(locator, identifier);
     165        Generators.addFuncCallArgs(node, args);
     166        return node;
     167    }   
     168   
     169    public static FuncCallNode makeIdisaFuncCallNode(Locator locator, int fieldWidth, String pckage, String name) {
     170        CompoundIdentifierNode compoundIdentifierNode = Generators.makeCompoundIdentifierNode(locator, pckage, name);   
     171        return Generators.makeFuncCallNode(locator, compoundIdentifierNode);
     172    }
     173   
     174    public static FuncCallNode makeIdisaFuncCallNode(Locator locator, int fieldWidth, String pckage, String name, ASTNode ...args ) {
     175        CompoundIdentifierNode compoundIdentifierNode = Generators.makeCompoundIdentifierNode(locator, pckage, name);   
     176        FuncCallNode node = Generators.makeFuncCallNode(locator, compoundIdentifierNode);
     177        Generators.addFuncCallArgs(node, args);
     178        return node;
     179    }   
     180
     181    private static FuncCallNode makeIdisaFuncCallNode(Locator locator, int fieldWidth, ASTNode identifier) {
     182        assert ((identifier instanceof IdentifierNode) || (identifier instanceof CompoundIdentifierNode));
     183        LextantToken token = Generators.makeLextantToken(locator, Lextant.LANGLE);
     184        // ADD FIELD WIDTH NODE
     185        FuncCallNode FuncCallNode = new FuncCallNode(token);
     186        FuncCallNode.appendChild(identifier);
     187        FuncCallNode.appendChild(new IdisaFuncCallArgListNode(token));       
     188        return FuncCallNode;
     189    }   
     190       
     191    private static void addIdisaFuncCallArgs(FuncCallNode node, ASTNode ...args) {
     192        if(args.length > 0) {
     193            for(ASTNode child: args) {
     194                Accessors.funcCallArgsListNode(node).appendChild(child);
     195            }
     196            Accessors.funcCallArgsListNode(node).setToken(args[0].getToken());
     197        }   
     198    }
     199         */
     200       
     201    public static FuncCallNode makeFuncCallNode(Locator locator, String identifier) {       
     202        IdentifierNode identifierNode = Generators.makeIdentifierNode(locator, identifier);
     203        return Generators.makeFuncCallNode(locator, identifierNode);
     204    }
     205       
    157206        public static FuncCallNode makeFuncCallNode(Locator locator, String identifier, ASTNode ...args) {
    158207                FuncCallNode node = Generators.makeFuncCallNode(locator, identifier);
     
    160209                return node;
    161210        }       
    162 
    163     public static FuncCallNode makeFuncCallNode(Locator locator, String identifier) {
    164         IdentifierNode identifierNode = Generators.makeIdentifierNode(locator, identifier);
    165         return Generators.makeFuncCallNode(locator, identifierNode);
    166     }
    167211       
    168212        public static FuncCallNode makeFuncCallNode(Locator locator, String pckage, String name) {
Note: See TracChangeset for help on using the changeset viewer.