Search in sources :

Example 1 with BlockNode

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

the class ParserTest method testParse2ArgBlockEmpty1.

@Test
public void testParse2ArgBlockEmpty1() {
    final BlockNode _node;
    _node = ((BlockNode) Parser.factory.source_("[:a :b  | ]").parseExpression());
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "[:a :b | ]", (String) _node.prettySourceString());
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Test(org.junit.Test)

Example 2 with BlockNode

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

the class ParserTest method testParseVariableDot.

@Test
public void testParseVariableDot() {
    final BlockNode _node;
    _node = ((BlockNode) Parser.factory.source_(" [foo. bar] ").parseExpression());
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[\nfoo.\nbar]", (String) _node.prettySourceString());
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Test(org.junit.Test)

Example 3 with BlockNode

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

the class IntermediateNodeRewriter method produce_whileFalse_.

public WhileFalseNode produce_whileFalse_(final Expression _testExpr, final Expression _loopExpr) {
    final BlockNode _testBlockNode;
    final BlockNode _loopBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    if (!_loopExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    _loopBlockNode = ((BlockNode) _loopExpr);
    return WhileFalseNode.factory.testSequence_doSequence_(((SequenceNode) this.visit_(_testBlockNode.body())), ((SequenceNode) this.visit_(_loopBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 4 with BlockNode

use of st.gravel.support.compiler.ast.BlockNode 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 5 with BlockNode

use of st.gravel.support.compiler.ast.BlockNode 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)

Aggregations

BlockNode (st.gravel.support.compiler.ast.BlockNode)16 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)10 Expression (st.gravel.support.compiler.ast.Expression)5 JVMVariable (st.gravel.support.compiler.jvm.JVMVariable)3 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ArrayAtNode (st.gravel.support.compiler.ast.ArrayAtNode)1 ArrayAtPutNode (st.gravel.support.compiler.ast.ArrayAtPutNode)1 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)1 ArraySizeNode (st.gravel.support.compiler.ast.ArraySizeNode)1 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)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 CharacterLiteralNode (st.gravel.support.compiler.ast.CharacterLiteralNode)1 CreateHolderNode (st.gravel.support.compiler.ast.CreateHolderNode)1