Changeset 2448


Ignore:
Timestamp:
Oct 12, 2012, 6:55:24 PM (7 years ago)
Author:
ksherdy
Message:

Minor additions to accessors/generators.

Location:
proto/pablo/src/compiler/ast
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/pablo/src/compiler/ast/Accessors.java

    r2442 r2448  
    22
    33import java.util.List;
     4
     5import org.w3c.dom.Node;
    46
    57import ast.ASTNode;
     
    5961        public static ASTNode ifTest(IfStatementNode node) {
    6062                return node.child(0);
     63        }
     64       
     65        public static boolean hasElseBlockStatement(IfStatementNode node) {
     66                return node.getChildren().size() == 3;
     67        }
     68       
     69        public static ASTNode elseBlockStatement(IfStatementNode node) {
     70                return node.child(2);
    6171        }
    6272
  • proto/pablo/src/compiler/ast/Generators.java

    r2433 r2448  
    1010import ast.ASTNode;
    1111import ast.BinaryOperatorNode;
     12import ast.BlockStatementNode;
    1213import ast.CompoundVariableNode;
    1314import ast.FunctionInvocationNode;
     
    193194        }       
    194195       
     196        public static BlockStatementNode makeBlockStatementNode(Token tokenLocation) {
     197                LextantToken token = Generators.makeLextantToken(Lextant.WHILE, tokenLocation);
     198                return new BlockStatementNode(token);
     199        }
    195200}
Note: See TracChangeset for help on using the changeset viewer.