Search in sources :

Example 26 with Statement

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

the class ParserTest method testParseNilaryBlockNoTemps.

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

Example 27 with Statement

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

the class ParserTest method testParse2ArgBlockWithTemps.

@Test
public void testParse2ArgBlockWithTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[:a :b  | | c | a foo. b bar. c foo]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[:a :b | \n| c |\na foo.\nb bar.\nc foo]", (String) _node.prettySourceString());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 28 with Statement

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

the class ParserTest method testParseBinaryUnaryExpression.

@Test
public void testParseBinaryUnaryExpression() {
    final Statement _node;
    _node = Parser.factory.source_(" 3 bar + 2 + 1 foo").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BinaryMessageNode.factory));
    assertEquals((String) "3 bar + 2 + 1 foo", (String) _node.prettySourceString());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 29 with Statement

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

the class ParserTest method testParseEmptyBlock.

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

Example 30 with Statement

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

the class ParserTest method testParseNilaryBlockWithTemps.

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

Aggregations

Statement (st.gravel.support.compiler.ast.Statement)34 Test (org.junit.Test)21 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)5 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 Expression (st.gravel.support.compiler.ast.Expression)3 KeywordMessageNode (st.gravel.support.compiler.ast.KeywordMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 UnaryMessageNode (st.gravel.support.compiler.ast.UnaryMessageNode)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IntermediateStatement (st.gravel.support.compiler.ast.IntermediateStatement)1 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)1 TypeNode (st.gravel.support.compiler.ast.TypeNode)1 VariableNode (st.gravel.support.compiler.ast.VariableNode)1 VariableScopeAnalyzerState (st.gravel.support.compiler.ast.VariableScopeAnalyzerState)1