Search in sources :

Example 1 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class DiskClassReader method defineSharedVariable_init_for_.

public ClassNode defineSharedVariable_init_for_(final String _sharedName, final String _initializerSource, final ClassNode _aClassNode) {
    final Expression _initializer;
    _initializer = this.parseInitializerSource_(_initializerSource);
    return _aClassNode.withSharedVariable_(SharedDeclarationNode.factory.name_initializer_(_sharedName, _initializer));
}
Also used : Expression(st.gravel.support.compiler.ast.Expression)

Example 2 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class IntermediateNodeRewriter method produce_to_do_.

public ToDoNode produce_to_do_(final Expression _start, final Expression _stop, final Expression _loopExpr) {
    final BlockNode _loopBlockNode;
    if (!_loopExpr.isBlockNode()) {
        return null;
    }
    _loopBlockNode = ((BlockNode) _loopExpr);
    return ToDoNode.factory.start_stop_step_counterName_doSequence_(((Expression) this.visit_(_start)), ((Expression) this.visit_(_stop)), IntegerLiteralNode.factory.integer_(((java.math.BigInteger) java.math.BigInteger.ONE)), _loopBlockNode.arguments()[0].name(), ((SequenceNode) this.visit_(_loopBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 3 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class IntermediateNodeRewriter method produce_and_.

public BooleanAndNode produce_and_(final Node _receiver, final Expression _testExpr) {
    final BlockNode _testBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    return BooleanAndNode.factory.left_right_(((Expression) this.visit_(_receiver)), ((SequenceNode) this.visit_(_testBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 4 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class IntermediateNodeRewriter method produce_to_by_do_.

public ToDoNode produce_to_by_do_(final Expression _start, final Expression _stop, final Expression _step, final Expression _loopExpr) {
    final BlockNode _loopBlockNode;
    if (!_loopExpr.isBlockNode()) {
        return null;
    }
    if (!_step.isIntegerLiteralNode()) {
        return null;
    }
    _loopBlockNode = ((BlockNode) _loopExpr);
    return ToDoNode.factory.start_stop_step_counterName_doSequence_(((Expression) this.visit_(_start)), ((Expression) this.visit_(_stop)), ((Expression) this.visit_(_step)), _loopBlockNode.arguments()[0].name(), ((SequenceNode) this.visit_(_loopBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 5 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class IntermediateNodeRewriter method produce_ifTrue_ifFalse_.

public IfTrueIfFalseNode produce_ifTrue_ifFalse_(final Node _receiver, final Expression _trueExpr, final Expression _falseExpr) {
    final BlockNode _trueBlockNode;
    final BlockNode _falseBlockNode;
    if (!_trueExpr.isBlockNode()) {
        return null;
    }
    if (!_falseExpr.isBlockNode()) {
        return null;
    }
    _trueBlockNode = ((BlockNode) _trueExpr);
    _falseBlockNode = ((BlockNode) _falseExpr);
    return IfTrueIfFalseNode.factory.test_trueSequence_falseSequence_returnType_(((Expression) this.visit_(_receiver)), ((SequenceNode) this.visit_(_trueBlockNode.body())), ((SequenceNode) this.visit_(_falseBlockNode.body())), TypeOrNode.factory.left_right_(_trueBlockNode.returnType(), _falseBlockNode.returnType()));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Aggregations

Expression (st.gravel.support.compiler.ast.Expression)25 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)7 BlockNode (st.gravel.support.compiler.ast.BlockNode)6 ArrayList (java.util.ArrayList)3 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 Statement (st.gravel.support.compiler.ast.Statement)3 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)3 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)2 StringLiteralNode (st.gravel.support.compiler.ast.StringLiteralNode)2 List (java.util.List)1 ArrayAtNode (st.gravel.support.compiler.ast.ArrayAtNode)1 ArrayAtPutNode (st.gravel.support.compiler.ast.ArrayAtPutNode)1 ArraySizeNode (st.gravel.support.compiler.ast.ArraySizeNode)1 BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)1 BooleanAndNode (st.gravel.support.compiler.ast.BooleanAndNode)1 BooleanLiteralNode (st.gravel.support.compiler.ast.BooleanLiteralNode)1 BooleanOrNode (st.gravel.support.compiler.ast.BooleanOrNode)1 ByteArrayLiteralNode (st.gravel.support.compiler.ast.ByteArrayLiteralNode)1 CascadeNode (st.gravel.support.compiler.ast.CascadeNode)1